mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 14:38:56 +00:00
UB3R UPD4T3!!! Alpha -> Beta, this is what the release will look similar to. Install and give feedback/bugs!
This commit is contained in:
1 parent
19043b1229
commit
17eda0e472
22 files changed
+3151
No files matched your search
@@ -0,0 +1 @@
|
||||
/target/
|
||||
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<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 <http://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
|
||||
<http://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
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
@@ -0,0 +1,51 @@
|
||||
<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>net.h31ix.anticheat</groupId>
|
||||
<artifactId>AntiCheat</artifactId>
|
||||
<version>1.0</version>
|
||||
<name>AntiCheat</name>
|
||||
<url>http://H31IX.NET/</url>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>bukkit-repo</id>
|
||||
<url>http://repo.bukkit.org/content/repositories/releases/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>AntiCheat</finalName>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.2.5-R1.0</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.2.5-R1.0</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>12.0</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012 H31IX http://h31ix.net
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.h31ix.anticheat;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.h31ix.anticheat.event.*;
|
||||
import net.h31ix.anticheat.manage.AnticheatManager;
|
||||
import net.h31ix.anticheat.xray.XRayListener;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class Anticheat extends JavaPlugin
|
||||
{
|
||||
private static Anticheat plugin;
|
||||
private final List<Listener> eventList = new ArrayList<Listener>();
|
||||
private static boolean update = false;
|
||||
private static final int BYTE_SIZE = 1024;
|
||||
|
||||
@Override
|
||||
public void onDisable()
|
||||
{
|
||||
if(update && AnticheatManager.CONFIGURATION.autoUpdate())
|
||||
{
|
||||
saveFile("plugins\\AntiCheat.jar", "http://dl.dropbox.com/u/38228324/AntiCheat.jar");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
plugin = this;
|
||||
checkForUpdate();
|
||||
if(!new File("plugins/AntiCheat/config.yml").exists())
|
||||
{
|
||||
saveDefaultConfig();
|
||||
}
|
||||
eventList.add(new PlayerListener());
|
||||
eventList.add(new BlockListener());
|
||||
eventList.add(new EntityListener());
|
||||
eventList.add(new VehicleListener());
|
||||
if(AnticheatManager.CONFIGURATION.logXRay())
|
||||
{
|
||||
eventList.add(new XRayListener());
|
||||
}
|
||||
for(Listener listener : eventList)
|
||||
{
|
||||
getServer().getPluginManager().registerEvents(listener, this);
|
||||
}
|
||||
getCommand("anticheat").setExecutor(new CommandHandler());
|
||||
}
|
||||
|
||||
private void saveFile(String file, String url)
|
||||
{
|
||||
BufferedInputStream in = null;
|
||||
FileOutputStream fout = null;
|
||||
try
|
||||
{
|
||||
in = new BufferedInputStream(new URL(url).openStream());
|
||||
fout = new FileOutputStream(file);
|
||||
|
||||
byte[] data = new byte[BYTE_SIZE];
|
||||
int count;
|
||||
while ((count = in.read(data, 0, BYTE_SIZE)) != -1)
|
||||
{
|
||||
fout.write(data, 0, count);
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (in != null)
|
||||
{
|
||||
in.close();
|
||||
}
|
||||
if (fout != null)
|
||||
{
|
||||
fout.close();
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkForUpdate()
|
||||
{
|
||||
URL url = null;
|
||||
URLConnection urlConn = null;
|
||||
InputStreamReader inStream = null;
|
||||
BufferedReader buff = null;
|
||||
String v = "";
|
||||
try
|
||||
{
|
||||
url = new URL("http://dl.dropbox.com/u/38228324/anticheatVersion.txt");
|
||||
urlConn = url.openConnection();
|
||||
inStream = new InputStreamReader(urlConn.getInputStream());
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
}
|
||||
buff= new BufferedReader(inStream);
|
||||
try
|
||||
{
|
||||
v =buff.readLine();
|
||||
urlConn = null;
|
||||
inStream = null;
|
||||
buff.close();
|
||||
buff = null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
if (!this.getDescription().getVersion().equalsIgnoreCase(v))
|
||||
{
|
||||
update = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
update = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static Anticheat getPlugin()
|
||||
{
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public static boolean isUpdated()
|
||||
{
|
||||
return !update;
|
||||
}
|
||||
|
||||
public static String getVersion()
|
||||
{
|
||||
return plugin.getDescription().getVersion();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,330 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012 H31IX http://h31ix.net
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.h31ix.anticheat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.h31ix.anticheat.manage.AnticheatManager;
|
||||
import net.h31ix.anticheat.manage.PlayerManager;
|
||||
import net.h31ix.anticheat.xray.XRayTracker;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CommandHandler implements CommandExecutor {
|
||||
|
||||
private Configuration config = AnticheatManager.CONFIGURATION;
|
||||
private PlayerManager playerManager = AnticheatManager.PLAYER_MANAGER;
|
||||
private XRayTracker xtracker = AnticheatManager.XRAY_TRACKER;
|
||||
private static final ChatColor RED = ChatColor.RED;
|
||||
private static final ChatColor YELLOW = ChatColor.YELLOW;
|
||||
private static final ChatColor GREEN = ChatColor.GREEN;
|
||||
private static final ChatColor WHITE = ChatColor.WHITE;
|
||||
private List<Player> high = new ArrayList<Player>();
|
||||
private List<Player> med = new ArrayList<Player>();
|
||||
private List<Player> low = new ArrayList<Player>();
|
||||
private static final Server SERVER = Bukkit.getServer();
|
||||
private static final int MED_THRESHOLD = 20;
|
||||
private static final int HIGH_THRESHOLD = 50;
|
||||
|
||||
public void handleLog(CommandSender cs, String [] args)
|
||||
{
|
||||
if(hasPermission(cs))
|
||||
{
|
||||
if(args[1].equalsIgnoreCase("enable"))
|
||||
{
|
||||
if(!config.logConsole())
|
||||
{
|
||||
config.setLog(true);
|
||||
cs.sendMessage(GREEN+"Console logging enabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage(GREEN+"Console logging is already enabled!");
|
||||
}
|
||||
}
|
||||
else if(args[1].equalsIgnoreCase("disable"))
|
||||
{
|
||||
if(config.logConsole())
|
||||
{
|
||||
config.setLog(false);
|
||||
cs.sendMessage(GREEN+"Console logging disabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage(GREEN+"Console logging is already disabled!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage(RED+"Usage: /anticheat log [enable/disable]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleXRay(CommandSender cs, String [] args)
|
||||
{
|
||||
if(hasPermission(cs))
|
||||
{
|
||||
if(config.logXRay())
|
||||
{
|
||||
List<Player> list = SERVER.matchPlayer(args[1]);
|
||||
if(list.size() == 1)
|
||||
{
|
||||
Player player = list.get(0);
|
||||
if(xtracker.sufficientData(player.getName()))
|
||||
{
|
||||
xtracker.sendStats(cs, player.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage(RED+"Insufficient data collected from "+WHITE+args[1]+RED+".");
|
||||
cs.sendMessage(RED+"Please wait until more info is collected before predictions are calculated.");
|
||||
}
|
||||
}
|
||||
else if(list.size() > 1)
|
||||
{
|
||||
cs.sendMessage(RED+"Multiple players found by name: "+WHITE+args[1]+RED+".");
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage(RED+"Player: "+WHITE+args[1]+RED+" not found.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage(RED+"XRay logging is off in the config.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleReset(CommandSender cs, String [] args)
|
||||
{
|
||||
if(hasPermission(cs))
|
||||
{
|
||||
List<Player> list = SERVER.matchPlayer(args[1]);
|
||||
if(list.size() == 1)
|
||||
{
|
||||
Player player = list.get(0);
|
||||
getPlayers();
|
||||
if(low.contains(player))
|
||||
{
|
||||
cs.sendMessage(player.getName()+RED+" is already in Low Level!");
|
||||
}
|
||||
else if (med.contains(player) || high.contains(player))
|
||||
{
|
||||
playerManager.reset(player);
|
||||
cs.sendMessage(player.getName()+GREEN+" has been reset to Low Level.");
|
||||
}
|
||||
xtracker.reset(player.getName());
|
||||
cs.sendMessage(player.getName()+GREEN+"'s XRay stats have been reset.");
|
||||
}
|
||||
else if(list.size() > 1)
|
||||
{
|
||||
cs.sendMessage(RED+"Multiple players found by name: "+WHITE+args[1]+RED+".");
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage(RED+"Player: "+WHITE+args[1]+RED+" not found.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleHelp(CommandSender cs)
|
||||
{
|
||||
if(hasPermission(cs))
|
||||
{
|
||||
String base = "/AntiCheat ";
|
||||
cs.sendMessage("----------------------["+GREEN+"AntiCheat"+WHITE+"]----------------------");
|
||||
cs.sendMessage(base+GREEN+"log [Enable/Disable]"+WHITE+" - toggle logging");
|
||||
cs.sendMessage(base+GREEN+"report"+WHITE+" - get a detailed cheat report");
|
||||
cs.sendMessage(base+GREEN+"reload"+WHITE+" - reload AntiCheat configuration");
|
||||
cs.sendMessage(base+GREEN+"reset [user]"+WHITE+" - reset user's hack level");
|
||||
cs.sendMessage(base+GREEN+"xray [user]"+WHITE+" - check user's xray levels");
|
||||
cs.sendMessage(base+GREEN+"help"+WHITE+" - access this page");
|
||||
cs.sendMessage(base+GREEN+"update"+WHITE+" - check update status");
|
||||
cs.sendMessage("-----------------------------------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
public void handleUpdate(CommandSender cs)
|
||||
{
|
||||
if(hasPermission(cs))
|
||||
{
|
||||
cs.sendMessage("Running "+GREEN+"AntiCheat "+WHITE+"v"+GREEN+Anticheat.getVersion());
|
||||
cs.sendMessage("-----------------------------------------------------");
|
||||
if(!Anticheat.isUpdated())
|
||||
{
|
||||
cs.sendMessage("There "+GREEN+"IS"+WHITE+" a newer version avaliable.");
|
||||
if(config.autoUpdate())
|
||||
{
|
||||
cs.sendMessage("It will be installed automatically for you on next launch.");
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage("Due to your config settings, we "+RED+"can not"+WHITE+" auto update.");
|
||||
cs.sendMessage("Please visit http://dev.bukkit.org/server-mods/anticheat/");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage("AntiCheat is "+GREEN+"UP TO DATE!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleReport(CommandSender cs)
|
||||
{
|
||||
if(hasPermission(cs))
|
||||
{
|
||||
getPlayers();
|
||||
if(!low.isEmpty())
|
||||
{
|
||||
cs.sendMessage(GREEN+"----Level: Low (Not likely hacking)----");
|
||||
for(Player player : low)
|
||||
{
|
||||
cs.sendMessage(GREEN+player.getName());
|
||||
}
|
||||
}
|
||||
if(!med.isEmpty())
|
||||
{
|
||||
cs.sendMessage(YELLOW+"----Level: Medium (Possibly hacking/lagging)----");
|
||||
for(Player player : med)
|
||||
{
|
||||
cs.sendMessage(YELLOW+player.getName());
|
||||
}
|
||||
}
|
||||
if(!high.isEmpty())
|
||||
{
|
||||
cs.sendMessage(RED+"----Level: High (Probably hacking or bad connection)----");
|
||||
for(Player player : high)
|
||||
{
|
||||
cs.sendMessage(RED+player.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleReload(CommandSender cs)
|
||||
{
|
||||
if(hasPermission(cs))
|
||||
{
|
||||
config.load();
|
||||
cs.sendMessage(GREEN+"AntiCheat configuration reloaded.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender cs, Command cmd, String alias, String[] args)
|
||||
{
|
||||
if(args.length == 2)
|
||||
{
|
||||
if(args[0].equalsIgnoreCase("log"))
|
||||
{
|
||||
handleLog(cs,args);
|
||||
}
|
||||
else if(args[0].equalsIgnoreCase("xray"))
|
||||
{
|
||||
handleXRay(cs,args);
|
||||
}
|
||||
else if(args[0].equalsIgnoreCase("reset"))
|
||||
{
|
||||
handleReset(cs,args);
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage(RED+"Unrecognized command.");
|
||||
}
|
||||
}
|
||||
else if (args.length == 1)
|
||||
{
|
||||
if(args[0].equalsIgnoreCase("help"))
|
||||
{
|
||||
handleHelp(cs);
|
||||
}
|
||||
else if(args[0].equalsIgnoreCase("report"))
|
||||
{
|
||||
handleReport(cs);
|
||||
}
|
||||
else if(args[0].equalsIgnoreCase("reload"))
|
||||
{
|
||||
handleReload(cs);
|
||||
}
|
||||
else if(args[0].equalsIgnoreCase("update"))
|
||||
{
|
||||
handleUpdate(cs);
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage(RED+"Unrecognized command.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage(RED+"Unrecognized command.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasPermission(CommandSender cs)
|
||||
{
|
||||
if(cs instanceof Player)
|
||||
{
|
||||
if(((Player)cs).hasPermission("anticheat.admin"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage("Insufficient permissions.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public void getPlayers()
|
||||
{
|
||||
high.clear();
|
||||
med.clear();
|
||||
low.clear();
|
||||
for(Player player : SERVER.getOnlinePlayers())
|
||||
{
|
||||
int level = playerManager.getLevel(player);
|
||||
if(level <= MED_THRESHOLD)
|
||||
{
|
||||
low.add(player);
|
||||
}
|
||||
else if(level <= HIGH_THRESHOLD)
|
||||
{
|
||||
med.add(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
high.add(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012 H31IX http://h31ix.net
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.h31ix.anticheat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
public class Configuration {
|
||||
private File configFile = new File("plugins/AntiCheat/config.yml");
|
||||
private FileConfiguration config;
|
||||
private boolean logConsole;
|
||||
private boolean logXRay;
|
||||
private boolean autoUpdate;
|
||||
private List<String> worlds = new ArrayList<String>();
|
||||
|
||||
public Configuration()
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
private void save()
|
||||
{
|
||||
try
|
||||
{
|
||||
config.save(configFile);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean logConsole()
|
||||
{
|
||||
return logConsole;
|
||||
}
|
||||
|
||||
public boolean logXRay()
|
||||
{
|
||||
return logXRay;
|
||||
}
|
||||
|
||||
public boolean autoUpdate()
|
||||
{
|
||||
return autoUpdate;
|
||||
}
|
||||
|
||||
public final void load()
|
||||
{
|
||||
config = YamlConfiguration.loadConfiguration(configFile);
|
||||
if(config.getString("Logging.Log to console") != null)
|
||||
{
|
||||
boolean b = config.getBoolean("Logging.Log to console");
|
||||
config.set("Logging", null);
|
||||
config.set("System.Log to console",b);
|
||||
save();
|
||||
}
|
||||
logConsole = config.getBoolean("System.Log to console");
|
||||
if(config.getList("Enable in") == null)
|
||||
{
|
||||
List<String> w = new ArrayList<String>();
|
||||
for(World world : Bukkit.getServer().getWorlds())
|
||||
{
|
||||
w.add(world.getName());
|
||||
}
|
||||
config.set("Enable in", w);
|
||||
save();
|
||||
}
|
||||
worlds = (List<String>)(config.getList("Enable in"));
|
||||
if(config.getString("XRay.Log xray stats") == null)
|
||||
{
|
||||
config.set("XRay.Log xray stats", true);
|
||||
save();
|
||||
}
|
||||
logXRay = config.getBoolean("XRay.Log xray stats");
|
||||
if(config.getString("System.Auto update") == null)
|
||||
{
|
||||
config.set("System.Auto update", true);
|
||||
save();
|
||||
}
|
||||
autoUpdate = config.getBoolean("System.Auto update");
|
||||
}
|
||||
|
||||
public String getResult(String event)
|
||||
{
|
||||
return config.getString("Events.Level "+event);
|
||||
}
|
||||
|
||||
public void setLog(boolean b)
|
||||
{
|
||||
config.set("System.Log to console", b);
|
||||
this.logConsole = b;
|
||||
try
|
||||
{
|
||||
config.save(configFile);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getWorlds()
|
||||
{
|
||||
return worlds;
|
||||
}
|
||||
|
||||
public boolean checkInWorld(World world)
|
||||
{
|
||||
return worlds.contains(world.getName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012 H31IX http://h31ix.net
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.h31ix.anticheat.event;
|
||||
|
||||
import net.h31ix.anticheat.Anticheat;
|
||||
import net.h31ix.anticheat.manage.Backend;
|
||||
import net.h31ix.anticheat.manage.CheckManager;
|
||||
import net.h31ix.anticheat.manage.CheckType;
|
||||
import net.h31ix.anticheat.manage.Distance;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
|
||||
public class BlockListener extends EventListener
|
||||
{
|
||||
private final Backend backend = getBackend();
|
||||
private final CheckManager checkManager = getCheckManager();
|
||||
private final Anticheat plugin = getPlugin();
|
||||
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent event)
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
Block block = event.getBlock();
|
||||
if(player != null)
|
||||
{
|
||||
if(checkManager.willCheck(player, CheckType.NO_SWING) && backend.checkSwing(player))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
log("tried to break a block of "+block.getType().name()+" without swinging their arm.",player);
|
||||
}
|
||||
if(checkManager.willCheck(player, CheckType.LONG_REACH))
|
||||
{
|
||||
Distance distance = new Distance(player.getLocation(),block.getLocation());
|
||||
if(backend.checkLongReachBlock(distance.getXDifference(),distance.getYDifference(),distance.getZDifference()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
log("tried to break a block of "+block.getType().name()+" that was too far away.",player);
|
||||
}
|
||||
}
|
||||
if(checkManager.willCheck(player, CheckType.FAST_BREAK))
|
||||
{
|
||||
if(backend.checkFastBreak(player,block))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
log("tried to break a block of "+block.getType().name()+" too fast.",player);
|
||||
}
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
backend.checkSwing(player);
|
||||
}
|
||||
}, 2L);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012 H31IX http://h31ix.net
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.h31ix.anticheat.event;
|
||||
|
||||
import net.h31ix.anticheat.manage.Backend;
|
||||
import net.h31ix.anticheat.manage.CheckManager;
|
||||
import net.h31ix.anticheat.manage.CheckType;
|
||||
import net.h31ix.anticheat.manage.Distance;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
|
||||
|
||||
public class EntityListener extends EventListener
|
||||
{
|
||||
private final Backend backend = getBackend();
|
||||
private final CheckManager checkManager = getCheckManager();
|
||||
|
||||
@EventHandler
|
||||
public void onEntityShootBow(EntityShootBowEvent event)
|
||||
{
|
||||
if(event.getEntity() instanceof Player)
|
||||
{
|
||||
Player player = (Player)event.getEntity();
|
||||
if(checkManager.willCheck(player, CheckType.FAST_BOW) && backend.justWoundUp(player))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
log("tried to fire a bow too fast.",player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityRegainHealth(EntityRegainHealthEvent event)
|
||||
{
|
||||
if(event.getEntity() instanceof Player && event.getRegainReason() == RegainReason.SATIATED)
|
||||
{
|
||||
Player player = (Player)event.getEntity();
|
||||
if(checkManager.willCheck(player, CheckType.FAST_HEAL) && backend.justHealed(player))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
log("tried to heal too fast.",player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onFoodLevelChange(FoodLevelChangeEvent event)
|
||||
{
|
||||
if(event.getEntity() instanceof Player)
|
||||
{
|
||||
Player player = (Player)event.getEntity();
|
||||
if(checkManager.willCheck(player, CheckType.FAST_EAT) && backend.justStartedEating(player))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
log("tried to eat too fast.",player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityDamage(EntityDamageEvent event)
|
||||
{
|
||||
if (event instanceof EntityDamageByEntityEvent)
|
||||
{
|
||||
EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event;
|
||||
if(e.getDamager() instanceof Player)
|
||||
{
|
||||
Player player = (Player) e.getDamager();
|
||||
if(checkManager.willCheck(player, CheckType.FORCEFIELD) && backend.justSprinted(player))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
log("tried to sprint & damage too fast.",player);
|
||||
}
|
||||
}
|
||||
if(event.getEntity() instanceof Player)
|
||||
{
|
||||
Player player = (Player)event.getEntity();
|
||||
if (e.getDamager() instanceof Player)
|
||||
{
|
||||
Player p = (Player) e.getDamager();
|
||||
backend.logDamage(p);
|
||||
backend.logDamage(player);
|
||||
if(checkManager.willCheck(player, CheckType.LONG_REACH))
|
||||
{
|
||||
Distance distance = new Distance(player.getLocation(),p.getLocation());
|
||||
if(backend.checkLongReachDamage(distance.getXDifference(),distance.getYDifference(),distance.getZDifference()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
log("tried to damage a player too far away from them.",player);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
backend.logDamage(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012 H31IX http://h31ix.net
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.h31ix.anticheat.event;
|
||||
|
||||
import net.h31ix.anticheat.Anticheat;
|
||||
import net.h31ix.anticheat.manage.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class EventListener implements Listener
|
||||
{
|
||||
private static final CheckManager CHECK_MANAGER = AnticheatManager.CHECK_MANAGER;
|
||||
private static final Backend BACKEND = AnticheatManager.BACKEND;
|
||||
private static final Anticheat PLUGIN = Anticheat.getPlugin();
|
||||
private static final PlayerManager PLAYER_MANAGER = AnticheatManager.PLAYER_MANAGER;
|
||||
|
||||
public void log(String message,Player player)
|
||||
{
|
||||
if(AnticheatManager.CONFIGURATION.logConsole())
|
||||
{
|
||||
AnticheatManager.log(player.getName()+" "+message);
|
||||
PLAYER_MANAGER.increaseLevel(player);
|
||||
}
|
||||
}
|
||||
|
||||
public CheckManager getCheckManager()
|
||||
{
|
||||
return CHECK_MANAGER;
|
||||
}
|
||||
|
||||
public Backend getBackend()
|
||||
{
|
||||
return BACKEND;
|
||||
}
|
||||
|
||||
public Anticheat getPlugin()
|
||||
{
|
||||
return PLUGIN;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012 H31IX http://h31ix.net
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.h31ix.anticheat.event;
|
||||
|
||||
import net.h31ix.anticheat.manage.*;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
public class PlayerListener extends EventListener
|
||||
{
|
||||
private final Backend backend = getBackend();
|
||||
private final CheckManager checkManager = getCheckManager();
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
if(checkManager.willCheck(player, CheckType.SPAM))
|
||||
{
|
||||
backend.logChat(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerChat(PlayerChatEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
if(checkManager.willCheck(player, CheckType.SPAM))
|
||||
{
|
||||
backend.logChat(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerKick(PlayerKickEvent event)
|
||||
{
|
||||
backend.clearChatLevel(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerToggleSprint(PlayerToggleSprintEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
if(checkManager.willCheck(player, CheckType.SPRINT) && backend.checkSprint(event))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
player.setSprinting(false);
|
||||
log("tried to sprint while hungry.",player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
PlayerInventory inv = player.getInventory();
|
||||
if(event.getAction() == Action.RIGHT_CLICK_AIR)
|
||||
{
|
||||
Material m = inv.getItemInHand().getType();
|
||||
if(m == Material.BOW)
|
||||
{
|
||||
backend.logBowWindUp(player);
|
||||
}
|
||||
else if(Utilities.isFood(m))
|
||||
{
|
||||
backend.logEatingStart(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
if(checkManager.willCheck(player, CheckType.ITEM_SPAM))
|
||||
{
|
||||
if(backend.justDroppedItem(player))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
backend.logDroppedItem(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerAnimation(PlayerAnimationEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
backend.logAnimation(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
if(checkManager.willCheck(player, CheckType.ZOMBE_FLY))
|
||||
{
|
||||
player.sendMessage("§f §f §1 §0 §2 §4");
|
||||
}
|
||||
if(checkManager.willCheck(player, CheckType.ZOMBE_CHEAT))
|
||||
{
|
||||
player.sendMessage("§f §f §2 §0 §4 §8");
|
||||
}
|
||||
if(checkManager.willCheck(player, CheckType.ZOMBE_NOCLIP))
|
||||
{
|
||||
player.sendMessage("§f §f §4 §0 §9 §6");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void checkExploit(PlayerMoveEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
Location from = event.getFrom();
|
||||
Location to = event.getTo();
|
||||
Distance distance = new Distance(from, to);
|
||||
double x = distance.getXDifference();
|
||||
double y = distance.getYDifference();
|
||||
double z = distance.getZDifference();
|
||||
if(checkManager.willCheck(player, CheckType.FLY) && backend.checkFlight(player, from.getY(), to.getY()))
|
||||
{
|
||||
event.setTo(from);
|
||||
log("tried to fly.",player);
|
||||
}
|
||||
if(checkManager.willCheck(player, CheckType.SPEED))
|
||||
{
|
||||
if(event.getFrom().getY() < event.getTo().getY() && backend.checkYSpeed(player, y))
|
||||
{
|
||||
event.setTo(from);
|
||||
log("tried to ascend to fast.",player);
|
||||
}
|
||||
if(backend.checkXZSpeed(player,x,z))
|
||||
{
|
||||
event.setTo(from);
|
||||
log("tried to move too fast.",player);
|
||||
}
|
||||
}
|
||||
if(checkManager.willCheck(player, CheckType.NOFALL) && event.getFrom().getY() > event.getTo().getY() && backend.checkNoFall(player, y))
|
||||
{
|
||||
event.setTo(from);
|
||||
log("tried avoid fall damage.",player);
|
||||
}
|
||||
}
|
||||
@EventHandler
|
||||
public void checkDirSpeed(PlayerMoveEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
Location from = event.getFrom();
|
||||
Location to = event.getTo();
|
||||
Distance distance = new Distance(from, to);
|
||||
double x = distance.getXDifference();
|
||||
double y = distance.getYDifference();
|
||||
double z = distance.getZDifference();
|
||||
if(checkManager.willCheck(player, CheckType.WATER_WALK) && backend.checkWaterWalk(player,x,z))
|
||||
{
|
||||
event.setTo(from);
|
||||
log("tried to walk on water.",player);
|
||||
}
|
||||
if(checkManager.willCheck(player, CheckType.SNEAK) && backend.checkSneak(player,x,z))
|
||||
{
|
||||
event.setTo(from);
|
||||
player.setSneaking(false);
|
||||
log("tried to sneak too fast.",player);
|
||||
}
|
||||
if(checkManager.willCheck(player, CheckType.SPIDER) && backend.checkSpider(player, y))
|
||||
{
|
||||
event.setTo(from);
|
||||
log("tried to climb a wall.",player);
|
||||
}
|
||||
if(checkManager.willCheck(player, CheckType.NOFALL) && event.getFrom().getY() > event.getTo().getY() && backend.checkNoFall(player, y))
|
||||
{
|
||||
event.setTo(from);
|
||||
log("tried avoid fall damage.",player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012 H31IX http://h31ix.net
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.h31ix.anticheat.event;
|
||||
|
||||
import net.h31ix.anticheat.manage.Backend;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.vehicle.VehicleEnterEvent;
|
||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||
|
||||
public class VehicleListener extends EventListener
|
||||
{
|
||||
private final Backend backend = getBackend();
|
||||
|
||||
@EventHandler
|
||||
public void onVehicleEnter(VehicleEnterEvent event)
|
||||
{
|
||||
if(event.getEntered() instanceof Player)
|
||||
{
|
||||
backend.logEnteredVehicle((Player)event.getEntered());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onVehicleExit(VehicleExitEvent event)
|
||||
{
|
||||
if(event.getExited() instanceof Player)
|
||||
{
|
||||
backend.logEnteredVehicle((Player)event.getExited());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012 H31IX http://h31ix.net
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.h31ix.anticheat.manage;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import net.h31ix.anticheat.Configuration;
|
||||
import net.h31ix.anticheat.xray.XRayTracker;
|
||||
|
||||
public final class AnticheatManager
|
||||
{
|
||||
private AnticheatManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static final Configuration CONFIGURATION = new Configuration();
|
||||
public static final XRayTracker XRAY_TRACKER = new XRayTracker();
|
||||
public static final PlayerManager PLAYER_MANAGER = new PlayerManager();
|
||||
public static final CheckManager CHECK_MANAGER = new CheckManager();
|
||||
public static final Backend BACKEND = new Backend();
|
||||
private static final Logger ANTICHEAT_LOGGER = Logger.getLogger("Minecraft");
|
||||
|
||||
public static void log(String message)
|
||||
{
|
||||
ANTICHEAT_LOGGER.log(Level.WARNING,"[AC] ".concat(message));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,442 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012 H31IX http://h31ix.net
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.h31ix.anticheat.manage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.h31ix.anticheat.Anticheat;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||
|
||||
public class Backend
|
||||
{
|
||||
public static final int ENTERED_VEHICLE_TIME = 20;
|
||||
public static final int DROPPED_ITEM_TIME = 2;
|
||||
public static final int DAMAGE_TIME = 50;
|
||||
public static final int KNOCKBACK_DAMAGE_TIME = 50;
|
||||
|
||||
private static final int CHAT_WARN_LEVEL = 7;
|
||||
private static final int CHAT_KICK_LEVEL = 10;
|
||||
private static final int CHAT_BAN_LEVEL = 3;
|
||||
|
||||
public static final int FLIGHT_LIMIT = 4;
|
||||
public static final int NOFALL_LIMIT = 5;
|
||||
|
||||
public static final int SPRINT_FOOD_MIN = 6;
|
||||
public static final int EAT_MIN = 60;
|
||||
public static final int HEAL_MIN = 35;
|
||||
public static final int ANIMATION_MIN = 60;
|
||||
public static final int CHAT_MIN = 100;
|
||||
public static final int BOW_MIN = 2;
|
||||
public static final int SPRINT_MIN = 2;
|
||||
public static final int BLOCK_BREAK_MIN = 2;
|
||||
public static final long BLOCK_PLACE_MIN = 1/2;
|
||||
|
||||
public static final double BLOCK_MAX_DISTANCE = 6.0;
|
||||
public static final double ENTITY_MAX_DISTANCE = 5.5;
|
||||
|
||||
public static final double LADDER_Y_MAX = 0.11761;
|
||||
public static final double LADDER_Y_MIN = 0.11759;
|
||||
|
||||
public static final double Y_SPEED_MAX = 0.5;
|
||||
public static final double XZ_SPEED_MAX = 0.4;
|
||||
public static final double XZ_SPEED_MAX_SPRINT = 0.7;
|
||||
public static final double XZ_SPEED_MAX_SNEAK = 0.2;
|
||||
public static final double XZ_SPEED_MAX_WATER = 0.19;
|
||||
public static final double XZ_SPEED_MAX_WATER_SPRINT = 0.3;
|
||||
|
||||
private Anticheat plugin = Anticheat.getPlugin();
|
||||
private List<String> droppedItem = new ArrayList<String>();
|
||||
private List<String> animated = new ArrayList<String>();
|
||||
private List<String> movingExempt = new ArrayList<String>();
|
||||
private List<String> brokenBlock = new ArrayList<String>();
|
||||
private List<String> placedBlock = new ArrayList<String>();
|
||||
private List<String> bowWindUp = new ArrayList<String>();
|
||||
private List<String> startEat = new ArrayList<String>();
|
||||
private List<String> healed = new ArrayList<String>();
|
||||
private List<String> sprinted = new ArrayList<String>();
|
||||
private Map<String,Integer> flightViolation = new HashMap<String,Integer>();
|
||||
private Map<String,Integer> chatLevel = new HashMap<String,Integer>();
|
||||
private Map<String,Integer> chatKicks = new HashMap<String,Integer>();
|
||||
private Map<String,Integer> nofallViolation = new HashMap<String,Integer>();
|
||||
|
||||
public boolean checkLongReachBlock(double x,double y,double z)
|
||||
{
|
||||
return x >= BLOCK_MAX_DISTANCE || y > BLOCK_MAX_DISTANCE || z > BLOCK_MAX_DISTANCE;
|
||||
}
|
||||
|
||||
public boolean checkLongReachDamage(double x,double y,double z)
|
||||
{
|
||||
return x >= ENTITY_MAX_DISTANCE || y > ENTITY_MAX_DISTANCE || z > ENTITY_MAX_DISTANCE;
|
||||
}
|
||||
|
||||
public boolean checkSpider(Player player,double y)
|
||||
{
|
||||
if(y <= LADDER_Y_MAX && y >= LADDER_Y_MIN && player.getLocation().getBlock().getType() != Material.VINE && player.getLocation().getBlock().getType() != Material.LADDER)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean checkYSpeed(Player player,double y)
|
||||
{
|
||||
if(!player.isFlying() && player.getVehicle() == null && y > Y_SPEED_MAX)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean checkNoFall(Player player, double y)
|
||||
{
|
||||
String name = player.getName();
|
||||
if(player.getGameMode() != GameMode.CREATIVE && player.getVehicle() == null && !isMovingExempt(player))
|
||||
{
|
||||
if(player.getFallDistance() == 0)
|
||||
{
|
||||
if(nofallViolation.get(name) == null)
|
||||
{
|
||||
nofallViolation.put(name,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
nofallViolation.put(name,nofallViolation.get(player.getName())+1);
|
||||
}
|
||||
|
||||
if(nofallViolation.get(name) >= NOFALL_LIMIT)
|
||||
{
|
||||
nofallViolation.put(player.getName(),1);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nofallViolation.put(name,0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean checkXZSpeed(Player player,double x,double z)
|
||||
{
|
||||
if(!isMovingExempt(player) && player.getVehicle() == null)
|
||||
{
|
||||
if(!player.isSprinting())
|
||||
{
|
||||
return x > XZ_SPEED_MAX || z > XZ_SPEED_MAX;
|
||||
}
|
||||
else
|
||||
{
|
||||
return x > XZ_SPEED_MAX_SPRINT || z > XZ_SPEED_MAX_SPRINT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkSneak(Player player,double x,double z)
|
||||
{
|
||||
if(player.isSneaking())
|
||||
{
|
||||
return x > XZ_SPEED_MAX_SNEAK || z > XZ_SPEED_MAX_SNEAK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkSprint(PlayerToggleSprintEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
if(event.isSprinting())
|
||||
{
|
||||
return player.getFoodLevel() <= SPRINT_FOOD_MIN && player.getGameMode() != GameMode.CREATIVE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkWaterWalk(Player player, double x, double z)
|
||||
{
|
||||
if(player.getLocation().getBlock().isLiquid() && player.getVehicle() == null)
|
||||
{
|
||||
if(x > XZ_SPEED_MAX_WATER || z > XZ_SPEED_MAX_WATER && !Utilities.sprintFly(player) && player.getNearbyEntities(1, 1, 1).isEmpty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(x > XZ_SPEED_MAX_WATER_SPRINT || z > XZ_SPEED_MAX_WATER_SPRINT)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean checkFlight(Player player, double y1, double y2)
|
||||
{
|
||||
if(y1 == y2 && !isMovingExempt(player) && player.getVehicle() == null && player.getFallDistance() == 0)
|
||||
{
|
||||
String name = player.getName();
|
||||
Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
|
||||
if(Utilities.cantStandAt(block))
|
||||
{
|
||||
int violation = 1;
|
||||
if(!flightViolation.containsKey(name))
|
||||
{
|
||||
flightViolation.put(name, violation);
|
||||
}
|
||||
else
|
||||
{
|
||||
violation = flightViolation.get(name)+1;
|
||||
flightViolation.put(name, violation);
|
||||
}
|
||||
if(violation >= FLIGHT_LIMIT)
|
||||
{
|
||||
flightViolation.put(name, 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean checkSwing(Player player)
|
||||
{
|
||||
return !justAnimated(player);
|
||||
}
|
||||
|
||||
public boolean checkFastBreak(Player player, Block block)
|
||||
{
|
||||
if(player.getGameMode() != GameMode.CREATIVE && !player.getInventory().getItemInHand().containsEnchantment(Enchantment.DIG_SPEED) && !Utilities.isInstantBreak(block.getType()))
|
||||
{
|
||||
if (!justBroke(player))
|
||||
{
|
||||
logBlockBreak(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void logBowWindUp(Player player)
|
||||
{
|
||||
logEvent(bowWindUp,player,BOW_MIN);
|
||||
}
|
||||
|
||||
public boolean justWoundUp(Player player)
|
||||
{
|
||||
return bowWindUp.contains(player.getName());
|
||||
}
|
||||
|
||||
public void logEatingStart(Player player)
|
||||
{
|
||||
logEvent(startEat,player,EAT_MIN);
|
||||
}
|
||||
|
||||
public boolean justStartedEating(Player player)
|
||||
{
|
||||
return startEat.contains(player.getName());
|
||||
}
|
||||
|
||||
public void logHeal(Player player)
|
||||
{
|
||||
logEvent(healed,player,HEAL_MIN);
|
||||
}
|
||||
|
||||
public boolean justHealed(Player player)
|
||||
{
|
||||
return healed.contains(player.getName());
|
||||
}
|
||||
|
||||
public void logChat(Player player)
|
||||
{
|
||||
String name = player.getName();
|
||||
if(chatLevel.get(name) == null)
|
||||
{
|
||||
logEvent(chatLevel,player,1,CHAT_MIN);
|
||||
}
|
||||
else
|
||||
{
|
||||
int amount = chatLevel.get(name)+1;
|
||||
chatLevel.put(name, amount);
|
||||
checkChatLevel(player, amount);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearChatLevel(Player player)
|
||||
{
|
||||
chatLevel.remove(player.getName());
|
||||
}
|
||||
|
||||
public void logSprint(final Player player)
|
||||
{
|
||||
logEvent(sprinted,player,SPRINT_MIN);
|
||||
}
|
||||
|
||||
public boolean justSprinted(Player player)
|
||||
{
|
||||
return sprinted.contains(player.getName());
|
||||
}
|
||||
|
||||
public void logBlockBreak(final Player player)
|
||||
{
|
||||
logEvent(brokenBlock,player,BLOCK_BREAK_MIN);
|
||||
}
|
||||
|
||||
public boolean justBroke(Player player)
|
||||
{
|
||||
return brokenBlock.contains(player.getName());
|
||||
}
|
||||
|
||||
public void logBlockPlace(final Player player)
|
||||
{
|
||||
logEvent(placedBlock,player,BLOCK_PLACE_MIN);
|
||||
}
|
||||
|
||||
public boolean justPlaced(Player player)
|
||||
{
|
||||
return placedBlock.contains(player.getName());
|
||||
}
|
||||
|
||||
public void logAnimation(final Player player)
|
||||
{
|
||||
logEvent(animated,player,ANIMATION_MIN);
|
||||
}
|
||||
|
||||
public void resetAnimation(final Player player)
|
||||
{
|
||||
animated.remove(player.getName());
|
||||
}
|
||||
|
||||
public boolean justAnimated(Player player)
|
||||
{
|
||||
return animated.contains(player.getName());
|
||||
}
|
||||
|
||||
public void logDamage(final Player player)
|
||||
{
|
||||
int time = DAMAGE_TIME;
|
||||
if(player.getInventory().getItemInHand().getEnchantments().containsKey(Enchantment.KNOCKBACK))
|
||||
{
|
||||
time = KNOCKBACK_DAMAGE_TIME;
|
||||
}
|
||||
logEvent(movingExempt,player,time);
|
||||
}
|
||||
|
||||
public void logEnteredVehicle(final Player player)
|
||||
{
|
||||
logEvent(movingExempt,player,ENTERED_VEHICLE_TIME);
|
||||
}
|
||||
|
||||
public boolean isMovingExempt(Player player)
|
||||
{
|
||||
return movingExempt.contains(player.getName()) || player.isFlying();
|
||||
}
|
||||
|
||||
public void logDroppedItem(final Player player)
|
||||
{
|
||||
logEvent(droppedItem,player,DROPPED_ITEM_TIME);
|
||||
}
|
||||
|
||||
public boolean justDroppedItem(Player player)
|
||||
{
|
||||
return droppedItem.contains(player.getName());
|
||||
}
|
||||
|
||||
private void logEvent(final List list, final Player player, long time)
|
||||
{
|
||||
list.add(player.getName());
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
list.remove(player.getName());
|
||||
}
|
||||
}, time);
|
||||
}
|
||||
private void logEvent(final Map map, final Player player, final Object obj, long time)
|
||||
{
|
||||
map.put(player,obj);
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
map.remove(player);
|
||||
}
|
||||
}, time);
|
||||
}
|
||||
private void checkChatLevel(Player player, int amount)
|
||||
{
|
||||
if(amount >= CHAT_WARN_LEVEL)
|
||||
{
|
||||
player.sendMessage(ChatColor.RED+"Please stop flooding the server!");
|
||||
}
|
||||
if (amount >= CHAT_KICK_LEVEL)
|
||||
{
|
||||
String name = player.getName();
|
||||
int kick = 0;
|
||||
if(chatKicks.get(name) == null || chatKicks.get(name) == 0)
|
||||
{
|
||||
kick = 1;
|
||||
chatKicks.put(name, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
kick = (int)chatKicks.get(name)+1;
|
||||
chatKicks.put(name, kick);
|
||||
}
|
||||
|
||||
if(chatKicks.get(name) <= CHAT_BAN_LEVEL)
|
||||
{
|
||||
player.kickPlayer(ChatColor.RED+"Spamming, kick "+kick+"/3");
|
||||
plugin.getServer().broadcastMessage(ChatColor.RED+player.getName()+" was kicked for spamming.");
|
||||
}
|
||||
else
|
||||
{
|
||||
player.kickPlayer(ChatColor.RED+"Banned for spamming.");
|
||||
player.setBanned(true);
|
||||
plugin.getServer().broadcastMessage(ChatColor.RED+player.getName()+" was banned for spamming.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012 H31IX http://h31ix.net
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.h31ix.anticheat.manage;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The manager that AntiCheat will check with to see if it should watch certain checks and certain players.
|
||||
*/
|
||||
|
||||
public class CheckManager
|
||||
{
|
||||
private static List<CheckType> checkIgnoreList = new ArrayList<CheckType>();
|
||||
private static Multimap<Player,CheckType> exemptList = ArrayListMultimap.create();
|
||||
|
||||
/**
|
||||
* Start running a certain check
|
||||
*
|
||||
* @param type Check to start watching for
|
||||
*/
|
||||
public void activateCheck(CheckType type)
|
||||
{
|
||||
AnticheatManager.log("The "+type.toString()+" check was activated.");
|
||||
checkIgnoreList.remove(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop running a certain check
|
||||
*
|
||||
* @param type Check to stop watching for
|
||||
*/
|
||||
public void deactivateCheck(CheckType type)
|
||||
{
|
||||
AnticheatManager.log("The "+type.toString()+" check was deactivated.");
|
||||
checkIgnoreList.add(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find out if a check is currently being watched for
|
||||
*
|
||||
* @param type Type to check
|
||||
* @return true if plugin is watching for this check
|
||||
*/
|
||||
public boolean isActive(CheckType type)
|
||||
{
|
||||
return !checkIgnoreList.contains(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow a player to skip a certain check
|
||||
*
|
||||
* @param player Player to stop watching
|
||||
* @param type Check to stop watching for
|
||||
*/
|
||||
public void exemptPlayer(Player player, CheckType type)
|
||||
{
|
||||
AnticheatManager.log(player.getName()+" was exempted from the "+type.toString()+" check.");
|
||||
exemptList.put(player,type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop allowing a player to skip a certain check
|
||||
*
|
||||
* @param player Player to start watching
|
||||
* @param type Check to start watching for
|
||||
*/
|
||||
public void unexemptPlayer(Player player, CheckType type)
|
||||
{
|
||||
AnticheatManager.log(player.getName()+" was re-added to the "+type.toString()+" check.");
|
||||
exemptList.remove(type, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find out if a player is currently exempt from a certain check
|
||||
*
|
||||
* @param player Player to check
|
||||
* @param type Type to check
|
||||
* @return true if plugin is ignoring this check on this player
|
||||
*/
|
||||
public boolean isExempt(Player player, CheckType type)
|
||||
{
|
||||
return exemptList.containsEntry(player, type);
|
||||
}
|
||||
|
||||
private boolean hasPermission(Player player, String permission)
|
||||
{
|
||||
return player.hasPermission(permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find out if a check will occur for a player. This checks if they are being tracked, the check is active, the player isn't exempt from the check, and the player doesn't have override permission.
|
||||
*
|
||||
* @param player Player to check
|
||||
* @param type Type to check
|
||||
* @return true if plugin will check this player, and that all things allow it to happen.
|
||||
*/
|
||||
public boolean willCheck(Player player, CheckType type)
|
||||
{
|
||||
return isActive(type)
|
||||
&& AnticheatManager.CONFIGURATION.checkInWorld(player.getWorld())
|
||||
&& !isExempt(player, type)
|
||||
&& !hasPermission(player, type.getPermission());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012 H31IX http://h31ix.net
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.h31ix.anticheat.manage;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* All the types of checks and their corresponding permission nodes.
|
||||
*/
|
||||
|
||||
|
||||
public enum CheckType
|
||||
{
|
||||
ZOMBE_FLY("anticheat.zombe.fly"),
|
||||
ZOMBE_NOCLIP("anticheat.zombe.noclip"),
|
||||
ZOMBE_CHEAT("anticheat.zombe.cheat"),
|
||||
FLY("anticheat.fly"),
|
||||
WATER_WALK("anticheat.waterwalk"),
|
||||
NO_SWING("anticheat.noswing"),
|
||||
FAST_BREAK("anticheat.fastbreak"),
|
||||
SPAM("anticheat.spam"),
|
||||
SPRINT("anticheat.sprint"),
|
||||
SNEAK("anticheat.sneak"),
|
||||
SPEED("anticheat.speed"),
|
||||
SPIDER("anticheat.spider"),
|
||||
NOFALL("anticheat.spider"),
|
||||
FAST_BOW("anticheat.fastbow"),
|
||||
FAST_EAT("anticheat.fasteat"),
|
||||
FAST_HEAL("anticheat.fastheal"),
|
||||
FORCEFIELD("anticheat.forcefield"),
|
||||
XRAY("anticheat.xray"),
|
||||
LONG_REACH("anticheat.longreach"),
|
||||
ITEM_SPAM("anticheat.itemspam");
|
||||
|
||||
private final String permission;
|
||||
private static final Map<String,CheckType> NAMES = Maps.newHashMap();
|
||||
|
||||
private CheckType(String permission)
|
||||
{
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
public String getPermission()
|
||||
{
|
||||
return this.permission;
|
||||
}
|
||||
|
||||
public CheckType byName(String name)
|
||||
{
|
||||
return NAMES.get(name);
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
for (CheckType type : values())
|
||||
{
|
||||
NAMES.put(type.toString(), type);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012 H31IX http://h31ix.net
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.h31ix.anticheat.manage;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
public class Distance
|
||||
{
|
||||
private final Location l1,l2;
|
||||
|
||||
public Distance(Location from, Location to)
|
||||
{
|
||||
l1 = to;
|
||||
l2 = from;
|
||||
}
|
||||
|
||||
public double getXDifference()
|
||||
{
|
||||
return Math.abs(l1.getX()-l2.getX());
|
||||
}
|
||||
|
||||
public double getZDifference()
|
||||
{
|
||||
return Math.abs(l1.getZ()-l2.getZ());
|
||||
}
|
||||
|
||||
public double getYDifference()
|
||||
{
|
||||
return Math.abs(l1.getY()-l2.getY());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012 H31IX http://h31ix.net
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.h31ix.anticheat.manage;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.h31ix.anticheat.Configuration;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PlayerManager {
|
||||
private Map<Player,Integer> level = new HashMap<Player,Integer>();
|
||||
private Configuration config = AnticheatManager.CONFIGURATION;
|
||||
private static final int MED_THRESHOLD = 20;
|
||||
private static final int HIGH_THRESHOLD = 50;
|
||||
|
||||
public void reactMedium(Player player)
|
||||
{
|
||||
execute("Medium",player);
|
||||
for(Player p : player.getServer().getOnlinePlayers())
|
||||
{
|
||||
if(p.hasPermission("anticheat.admin") || p.isOp())
|
||||
{
|
||||
p.sendMessage(ChatColor.YELLOW+"[ALERT] "+ChatColor.WHITE+player.getName()+ChatColor.YELLOW+" has entered the MEDIUM hack level.");
|
||||
p.sendMessage(ChatColor.YELLOW+"[ALERT] This means they may be using a hacked client or may have a bad connection!");
|
||||
}
|
||||
}
|
||||
}
|
||||
public void reactHigh(Player player)
|
||||
{
|
||||
execute("High",player);
|
||||
for(Player p : player.getServer().getOnlinePlayers())
|
||||
{
|
||||
if(p.hasPermission("anticheat.admin") || p.isOp())
|
||||
{
|
||||
p.sendMessage(ChatColor.RED+"[ALERT] "+ChatColor.WHITE+player.getName()+ChatColor.RED+" has entered the HIGH hack level.");
|
||||
p.sendMessage(ChatColor.RED+"[ALERT] This means they probably are hacking or are lagging out!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void increaseLevel(Player player)
|
||||
{
|
||||
if(level.get(player) == null || level.get(player) == 0)
|
||||
{
|
||||
level.put(player,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
int playerLevel = level.get(player);
|
||||
level.put(player, playerLevel+1);
|
||||
if(playerLevel <= MED_THRESHOLD && playerLevel+1 > MED_THRESHOLD && playerLevel+1 <= HIGH_THRESHOLD)
|
||||
{
|
||||
reactMedium(player);
|
||||
}
|
||||
else if(playerLevel <= HIGH_THRESHOLD && playerLevel+1 > HIGH_THRESHOLD)
|
||||
{
|
||||
reactHigh(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void decreaseLevel(Player player)
|
||||
{
|
||||
if(level.get(player) != null && level.get(player) != 0)
|
||||
{
|
||||
int playerLevel = level.get(player)-1;
|
||||
level.put(player, playerLevel);
|
||||
}
|
||||
}
|
||||
|
||||
public int getLevel(Player player)
|
||||
{
|
||||
if(level.get(player) != null)
|
||||
{
|
||||
return level.get(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void reset(Player player)
|
||||
{
|
||||
level.put(player,0);
|
||||
}
|
||||
|
||||
public void execute(String level, Player player)
|
||||
{
|
||||
String result = config.getResult(level);
|
||||
if(result.startsWith("COMMAND["))
|
||||
{
|
||||
String command = result.replaceAll("COMMAND\\[", "").replaceAll("]", "").replaceAll("&player", player.getName());
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), command);
|
||||
}
|
||||
else if(result.equalsIgnoreCase("KICK"))
|
||||
{
|
||||
player.kickPlayer(ChatColor.RED+"Kicked by AntiCheat");
|
||||
player.getServer().broadcastMessage(ChatColor.RED+"[AntiCheat] "+player.getName()+" was kicked for hacking.");
|
||||
}
|
||||
else if(result.equalsIgnoreCase("WARN"))
|
||||
{
|
||||
player.sendMessage(ChatColor.RED+"[AntiCheat] Hacks are not allowed on this server.");
|
||||
player.sendMessage(ChatColor.RED+"[AntiCheat] If you continue to use hacks, action will be taken.");
|
||||
}
|
||||
else if(result.equalsIgnoreCase("BAN"))
|
||||
{
|
||||
player.setBanned(true);
|
||||
player.kickPlayer(ChatColor.RED+"Banned by AntiCheat");
|
||||
player.getServer().broadcastMessage(ChatColor.RED+"[AntiCheat] "+player.getName()+" was banned for hacking.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012 H31IX http://h31ix.net
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.h31ix.anticheat.manage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public final class Utilities
|
||||
{
|
||||
private static final List<Material> INSTANT_BREAK = new ArrayList<Material>();
|
||||
private static final List<Material> FOOD = new ArrayList<Material>();
|
||||
|
||||
private Utilities()
|
||||
{
|
||||
INSTANT_BREAK.add(Material.RED_MUSHROOM);
|
||||
INSTANT_BREAK.add(Material.RED_ROSE);
|
||||
INSTANT_BREAK.add(Material.BROWN_MUSHROOM);
|
||||
INSTANT_BREAK.add(Material.YELLOW_FLOWER);
|
||||
INSTANT_BREAK.add(Material.REDSTONE);
|
||||
INSTANT_BREAK.add(Material.REDSTONE_TORCH_OFF);
|
||||
INSTANT_BREAK.add(Material.REDSTONE_TORCH_ON);
|
||||
INSTANT_BREAK.add(Material.REDSTONE_WIRE);
|
||||
INSTANT_BREAK.add(Material.GRASS);
|
||||
INSTANT_BREAK.add(Material.LONG_GRASS);
|
||||
INSTANT_BREAK.add(Material.PAINTING);
|
||||
INSTANT_BREAK.add(Material.WHEAT);
|
||||
INSTANT_BREAK.add(Material.SUGAR_CANE);
|
||||
INSTANT_BREAK.add(Material.SUGAR_CANE_BLOCK);
|
||||
INSTANT_BREAK.add(Material.DIODE);
|
||||
INSTANT_BREAK.add(Material.DIODE_BLOCK_OFF);
|
||||
INSTANT_BREAK.add(Material.DIODE_BLOCK_ON);
|
||||
INSTANT_BREAK.add(Material.SAPLING);
|
||||
INSTANT_BREAK.add(Material.TORCH);
|
||||
INSTANT_BREAK.add(Material.CROPS);
|
||||
INSTANT_BREAK.add(Material.SNOW);
|
||||
FOOD.add(Material.COOKED_BEEF);
|
||||
FOOD.add(Material.COOKED_CHICKEN);
|
||||
FOOD.add(Material.COOKED_FISH);
|
||||
FOOD.add(Material.GRILLED_PORK);
|
||||
FOOD.add(Material.PORK);
|
||||
FOOD.add(Material.MUSHROOM_SOUP);
|
||||
FOOD.add(Material.RAW_BEEF);
|
||||
FOOD.add(Material.RAW_CHICKEN);
|
||||
FOOD.add(Material.RAW_FISH);
|
||||
FOOD.add(Material.APPLE);
|
||||
FOOD.add(Material.GOLDEN_APPLE);
|
||||
FOOD.add(Material.MELON);
|
||||
FOOD.add(Material.COOKIE);
|
||||
FOOD.add(Material.SPIDER_EYE);
|
||||
FOOD.add(Material.ROTTEN_FLESH);
|
||||
}
|
||||
public static boolean cantStandAt(Block block)
|
||||
{
|
||||
return !canStand(block) && cantStandClose(block) && cantStandFar(block);
|
||||
}
|
||||
private static boolean cantStandClose(Block block)
|
||||
{
|
||||
return !canStand(block.getRelative(BlockFace.NORTH)) && !canStand(block.getRelative(BlockFace.EAST)) && !canStand(block.getRelative(BlockFace.SOUTH)) && !canStand(block.getRelative(BlockFace.WEST));
|
||||
}
|
||||
private static boolean cantStandFar(Block block)
|
||||
{
|
||||
return !canStand(block.getRelative(BlockFace.NORTH_WEST)) && !canStand(block.getRelative(BlockFace.NORTH_EAST)) && !canStand(block.getRelative(BlockFace.SOUTH_WEST)) && !canStand(block.getRelative(BlockFace.SOUTH_EAST));
|
||||
}
|
||||
public static boolean canStand(Block block)
|
||||
{
|
||||
return !block.isLiquid() || block.getType() == Material.AIR;
|
||||
}
|
||||
public static boolean isInstantBreak(Material m)
|
||||
{
|
||||
return INSTANT_BREAK.contains(m);
|
||||
}
|
||||
public static boolean isFood(Material m)
|
||||
{
|
||||
return FOOD.contains(m);
|
||||
}
|
||||
public static boolean sprintFly(Player player)
|
||||
{
|
||||
return player.isSprinting() || player.isFlying();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012 H31IX http://h31ix.net
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.h31ix.anticheat.xray;
|
||||
|
||||
import net.h31ix.anticheat.Configuration;
|
||||
import net.h31ix.anticheat.manage.AnticheatManager;
|
||||
import net.h31ix.anticheat.manage.CheckManager;
|
||||
import net.h31ix.anticheat.manage.CheckType;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
|
||||
public class XRayListener implements Listener {
|
||||
private XRayTracker tracker = AnticheatManager.XRAY_TRACKER;
|
||||
private Configuration config = AnticheatManager.CONFIGURATION;
|
||||
private CheckManager checkManager = AnticheatManager.CHECK_MANAGER;
|
||||
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent event)
|
||||
{
|
||||
if(config.logXRay())
|
||||
{
|
||||
Player p = event.getPlayer();
|
||||
String player = p.getName();
|
||||
if(checkManager.willCheck(p, CheckType.XRAY))
|
||||
{
|
||||
Material m = event.getBlock().getType();
|
||||
if(m == Material.DIAMOND_ORE)
|
||||
{
|
||||
tracker.addDiamond(player);
|
||||
}
|
||||
else if(m == Material.IRON_ORE)
|
||||
{
|
||||
tracker.addIron(player);
|
||||
}
|
||||
else if(m == Material.COAL_ORE)
|
||||
{
|
||||
tracker.addCoal(player);
|
||||
}
|
||||
else if(m == Material.GOLD_ORE)
|
||||
{
|
||||
tracker.addGold(player);
|
||||
}
|
||||
else if(m == Material.LAPIS_ORE)
|
||||
{
|
||||
tracker.addLapis(player);
|
||||
}
|
||||
else if(m == Material.REDSTONE_ORE)
|
||||
{
|
||||
tracker.addRedstone(player);
|
||||
}
|
||||
else if(m == Material.GOLD_ORE)
|
||||
{
|
||||
tracker.addGold(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
tracker.addBlock(player);
|
||||
}
|
||||
tracker.addTotal(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012 H31IX http://h31ix.net
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.h31ix.anticheat.xray;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class XRayTracker {
|
||||
private Map<String,Integer> diamond = new HashMap<String,Integer>();
|
||||
private Map<String,Integer> gold = new HashMap<String,Integer>();
|
||||
private Map<String,Integer> iron = new HashMap<String,Integer>();
|
||||
private Map<String,Integer> coal = new HashMap<String,Integer>();
|
||||
private Map<String,Integer> lapis = new HashMap<String,Integer>();
|
||||
private Map<String,Integer> redstone = new HashMap<String,Integer>();
|
||||
private Map<String,Integer> block = new HashMap<String,Integer>();
|
||||
private Map<String,Integer> totalblock = new HashMap<String,Integer>();
|
||||
private static final ChatColor GREEN = ChatColor.GREEN;
|
||||
private static final ChatColor WHITE = ChatColor.WHITE;
|
||||
private static final ChatColor RED = ChatColor.RED;
|
||||
private static final ChatColor GRAY = ChatColor.GRAY;
|
||||
private static final int DIVISOR = 100;
|
||||
private static final int RATIO_DIVISOR = 3;
|
||||
private static final int POWER = 10;
|
||||
private static final int MIN_BLOCK_COUNT = 100;
|
||||
|
||||
public XRayTracker()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public boolean sufficientData(String player)
|
||||
{
|
||||
return totalblock.get(player) != null && totalblock.get(player) >= MIN_BLOCK_COUNT;
|
||||
}
|
||||
|
||||
public void calculate(CommandSender cs, String player, double x, double b, String type)
|
||||
{
|
||||
ChatColor color = WHITE;
|
||||
if(x >= b/RATIO_DIVISOR)
|
||||
{
|
||||
color = RED;
|
||||
}
|
||||
cs.sendMessage(GRAY+"Percent "+type+" ore: "+color+round(x)+"%");
|
||||
}
|
||||
public void sendMessage(CommandSender cs, String player, double t, double d, double g, double i, double c, double la, double r, double b)
|
||||
{
|
||||
cs.sendMessage("--------------------["+GREEN+"X-Ray Stats"+WHITE+"]---------------------");
|
||||
cs.sendMessage(GRAY+"Player: "+WHITE+player);
|
||||
cs.sendMessage(GRAY+"Total blocks broken: "+WHITE+t);
|
||||
calculate(cs,player,d,b,"diamond");
|
||||
calculate(cs,player,g,b,"gold");
|
||||
calculate(cs,player,i,b,"iron");
|
||||
calculate(cs,player,c,b,"coal");
|
||||
calculate(cs,player,la,b,"lapis");
|
||||
calculate(cs,player,r,b,"redstone");
|
||||
cs.sendMessage(GRAY+"Percent all other blocks: "+WHITE+round(b)+"%");
|
||||
cs.sendMessage("-----------------------------------------------------");
|
||||
}
|
||||
|
||||
public void sendStats(CommandSender cs, String player)
|
||||
{
|
||||
getStats(cs,player);
|
||||
}
|
||||
|
||||
public void getStats(CommandSender cs, String player)
|
||||
{
|
||||
double t = 1;
|
||||
double d = 0;
|
||||
double g = 0;
|
||||
double i = 0;
|
||||
double c = 0;
|
||||
double la = 0;
|
||||
double r = 0;
|
||||
double b = 0;
|
||||
if(totalblock.get(player) != null)
|
||||
{
|
||||
t = totalblock.get(player);
|
||||
}
|
||||
if(diamond.get(player) != null)
|
||||
{
|
||||
d = (diamond.get(player)/t)*DIVISOR;
|
||||
}
|
||||
if(gold.get(player) != null)
|
||||
{
|
||||
g = (gold.get(player)/t)*DIVISOR;
|
||||
}
|
||||
if(iron.get(player) != null)
|
||||
{
|
||||
i = (iron.get(player)/t)*DIVISOR;
|
||||
}
|
||||
if(coal.get(player) != null)
|
||||
{
|
||||
c = (coal.get(player)/t)*DIVISOR;
|
||||
}
|
||||
if(lapis.get(player) != null)
|
||||
{
|
||||
la = (lapis.get(player)/t)*DIVISOR;
|
||||
}
|
||||
if(redstone.get(player) != null)
|
||||
{
|
||||
r = (redstone.get(player)/t)*DIVISOR;
|
||||
}
|
||||
if(block.get(player) != null)
|
||||
{
|
||||
b = (block.get(player)/t)*DIVISOR;
|
||||
}
|
||||
sendMessage(cs,player,t,d,g,i,c,la,r,b);
|
||||
}
|
||||
|
||||
public void addDiamond(String player)
|
||||
{
|
||||
addOre(player,diamond);
|
||||
}
|
||||
|
||||
public void addGold(String player)
|
||||
{
|
||||
addOre(player,gold);
|
||||
}
|
||||
|
||||
public void addCoal(String player)
|
||||
{
|
||||
addOre(player,coal);
|
||||
}
|
||||
|
||||
public void addIron(String player)
|
||||
{
|
||||
addOre(player,iron);
|
||||
}
|
||||
|
||||
public void addLapis(String player)
|
||||
{
|
||||
addOre(player,lapis);
|
||||
}
|
||||
|
||||
public void addRedstone(String player)
|
||||
{
|
||||
addOre(player,redstone);
|
||||
}
|
||||
|
||||
public void addBlock(String player)
|
||||
{
|
||||
addOre(player,block);
|
||||
}
|
||||
|
||||
public void addTotal(String player)
|
||||
{
|
||||
addOre(player,totalblock);
|
||||
}
|
||||
|
||||
private void addOre(String player, Map<String,Integer> map)
|
||||
{
|
||||
if(map.get(player) == null || map.get(player) == 0)
|
||||
{
|
||||
map.put(player,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
int playerLevel = map.get(player);
|
||||
map.put(player, playerLevel+1);
|
||||
}
|
||||
}
|
||||
|
||||
private float round(double num)
|
||||
{
|
||||
double number = num;
|
||||
float p = (float)Math.pow(POWER,1);
|
||||
number*=p;
|
||||
float tmp = Math.round(number);
|
||||
return (float)tmp/p;
|
||||
}
|
||||
|
||||
public void reset(String player)
|
||||
{
|
||||
totalblock.put(player,1);
|
||||
diamond.put(player,0);
|
||||
iron.put(player,0);
|
||||
gold.put(player,0);
|
||||
coal.put(player,0);
|
||||
redstone.put(player,0);
|
||||
lapis.put(player,0);
|
||||
totalblock.put(player,0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#AntiCheat configuration file
|
||||
#Please report any bugs: http://dev.bukkit.org/server-mods/anticheat/
|
||||
XRay:
|
||||
Log xray stats: true
|
||||
|
||||
Events:
|
||||
#Valid events = NONE,WARN,KICK,BAN,COMMAND[command]
|
||||
#Use commands like so: COMMAND[ban &player 30] or COMMAND[kick &player hacking] or COMMAND[jail &player 10]
|
||||
#&player will be replaced with player's name, and any command on your server can be used.
|
||||
Level Medium: WARN
|
||||
Level High: KICK
|
||||
|
||||
System:
|
||||
#Turning auto-update off is a _BAD_ idea. You will no longer be protected by the latest hacks/cheats if you do so.
|
||||
#AntiCheat will never bother you about updates if this is on, but if you turn it off you will have to manuall update.
|
||||
Auto update: true
|
||||
Log to console: false
|
||||
@@ -0,0 +1,13 @@
|
||||
author: H31IX
|
||||
database: false
|
||||
description: Prevention of hacks and other malicious tinkering on a Minecraft server.
|
||||
main: net.h31ix.anticheat.Anticheat
|
||||
name: AntiCheat
|
||||
softdepend: [AntiCheat]
|
||||
startup: postworld
|
||||
url: http://H31IX.NET/
|
||||
version: '1.0'
|
||||
commands:
|
||||
anticheat:
|
||||
description: Control and view info about AntiCheat
|
||||
usage: /anticheat help
|
||||
Reference in new issue
Block a user