mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 06:28:52 +00:00
Compare commits
108
Commits
1.9.0-PRE1
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d5b357c36 | ||
|
|
ffb7ea1ad4 | ||
|
|
c3fffbd68a | ||
|
|
3a48e8c602 | ||
|
|
031e7b145b | ||
|
|
5c85b8717b | ||
|
|
67e6f0df62 | ||
|
|
83d9705886 | ||
|
|
7842153e60 | ||
|
|
edf1d1c234 | ||
|
|
9bbb02a3a6 | ||
|
|
a3483dfc9b | ||
|
|
14ee2ebba0 | ||
|
|
279efba090 | ||
|
|
2d827e951c | ||
|
|
38e6a5a99c | ||
|
|
6aaaf883e5 | ||
|
|
f123e397b6 | ||
|
|
b27ffc9842 | ||
|
|
40985ac7d6 | ||
|
|
6fabd73432 | ||
|
|
64788fb1a0 | ||
|
|
5b33eb5b9d | ||
|
|
e71707a84c | ||
|
|
15ba2a09b0 | ||
|
|
c39d224ce9 | ||
|
|
f32efaedee | ||
|
|
9d97803d5c | ||
|
|
92b5a6e52b | ||
|
|
db642bfad7 | ||
|
|
ebfd8f69af | ||
|
|
84ddce8f1e | ||
|
|
de73349b7a | ||
|
|
ac170f5dde | ||
|
|
6af50e5a33 | ||
|
|
5c596f5e2f | ||
|
|
058cf788fd | ||
|
|
75f350f174 | ||
|
|
a7b8164828 | ||
|
|
78ae04a2a8 | ||
|
|
e2d0fbda18 | ||
|
|
9550cc1d09 | ||
|
|
5f1dc37679 | ||
|
|
a1f7a0cf7f | ||
|
|
71a9c9a9c7 | ||
|
|
0438c36cce | ||
|
|
a3ae0ab967 | ||
|
|
79e913c46c | ||
|
|
ed127276f0 | ||
|
|
7739eb9ca0 | ||
|
|
f637facbea | ||
|
|
33bc8bb7fa | ||
|
|
45712a8f62 | ||
|
|
0d50bc3b52 | ||
|
|
caffebe09d | ||
|
|
1b2afa5d0e | ||
|
|
366f25d433 | ||
|
|
6f5cd70ba3 | ||
|
|
7f9d3c1396 | ||
|
|
e5c8c5dc8a | ||
|
|
15c61fac67 | ||
|
|
7e1f0d83ce | ||
|
|
bd1db83a98 | ||
|
|
646e906ada | ||
|
|
9473781a26 | ||
|
|
6497891e43 | ||
|
|
0dc3a8053d | ||
|
|
1b5f2dcaa1 | ||
|
|
b232026644 | ||
|
|
0c91ec7ba4 | ||
|
|
abff433510 | ||
|
|
fad298086c | ||
|
|
8b413a382a | ||
|
|
1428b55591 | ||
|
|
a84b573fa8 | ||
|
|
9211003d6d | ||
|
|
01df416236 | ||
|
|
619c8efae1 | ||
|
|
ab2fcc5521 | ||
|
|
8843725ede | ||
|
|
0d9b8707dd | ||
|
|
6e2eae7d1e | ||
|
|
ef5b4069ce | ||
|
|
3b9b39c49a | ||
|
|
09c42905d0 | ||
|
|
8de7ae1c59 | ||
|
|
768331011e | ||
|
|
1f48785d1d | ||
|
|
7cd90cfb61 | ||
|
|
5f181c556e | ||
|
|
16c778c17f | ||
|
|
97534e5df0 | ||
|
|
e770d0e01c | ||
|
|
a59a4baf28 | ||
|
|
7caf7376ba | ||
|
|
a6a39e352a | ||
|
|
700c0145f3 | ||
|
|
c74fc92da9 | ||
|
|
3bc49141fc | ||
|
|
cffd6d07ae | ||
|
|
e9a99f0463 | ||
|
|
4deb8ae0fb | ||
|
|
07f957cf35 | ||
|
|
9850f48a4e | ||
|
|
656841b046 | ||
|
|
fc006c39f2 | ||
|
|
f4ca2ea8bf | ||
|
|
6966582e4c |
No files matched your search
@@ -0,0 +1,12 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: [Rammelkast]
|
||||||
|
patreon: # Replace with a single Patreon username
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: # Replace with a single Liberapay username
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
otechie: # Replace with a single Otechie username
|
||||||
|
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
name: Maven Package
|
||||||
|
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Set up JDK 1.8
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 1.8
|
||||||
|
|
||||||
|
- name: Build with Maven
|
||||||
|
run: mvn -B package --file pom.xml
|
||||||
|
|
||||||
|
- name: Upload build artifacts
|
||||||
|
uses: actions/[email protected]
|
||||||
|
with:
|
||||||
|
path: target/AntiCheatReloaded.jar
|
||||||
@@ -1,165 +1,674 @@
|
|||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
This version of the GNU Lesser General Public License incorporates
|
The GNU General Public License is a free, copyleft license for
|
||||||
the terms and conditions of version 3 of the GNU General Public
|
software and other kinds of works.
|
||||||
License, supplemented by the additional permissions listed below.
|
|
||||||
|
|
||||||
0. Additional Definitions.
|
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.
|
||||||
|
|
||||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
When we speak of free software, we are referring to freedom, not
|
||||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
General Public License.
|
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.
|
||||||
|
|
||||||
"The Library" refers to a covered work governed by this License,
|
To protect your rights, we need to prevent others from denying you
|
||||||
other than an Application or a Combined Work as defined below.
|
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.
|
||||||
|
|
||||||
An "Application" is any work that makes use of an interface provided
|
For example, if you distribute copies of such a program, whether
|
||||||
by the Library, but which is not otherwise based on the Library.
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
Defining a subclass of a class defined by the Library is deemed a mode
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
of using an interface provided by the Library.
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
A "Combined Work" is a work produced by combining or linking an
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
Application with the Library. The particular version of the Library
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
with which the Combined Work was made is also called the "Linked
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
Version".
|
|
||||||
|
|
||||||
The "Minimal Corresponding Source" for a Combined Work means the
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
Corresponding Source for the Combined Work, excluding any source code
|
that there is no warranty for this free software. For both users' and
|
||||||
for portions of the Combined Work that, considered in isolation, are
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
based on the Application, and not on the Linked Version.
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
The "Corresponding Application Code" for a Combined Work means the
|
Some devices are designed to deny users access to install or run
|
||||||
object code and/or source code for the Application, including any data
|
modified versions of the software inside them, although the manufacturer
|
||||||
and utility programs needed for reproducing the Combined Work from the
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
Application, but excluding the System Libraries of the Combined Work.
|
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.
|
||||||
|
|
||||||
1. Exception to Section 3 of the GNU GPL.
|
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.
|
||||||
|
|
||||||
You may convey a covered work under sections 3 and 4 of this License
|
The precise terms and conditions for copying, distribution and
|
||||||
without being bound by section 3 of the GNU GPL.
|
modification follow.
|
||||||
|
|
||||||
2. Conveying Modified Versions.
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
If you modify a copy of the Library, and, in your modifications, a
|
0. Definitions.
|
||||||
facility refers to a function or data to be supplied by an Application
|
|
||||||
that uses the facility (other than as an argument passed when the
|
|
||||||
facility is invoked), then you may convey a copy of the modified
|
|
||||||
version:
|
|
||||||
|
|
||||||
a) under this License, provided that you make a good faith effort to
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
ensure that, in the event an Application does not supply the
|
|
||||||
function or data, the facility still operates, and performs
|
|
||||||
whatever part of its purpose remains meaningful, or
|
|
||||||
|
|
||||||
b) under the GNU GPL, with none of the additional permissions of
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
this License applicable to that copy.
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
3. Object Code Incorporating Material from Library Header Files.
|
"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.
|
||||||
|
|
||||||
The object code form of an Application may incorporate material from
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
a header file that is part of the Library. You may convey such object
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
code under terms of your choice, provided that, if the incorporated
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
material is not limited to numerical parameters, data structure
|
earlier work or a work "based on" the earlier work.
|
||||||
layouts and accessors, or small macros, inline functions and templates
|
|
||||||
(ten or fewer lines in length), you do both of the following:
|
|
||||||
|
|
||||||
a) Give prominent notice with each copy of the object code that the
|
A "covered work" means either the unmodified Program or a work based
|
||||||
Library is used in it and that the Library and its use are
|
on the Program.
|
||||||
covered by this License.
|
|
||||||
|
|
||||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
To "propagate" a work means to do anything with it that, without
|
||||||
document.
|
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.
|
||||||
|
|
||||||
4. Combined Works.
|
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.
|
||||||
|
|
||||||
You may convey a Combined Work under terms of your choice that,
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
taken together, effectively do not restrict modification of the
|
to the extent that it includes a convenient and prominently visible
|
||||||
portions of the Library contained in the Combined Work and reverse
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
engineering for debugging such modifications, if you also do each of
|
tells the user that there is no warranty for the work (except to the
|
||||||
the following:
|
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.
|
||||||
|
|
||||||
a) Give prominent notice with each copy of the Combined Work that
|
1. Source Code.
|
||||||
the Library is used in it and that the Library and its use are
|
|
||||||
covered by this License.
|
|
||||||
|
|
||||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
The "source code" for a work means the preferred form of the work
|
||||||
document.
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
c) For a Combined Work that displays copyright notices during
|
A "Standard Interface" means an interface that either is an official
|
||||||
execution, include the copyright notice for the Library among
|
standard defined by a recognized standards body, or, in the case of
|
||||||
these notices, as well as a reference directing the user to the
|
interfaces specified for a particular programming language, one that
|
||||||
copies of the GNU GPL and this license document.
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
d) Do one of the following:
|
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.
|
||||||
|
|
||||||
0) Convey the Minimal Corresponding Source under the terms of this
|
The "Corresponding Source" for a work in object code form means all
|
||||||
License, and the Corresponding Application Code in a form
|
the source code needed to generate, install, and (for an executable
|
||||||
suitable for, and under terms that permit, the user to
|
work) run the object code and to modify the work, including scripts to
|
||||||
recombine or relink the Application with a modified version of
|
control those activities. However, it does not include the work's
|
||||||
the Linked Version to produce a modified Combined Work, in the
|
System Libraries, or general-purpose tools or generally available free
|
||||||
manner specified by section 6 of the GNU GPL for conveying
|
programs which are used unmodified in performing those activities but
|
||||||
Corresponding Source.
|
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.
|
||||||
|
|
||||||
1) Use a suitable shared library mechanism for linking with the
|
The Corresponding Source need not include anything that users
|
||||||
Library. A suitable mechanism is one that (a) uses at run time
|
can regenerate automatically from other parts of the Corresponding
|
||||||
a copy of the Library already present on the user's computer
|
Source.
|
||||||
system, and (b) will operate properly with a modified version
|
|
||||||
of the Library that is interface-compatible with the Linked
|
|
||||||
Version.
|
|
||||||
|
|
||||||
e) Provide Installation Information, but only if you would otherwise
|
The Corresponding Source for a work in source code form is that
|
||||||
be required to provide such information under section 6 of the
|
same work.
|
||||||
GNU GPL, and only to the extent that such information is
|
|
||||||
necessary to install and execute a modified version of the
|
|
||||||
Combined Work produced by recombining or relinking the
|
|
||||||
Application with a modified version of the Linked Version. (If
|
|
||||||
you use option 4d0, the Installation Information must accompany
|
|
||||||
the Minimal Corresponding Source and Corresponding Application
|
|
||||||
Code. If you use option 4d1, you must provide the Installation
|
|
||||||
Information in the manner specified by section 6 of the GNU GPL
|
|
||||||
for conveying Corresponding Source.)
|
|
||||||
|
|
||||||
5. Combined Libraries.
|
2. Basic Permissions.
|
||||||
|
|
||||||
You may place library facilities that are a work based on the
|
All rights granted under this License are granted for the term of
|
||||||
Library side by side in a single library together with other library
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
facilities that are not Applications and are not covered by this
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
License, and convey such a combined library under terms of your
|
permission to run the unmodified Program. The output from running a
|
||||||
choice, if you do both of the following:
|
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.
|
||||||
|
|
||||||
a) Accompany the combined library with a copy of the same work based
|
You may make, run and propagate covered works that you do not
|
||||||
on the Library, uncombined with any other library facilities,
|
convey, without conditions so long as your license otherwise remains
|
||||||
conveyed under the terms of this License.
|
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.
|
||||||
|
|
||||||
b) Give prominent notice with the combined library that part of it
|
Conveying under any other circumstances is permitted solely under
|
||||||
is a work based on the Library, and explaining where to find the
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
accompanying uncombined form of the same work.
|
makes it unnecessary.
|
||||||
|
|
||||||
6. Revised Versions of the GNU Lesser General Public License.
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions
|
No covered work shall be deemed part of an effective technological
|
||||||
of the GNU Lesser General Public License from time to time. Such new
|
measure under any applicable law fulfilling obligations under article
|
||||||
versions will be similar in spirit to the present version, but may
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
differ in detail to address new problems or concerns.
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
Library as you received it specifies that a certain numbered version
|
circumvention of technological measures to the extent such circumvention
|
||||||
of the GNU Lesser General Public License "or any later version"
|
is effected by exercising rights under this License with respect to
|
||||||
applies to it, you have the option of following the terms and
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
conditions either of that published version or of any later version
|
modification of the work as a means of enforcing, against the work's
|
||||||
published by the Free Software Foundation. If the Library as you
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
received it does not specify a version number of the GNU Lesser
|
technological measures.
|
||||||
General Public License, you may choose any version of the GNU Lesser
|
|
||||||
General Public License ever published by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Library as you received it specifies that a proxy can decide
|
4. Conveying Verbatim Copies.
|
||||||
whether future versions of the GNU Lesser General Public License shall
|
|
||||||
apply, that proxy's public statement of acceptance of any version is
|
You may convey verbatim copies of the Program's source code as you
|
||||||
permanent authorization for you to choose that version for the
|
receive it, in any medium, provided that you conspicuously and
|
||||||
Library.
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
AntiCheatReloaded
|
AntiCheatReloaded [](https://github.com/Rammelkast/AntiCheatReloaded/releases) [](https://github.com/Rammelkast/AntiCheatReloaded/releases) [](https://github.com/Rammelkast/AntiCheatReloaded/commits/master) [](https://ci.rammelkast.com/job/AntiCheatReloaded/lastBuild/)
|
||||||
=============
|
=============
|
||||||
AntiCheatReloaded helps server admins combat the use of hacked clients and spambots. It analyses the behavior of players and can prevent malicious gameplay. The plugin offers a lot of customizability and can be connected across multiple servers in case it is used in a server network context. AntiCheatReloaded is based on gravitylow's AntiCheat and has been around since 2012.
|
AntiCheatReloaded helps server admins combat the use of hacked clients and spambots. It analyses the behavior of players and can prevent malicious gameplay. The plugin offers a lot of customizability and can be connected across multiple servers in case it is used in a server network context. AntiCheatReloaded is based on gravitylow's AntiCheat and has been around since 2012.
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
AntiCheatReloaded requires you to have ProtocolLib. You can download it [here](https://www.spigotmc.org/resources/protocollib.1997/).
|
AntiCheatReloaded **requires** you to have ProtocolLib. You can download it [here](https://www.spigotmc.org/resources/protocollib.1997/).
|
||||||
Simply drag and drop the AntiCheatReloaded and ProtocolLib jars in your plugin folder. You can now use AntiCheatReloaded, but be sure to have a look at the configuration files, which allow you to change every aspect of the plugin.
|
Simply drag and drop the AntiCheatReloaded and ProtocolLib jars in your plugin folder. You can now use AntiCheatReloaded, but be sure to have a look at the configuration files, which allow you to change every aspect of the plugin.
|
||||||
|
|
||||||
Bug Reporting
|
Bug Reporting
|
||||||
@@ -14,7 +14,7 @@ Issues should be filed by hitting the [issues](https://github.com/Rammelkast/Ant
|
|||||||
|
|
||||||
Please include the following information with your issue, this allows me to fix it quicker;
|
Please include the following information with your issue, this allows me to fix it quicker;
|
||||||
* Your AntiCheatReloaded version
|
* Your AntiCheatReloaded version
|
||||||
* Your server software (Bukkit/Spigot/Other) and it's version
|
* Your server implementation (Bukkit/Spigot/Other) and it's version
|
||||||
* Your ProtocolLib version
|
* Your ProtocolLib version
|
||||||
* Whether or not you are using protocol hacks (ViaVersion etc.)
|
* Whether or not you are using protocol hacks (ViaVersion etc.)
|
||||||
* Any logs relating to the issue
|
* Any logs relating to the issue
|
||||||
@@ -24,7 +24,6 @@ Hacks blocked
|
|||||||
* Flight/Glide
|
* Flight/Glide
|
||||||
* ElytraFly
|
* ElytraFly
|
||||||
* WaterWalk/Jesus
|
* WaterWalk/Jesus
|
||||||
* NoSwing
|
|
||||||
* FastBreak
|
* FastBreak
|
||||||
* FastPlace
|
* FastPlace
|
||||||
* Chat spam
|
* Chat spam
|
||||||
@@ -38,14 +37,17 @@ Hacks blocked
|
|||||||
* FastBow
|
* FastBow
|
||||||
* FastEat
|
* FastEat
|
||||||
* FastHeal
|
* FastHeal
|
||||||
* KillAura (Aimbot)
|
* KillAura
|
||||||
|
* Aimbot
|
||||||
* Reach
|
* Reach
|
||||||
* Unicode chat
|
* Unicode chat
|
||||||
* FastProjectile
|
* FastProjectile
|
||||||
* ItemSpam
|
* ItemSpam
|
||||||
* FastInventory
|
* FastInventory
|
||||||
* MorePackets/Timer
|
* Timer
|
||||||
* BadPackets
|
* Blink
|
||||||
* Velocity/Anti-Knockback
|
* Anti-Knockback
|
||||||
* IllegalInteract (Scaffold)
|
* Scaffold
|
||||||
* FastLadder
|
* FastLadder
|
||||||
|
* Strafe
|
||||||
|
* NoSlow
|
||||||
@@ -1,87 +1,136 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.rammelkast.anticheatreloaded</groupId>
|
<groupId>com.rammelkast.anticheatreloaded</groupId>
|
||||||
<artifactId>AntiCheatReloaded</artifactId>
|
<artifactId>AntiCheatReloaded</artifactId>
|
||||||
<version>1.9.0-PRE</version>
|
<version>1.11.0-PRE</version>
|
||||||
<name>AntiCheatReloaded</name>
|
<name>AntiCheatReloaded</name>
|
||||||
<url>https://www.spigotmc.org/resources/anticheatreloaded.23799/</url>
|
<url>https://www.spigotmc.org/resources/anticheatreloaded.23799/</url>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.version>${project.version}</project.build.version>
|
<project.build.version>${project.version}</project.build.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<repositories>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<repository>
|
</properties>
|
||||||
<id>dmulloy2-repo</id>
|
<repositories>
|
||||||
<url>https://repo.dmulloy2.net/nexus/repository/public/</url>
|
<repository>
|
||||||
</repository>
|
<id>dmulloy2-repo</id>
|
||||||
</repositories>
|
<url>https://repo.dmulloy2.net/nexus/repository/public/</url>
|
||||||
<build>
|
</repository>
|
||||||
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
|
<repository>
|
||||||
<plugins>
|
<id>spigot-public-repo</id>
|
||||||
<plugin>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/public/</url>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
</repository>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<repository>
|
||||||
<version>3.5</version>
|
<id>opencollab-snapshot-repo</id>
|
||||||
<configuration>
|
<url>https://repo.opencollab.dev/maven-snapshots/</url>
|
||||||
<source>1.8</source>
|
<releases>
|
||||||
<target>1.8</target>
|
<enabled>false</enabled>
|
||||||
</configuration>
|
</releases>
|
||||||
</plugin>
|
<snapshots>
|
||||||
<plugin>
|
<enabled>true</enabled>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
</snapshots>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
</repository>
|
||||||
<version>3.1.1</version>
|
</repositories>
|
||||||
<executions>
|
<build>
|
||||||
<execution>
|
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
|
||||||
<phase>package</phase>
|
<plugins>
|
||||||
<goals>
|
<plugin>
|
||||||
<goal>shade</goal>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
</goals>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
</execution>
|
<version>3.8.1</version>
|
||||||
</executions>
|
</plugin>
|
||||||
<configuration>
|
<plugin>
|
||||||
<artifactSet>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<includes>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<include>com.rammelkast.*</include>
|
<version>3.2.4</version>
|
||||||
<include>com.cryptomorin.*</include>
|
<executions>
|
||||||
</includes>
|
<execution>
|
||||||
</artifactSet>
|
<phase>package</phase>
|
||||||
</configuration>
|
<goals>
|
||||||
</plugin>
|
<goal>shade</goal>
|
||||||
</plugins>
|
</goals>
|
||||||
<finalName>AntiCheatReloaded</finalName>
|
<configuration>
|
||||||
<extensions>
|
<minimizeJar>true</minimizeJar>
|
||||||
<extension>
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
<groupId>org.apache.maven.wagon</groupId>
|
<relocations>
|
||||||
<artifactId>wagon-file</artifactId>
|
<relocation>
|
||||||
<version>2.2</version>
|
<pattern>org.bstats</pattern>
|
||||||
</extension>
|
<shadedPattern>com.rammelkast.anticheatreloaded.util</shadedPattern>
|
||||||
</extensions>
|
</relocation>
|
||||||
<resources>
|
<relocation>
|
||||||
<resource>
|
<pattern>com.cryptomorin.xseries</pattern>
|
||||||
<directory>src/main/resources</directory>
|
<shadedPattern>com.rammelkast.anticheatreloaded.util</shadedPattern>
|
||||||
<filtering>true</filtering>
|
</relocation>
|
||||||
</resource>
|
<relocation>
|
||||||
</resources>
|
<pattern>com.github.juliarn.npc</pattern>
|
||||||
</build>
|
<shadedPattern>com.rammelkast.anticheatreloaded.util.npc</shadedPattern>
|
||||||
<dependencies>
|
</relocation>
|
||||||
<dependency>
|
</relocations>
|
||||||
<groupId>com.comphenix.protocol</groupId>
|
<filters>
|
||||||
<artifactId>ProtocolLib</artifactId>
|
<filter>
|
||||||
<version>4.6.0-SNAPSHOT</version>
|
<artifact>com.github.cryptomorin:*</artifact>
|
||||||
</dependency>
|
<includes>
|
||||||
<dependency>
|
<include>com/cryptomorin/xseries/XMaterial*</include>
|
||||||
<groupId>org.spigotmc</groupId>
|
</includes>
|
||||||
<artifactId>spigot</artifactId>
|
</filter>
|
||||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
</filters>
|
||||||
<scope>provided</scope>
|
</configuration>
|
||||||
</dependency>
|
</execution>
|
||||||
<dependency>
|
</executions>
|
||||||
<groupId>org.spigotmc</groupId>
|
</plugin>
|
||||||
<artifactId>spigot</artifactId>
|
</plugins>
|
||||||
<version>1.16.1-R0.1-SNAPSHOT</version>
|
<finalName>AntiCheatReloaded</finalName>
|
||||||
<scope>provided</scope>
|
<extensions>
|
||||||
</dependency>
|
<extension>
|
||||||
</dependencies>
|
<groupId>org.apache.maven.wagon</groupId>
|
||||||
|
<artifactId>wagon-file</artifactId>
|
||||||
|
<version>3.4.3</version>
|
||||||
|
</extension>
|
||||||
|
</extensions>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</build>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.comphenix.protocol</groupId>
|
||||||
|
<artifactId>ProtocolLib</artifactId>
|
||||||
|
<version>4.8.0-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot-api</artifactId>
|
||||||
|
<version>1.18.1-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.22</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.geysermc.floodgate</groupId>
|
||||||
|
<artifactId>api</artifactId>
|
||||||
|
<version>2.0-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bstats</groupId>
|
||||||
|
<artifactId>bstats-bukkit</artifactId>
|
||||||
|
<version>2.2.1</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.cryptomorin</groupId>
|
||||||
|
<artifactId>XSeries</artifactId>
|
||||||
|
<version>8.5.0.1</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,15 +16,18 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded;
|
package com.rammelkast.anticheatreloaded;
|
||||||
|
|
||||||
import java.security.SecureRandom;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
import org.bstats.bukkit.Metrics;
|
||||||
|
import org.bstats.charts.SimplePie;
|
||||||
|
import org.bstats.charts.SingleLineChart;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -39,38 +42,65 @@ import com.rammelkast.anticheatreloaded.config.Configuration;
|
|||||||
import com.rammelkast.anticheatreloaded.event.BlockListener;
|
import com.rammelkast.anticheatreloaded.event.BlockListener;
|
||||||
import com.rammelkast.anticheatreloaded.event.EntityListener;
|
import com.rammelkast.anticheatreloaded.event.EntityListener;
|
||||||
import com.rammelkast.anticheatreloaded.event.InventoryListener;
|
import com.rammelkast.anticheatreloaded.event.InventoryListener;
|
||||||
|
import com.rammelkast.anticheatreloaded.event.PacketListener;
|
||||||
import com.rammelkast.anticheatreloaded.event.PlayerListener;
|
import com.rammelkast.anticheatreloaded.event.PlayerListener;
|
||||||
import com.rammelkast.anticheatreloaded.event.VehicleListener;
|
import com.rammelkast.anticheatreloaded.event.VehicleListener;
|
||||||
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
|
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
|
||||||
import com.rammelkast.anticheatreloaded.metrics.Metrics;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.PacketListener;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.UpdateManager;
|
import com.rammelkast.anticheatreloaded.util.UpdateManager;
|
||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.util.VersionLib;
|
||||||
|
|
||||||
public class AntiCheatReloaded extends JavaPlugin {
|
import lombok.Getter;
|
||||||
|
|
||||||
|
public final class AntiCheatReloaded extends JavaPlugin {
|
||||||
|
|
||||||
|
public static final String PREFIX = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> "
|
||||||
|
+ ChatColor.GRAY;
|
||||||
public static final List<UUID> MUTE_ENABLED_MODS = new ArrayList<UUID>();
|
public static final List<UUID> MUTE_ENABLED_MODS = new ArrayList<UUID>();
|
||||||
|
|
||||||
private static AntiCheatManager manager;
|
@Getter
|
||||||
private static AntiCheatReloaded plugin;
|
private static AntiCheatReloaded plugin;
|
||||||
|
@Getter
|
||||||
|
private static AntiCheatManager manager;
|
||||||
|
@Getter
|
||||||
|
private static ExecutorService executor;
|
||||||
|
@Getter
|
||||||
|
private static ProtocolManager protocolManager;
|
||||||
|
@Getter
|
||||||
|
private static UpdateManager updateManager;
|
||||||
|
@Getter
|
||||||
|
private static boolean floodgateEnabled;
|
||||||
private static List<Listener> eventList = new ArrayList<Listener>();
|
private static List<Listener> eventList = new ArrayList<Listener>();
|
||||||
private static Configuration config;
|
private static Configuration config;
|
||||||
private static boolean verbose;
|
private static boolean verbose;
|
||||||
private static ProtocolManager protocolManager;
|
|
||||||
private static SecureRandom random;
|
|
||||||
private static Long loadTime;
|
|
||||||
private static UpdateManager updateManager;
|
|
||||||
|
|
||||||
private double tps = -1;
|
private double tps = -1;
|
||||||
private String symbiosisMetric = "None";
|
|
||||||
|
@Override
|
||||||
|
public void onLoad() {
|
||||||
|
plugin = this;
|
||||||
|
|
||||||
|
// Create executor service
|
||||||
|
// Determine thread count based on available CPU cores/threads, max of 4
|
||||||
|
final int threads = Math.max(Math.min(Runtime.getRuntime().availableProcessors() / 4, 4), 1);
|
||||||
|
executor = Executors.newFixedThreadPool(threads);
|
||||||
|
{
|
||||||
|
Bukkit.getConsoleSender().sendMessage(PREFIX + ChatColor.GRAY + "Pool size is " + threads + " threads");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for ProtocolLib
|
||||||
|
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") == null) {
|
||||||
|
Bukkit.getConsoleSender().sendMessage(PREFIX + ChatColor.RED
|
||||||
|
+ "ProtocolLib not found! AntiCheatReloaded requires ProtocolLib to work, please download and install it.");
|
||||||
|
Bukkit.getPluginManager().disablePlugin(this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
plugin = this;
|
|
||||||
random = new SecureRandom();
|
|
||||||
loadTime = System.currentTimeMillis();
|
|
||||||
manager = new AntiCheatManager(this, getLogger());
|
manager = new AntiCheatManager(this, getLogger());
|
||||||
|
|
||||||
eventList.add(new PlayerListener());
|
eventList.add(new PlayerListener());
|
||||||
eventList.add(new BlockListener());
|
eventList.add(new BlockListener());
|
||||||
eventList.add(new EntityListener());
|
eventList.add(new EntityListener());
|
||||||
@@ -78,34 +108,52 @@ public class AntiCheatReloaded extends JavaPlugin {
|
|||||||
eventList.add(new InventoryListener());
|
eventList.add(new InventoryListener());
|
||||||
// Order is important in some cases, don't screw with these unless
|
// Order is important in some cases, don't screw with these unless
|
||||||
// needed, especially config
|
// needed, especially config
|
||||||
this.setupConfig();
|
setupConfig();
|
||||||
this.setupEvents();
|
setupEvents();
|
||||||
this.setupCommands();
|
setupCommands();
|
||||||
// Enterprise must come before levels
|
// Enterprise must come before levels
|
||||||
this.setupEnterprise();
|
setupEnterprise();
|
||||||
this.restoreLevels();
|
restoreLevels();
|
||||||
|
// Setup ProtocolLib hooks
|
||||||
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
|
setupProtocol();
|
||||||
this.setupProtocol();
|
|
||||||
} else {
|
|
||||||
Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.RED
|
|
||||||
+ "Could not find ProtocolLib. Shutting down!");
|
|
||||||
Bukkit.getPluginManager().disablePlugin(this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Bukkit.getConsoleSender()
|
|
||||||
.sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.GRAY
|
|
||||||
+ "Running Minecraft version " + VersionUtil.getVersion() + " "
|
|
||||||
+ (VersionUtil.isSupported() ? (ChatColor.GREEN + "(supported)")
|
|
||||||
: (ChatColor.RED + "(NOT SUPPORTED!)")));
|
|
||||||
|
|
||||||
getLogger().info("Enabling packet listeners");
|
Bukkit.getConsoleSender()
|
||||||
PacketListener.listenKeepAlivePackets();
|
.sendMessage(PREFIX + ChatColor.GRAY + "Running Minecraft version " + VersionLib.getVersion() + " "
|
||||||
PacketListener.listenMovementPackets();
|
+ (VersionLib.isSupported() ? (ChatColor.GREEN + "(supported)")
|
||||||
|
: (ChatColor.RED + "(NOT SUPPORTED!)")));
|
||||||
|
|
||||||
|
// Check for Floodgate
|
||||||
|
if (Bukkit.getPluginManager().getPlugin("Floodgate") != null) {
|
||||||
|
floodgateEnabled = true;
|
||||||
|
Bukkit.getConsoleSender().sendMessage(PREFIX + ChatColor.WHITE + "Floodgate support enabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create update manager
|
||||||
updateManager = new UpdateManager();
|
updateManager = new UpdateManager();
|
||||||
|
|
||||||
|
// Launch TPS check
|
||||||
|
new BukkitRunnable() {
|
||||||
|
long second;
|
||||||
|
long currentSecond;
|
||||||
|
int ticks;
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
second = (System.currentTimeMillis() / 1000L);
|
||||||
|
if (currentSecond == second) {
|
||||||
|
ticks += 1;
|
||||||
|
} else {
|
||||||
|
currentSecond = second;
|
||||||
|
tps = (tps == 0.0D ? ticks : (tps + ticks) / 2.0D);
|
||||||
|
ticks = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for updates every 12 hours
|
||||||
|
if (ticks % 864000 == 0) {
|
||||||
|
updateManager.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.runTaskTimer(this, 40L, 1L);
|
||||||
|
|
||||||
// End tests
|
// End tests
|
||||||
verboseLog("Finished loading.");
|
verboseLog("Finished loading.");
|
||||||
|
|
||||||
@@ -113,34 +161,33 @@ public class AntiCheatReloaded extends JavaPlugin {
|
|||||||
getServer().getScheduler().runTaskLater(this, new Runnable() {
|
getServer().getScheduler().runTaskLater(this, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
checkForSymbiosis();
|
|
||||||
try {
|
try {
|
||||||
Metrics metrics = new Metrics(AntiCheatReloaded.this, 202);
|
final Metrics metrics = new Metrics(AntiCheatReloaded.this, 202);
|
||||||
metrics.addCustomChart(new Metrics.SingleLineChart("cheaters_kicked", new Callable<Integer>() {
|
metrics.addCustomChart(new SingleLineChart("cheaters_kicked", new Callable<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public Integer call() throws Exception {
|
public Integer call() throws Exception {
|
||||||
int kicked = playersKicked;
|
final int kicked = playersKicked;
|
||||||
// Reset so we don't keep sending the same value
|
// Reset so we don't keep sending the same value
|
||||||
playersKicked = 0;
|
playersKicked = 0;
|
||||||
return kicked;
|
return kicked;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
metrics.addCustomChart(new Metrics.SimplePie("protocollib_version", new Callable<String>() {
|
metrics.addCustomChart(new SimplePie("protocollib_version", new Callable<String>() {
|
||||||
@Override
|
@Override
|
||||||
public String call() throws Exception {
|
public String call() throws Exception {
|
||||||
return Bukkit.getPluginManager().getPlugin("ProtocolLib").getDescription().getVersion();
|
return Bukkit.getPluginManager().getPlugin("ProtocolLib").getDescription().getVersion();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
metrics.addCustomChart(new Metrics.SimplePie("nms_version", new Callable<String>() {
|
metrics.addCustomChart(new SimplePie("nms_version", new Callable<String>() {
|
||||||
@Override
|
@Override
|
||||||
public String call() throws Exception {
|
public String call() throws Exception {
|
||||||
return VersionUtil.getVersion();
|
return VersionLib.getVersion();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
metrics.addCustomChart(new Metrics.SimplePie("symbiosis", new Callable<String>() {
|
metrics.addCustomChart(new SimplePie("floodgate_enabled", new Callable<String>() {
|
||||||
@Override
|
@Override
|
||||||
public String call() throws Exception {
|
public String call() throws Exception {
|
||||||
return symbiosisMetric;
|
return floodgateEnabled ? "Yes" : "No";
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -148,38 +195,29 @@ public class AntiCheatReloaded extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 90L);
|
}, 90L);
|
||||||
|
|
||||||
// Launch TPS check
|
|
||||||
new BukkitRunnable() {
|
|
||||||
long sec;
|
|
||||||
long currentSec;
|
|
||||||
int ticks;
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
sec = (System.currentTimeMillis() / 1000L);
|
|
||||||
if (currentSec == sec) {
|
|
||||||
ticks += 1;
|
|
||||||
} else {
|
|
||||||
currentSec = sec;
|
|
||||||
tps = (tps == 0.0D ? ticks : (tps + ticks) / 2.0D);
|
|
||||||
ticks = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.runTaskTimer(this, 40L, 1L);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
// Cancel all running tasks
|
||||||
|
getServer().getScheduler().cancelTasks(this);
|
||||||
|
|
||||||
|
// Shut down executor service
|
||||||
|
executor.shutdown();
|
||||||
|
|
||||||
|
// Save user levels
|
||||||
verboseLog("Saving user levels...");
|
verboseLog("Saving user levels...");
|
||||||
config.getLevels().saveLevelsFromUsers(getManager().getUserManager().getUsers());
|
if (config != null) {
|
||||||
|
config.getLevels().saveLevelsFromUsers(manager.getUserManager().getUsers());
|
||||||
|
}
|
||||||
|
|
||||||
AntiCheatManager.close();
|
AntiCheatManager.close();
|
||||||
getServer().getScheduler().cancelTasks(this);
|
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupProtocol() {
|
private void setupProtocol() {
|
||||||
protocolManager = ProtocolLibrary.getProtocolManager();
|
protocolManager = ProtocolLibrary.getProtocolManager();
|
||||||
|
protocolManager.addPacketListener(new PacketListener(this));
|
||||||
verboseLog("Hooked into ProtocolLib");
|
verboseLog("Hooked into ProtocolLib");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,9 +248,9 @@ public class AntiCheatReloaded extends JavaPlugin {
|
|||||||
|
|
||||||
private void restoreLevels() {
|
private void restoreLevels() {
|
||||||
for (Player player : getServer().getOnlinePlayers()) {
|
for (Player player : getServer().getOnlinePlayers()) {
|
||||||
UUID uuid = player.getUniqueId();
|
final UUID uuid = player.getUniqueId();
|
||||||
|
|
||||||
User user = new User(uuid);
|
final User user = new User(uuid);
|
||||||
user.setIsWaitingOnLevelSync(true);
|
user.setIsWaitingOnLevelSync(true);
|
||||||
config.getLevels().loadLevelToUser(user);
|
config.getLevels().loadLevelToUser(user);
|
||||||
|
|
||||||
@@ -221,28 +259,20 @@ public class AntiCheatReloaded extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AntiCheatReloaded getPlugin() {
|
|
||||||
return plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AntiCheatManager getManager() {
|
|
||||||
return manager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SecureRandom getRandom() {
|
|
||||||
return random;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getVersion() {
|
public static String getVersion() {
|
||||||
return manager.getPlugin().getDescription().getVersion();
|
return manager.getPlugin().getDescription().getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cleanup() {
|
private void cleanup() {
|
||||||
eventList = null;
|
|
||||||
manager = null;
|
manager = null;
|
||||||
|
plugin = null;
|
||||||
|
eventList = null;
|
||||||
config = null;
|
config = null;
|
||||||
|
protocolManager = null;
|
||||||
|
updateManager = null;
|
||||||
|
executor = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void debugLog(final String string) {
|
public static void debugLog(final String string) {
|
||||||
Bukkit.getScheduler().runTask(getPlugin(), new Runnable() {
|
Bukkit.getScheduler().runTask(getPlugin(), new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -262,15 +292,7 @@ public class AntiCheatReloaded extends JavaPlugin {
|
|||||||
public void setVerbose(boolean b) {
|
public void setVerbose(boolean b) {
|
||||||
verbose = b;
|
verbose = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getLoadTime() {
|
|
||||||
return loadTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ProtocolManager getProtocolManager() {
|
|
||||||
return protocolManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Amount of players kicked since start
|
* Amount of players kicked since start
|
||||||
*/
|
*/
|
||||||
@@ -280,54 +302,11 @@ public class AntiCheatReloaded extends JavaPlugin {
|
|||||||
this.playersKicked++;
|
this.playersKicked++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public static void sendToMainThread(final Runnable runnable) {
|
||||||
* Creates metric that checks for anti-cheat symbiosis
|
|
||||||
* I use this to see if AntiCheatReloaded is actively being used
|
|
||||||
* together with other anti-cheats, so I can account for that.
|
|
||||||
*/
|
|
||||||
protected void checkForSymbiosis() {
|
|
||||||
if (Bukkit.getPluginManager().getPlugin("NoCheatPlus") != null) {
|
|
||||||
if (this.symbiosisMetric.equals("None")) {
|
|
||||||
this.symbiosisMetric = "NoCheatPlus";
|
|
||||||
} else {
|
|
||||||
this.symbiosisMetric += ", NoCheatPlus";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Bukkit.getPluginManager().getPlugin("Matrix") != null) {
|
|
||||||
if (this.symbiosisMetric.equals("None")) {
|
|
||||||
this.symbiosisMetric = "Matrix";
|
|
||||||
} else {
|
|
||||||
this.symbiosisMetric += ", Matrix";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Bukkit.getPluginManager().getPlugin("AAC") != null) {
|
|
||||||
if (this.symbiosisMetric.equals("None")) {
|
|
||||||
this.symbiosisMetric = "AAC";
|
|
||||||
} else {
|
|
||||||
this.symbiosisMetric += ", AAC";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Bukkit.getPluginManager().getPlugin("Spartan") != null) {
|
|
||||||
if (this.symbiosisMetric.equals("None")) {
|
|
||||||
this.symbiosisMetric = "Spartan";
|
|
||||||
} else {
|
|
||||||
this.symbiosisMetric += ", Spartan";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Bukkit.getPluginManager().getPlugin("Negativity") != null) {
|
|
||||||
if (this.symbiosisMetric.equals("None")) {
|
|
||||||
this.symbiosisMetric = "Negativity";
|
|
||||||
} else {
|
|
||||||
this.symbiosisMetric += ", Negativity";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void sendToMainThread(Runnable runnable) {
|
|
||||||
Bukkit.getScheduler().runTask(AntiCheatReloaded.getPlugin(), runnable);
|
Bukkit.getScheduler().runTask(AntiCheatReloaded.getPlugin(), runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendToStaff(String message) {
|
public void sendToStaff(final String message) {
|
||||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||||
if (player.hasPermission("anticheat.system.alert")) {
|
if (player.hasPermission("anticheat.system.alert")) {
|
||||||
if (!MUTE_ENABLED_MODS.contains(player.getUniqueId())) {
|
if (!MUTE_ENABLED_MODS.contains(player.getUniqueId())) {
|
||||||
@@ -336,16 +315,9 @@ public class AntiCheatReloaded extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UpdateManager getUpdateManager() {
|
|
||||||
return updateManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getTPS() {
|
public double getTPS() {
|
||||||
if (this.tps < 0 || this.tps > 20) {
|
return Math.min(Math.max(this.tps, 0.0D), 20.0D);
|
||||||
return 20;
|
|
||||||
}
|
|
||||||
return this.tps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -30,13 +30,10 @@ import com.rammelkast.anticheatreloaded.manage.CheckManager;
|
|||||||
import com.rammelkast.anticheatreloaded.manage.UserManager;
|
import com.rammelkast.anticheatreloaded.manage.UserManager;
|
||||||
import com.rammelkast.anticheatreloaded.util.Group;
|
import com.rammelkast.anticheatreloaded.util.Group;
|
||||||
|
|
||||||
/**
|
public final class AntiCheatAPI {
|
||||||
* Developer's interface for all things AntiCheat.
|
|
||||||
*/
|
private static final CheckManager CHECK_MANAGER = AntiCheatReloaded.getManager().getCheckManager();
|
||||||
|
private static final UserManager USER_MANAGER = AntiCheatReloaded.getManager().getUserManager();
|
||||||
public class AntiCheatAPI {
|
|
||||||
private static CheckManager chk = AntiCheatReloaded.getManager().getCheckManager();
|
|
||||||
private static UserManager umr = AntiCheatReloaded.getManager().getUserManager();
|
|
||||||
|
|
||||||
// CheckManager API
|
// CheckManager API
|
||||||
|
|
||||||
@@ -45,8 +42,8 @@ public class AntiCheatAPI {
|
|||||||
*
|
*
|
||||||
* @param type Check to start watching for
|
* @param type Check to start watching for
|
||||||
*/
|
*/
|
||||||
public static void activateCheck(CheckType type, Class<?> caller) {
|
public static void activateCheck(final CheckType type, final Class<?> caller) {
|
||||||
chk.activateCheck(type, caller.getName());
|
CHECK_MANAGER.activateCheck(type, caller.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,8 +51,8 @@ public class AntiCheatAPI {
|
|||||||
*
|
*
|
||||||
* @param type Check to stop watching for
|
* @param type Check to stop watching for
|
||||||
*/
|
*/
|
||||||
public static void deactivateCheck(CheckType type, Class<?> caller) {
|
public static void deactivateCheck(final CheckType type, final Class<?> caller) {
|
||||||
chk.deactivateCheck(type, caller.getName());
|
CHECK_MANAGER.deactivateCheck(type, caller.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,8 +61,8 @@ public class AntiCheatAPI {
|
|||||||
* @param type Type to check
|
* @param type Type to check
|
||||||
* @return true if plugin is watching for this check
|
* @return true if plugin is watching for this check
|
||||||
*/
|
*/
|
||||||
public static boolean isActive(CheckType type) {
|
public static boolean isActive(final CheckType type) {
|
||||||
return chk.isActive(type);
|
return CHECK_MANAGER.isActive(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -74,8 +71,8 @@ public class AntiCheatAPI {
|
|||||||
* @param player Player to stop watching
|
* @param player Player to stop watching
|
||||||
* @param type Check to stop watching for
|
* @param type Check to stop watching for
|
||||||
*/
|
*/
|
||||||
public static void exemptPlayer(Player player, CheckType type, Class<?> caller) {
|
public static void exemptPlayer(final Player player, final CheckType type, final Class<?> caller) {
|
||||||
chk.exemptPlayer(player, type, caller.getName());
|
CHECK_MANAGER.exemptPlayer(player, type, caller.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,8 +81,8 @@ public class AntiCheatAPI {
|
|||||||
* @param player Player to start watching
|
* @param player Player to start watching
|
||||||
* @param type Check to start watching for
|
* @param type Check to start watching for
|
||||||
*/
|
*/
|
||||||
public static void unexemptPlayer(Player player, CheckType type, Class<?> caller) {
|
public static void unexemptPlayer(final Player player, final CheckType type, final Class<?> caller) {
|
||||||
chk.unexemptPlayer(player, type, caller.getName());
|
CHECK_MANAGER.unexemptPlayer(player, type, caller.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,8 +92,8 @@ public class AntiCheatAPI {
|
|||||||
* @param type Type to check
|
* @param type Type to check
|
||||||
* @return true if plugin is ignoring this check on this player
|
* @return true if plugin is ignoring this check on this player
|
||||||
*/
|
*/
|
||||||
public static boolean isExempt(Player player, CheckType type) {
|
public static boolean isExempt(final Player player, final CheckType type) {
|
||||||
return chk.isExempt(player, type);
|
return CHECK_MANAGER.isExempt(player, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -106,8 +103,8 @@ public class AntiCheatAPI {
|
|||||||
* @param type Type to check
|
* @param type Type to check
|
||||||
* @return true if plugin will check this player, and that all things allow it to happen.
|
* @return true if plugin will check this player, and that all things allow it to happen.
|
||||||
*/
|
*/
|
||||||
public boolean willCheck(Player player, CheckType type) {
|
public boolean willCheck(final Player player, final CheckType type) {
|
||||||
return chk.willCheck(player, type);
|
return CHECK_MANAGER.willCheck(player, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PlayerManager API
|
// PlayerManager API
|
||||||
@@ -117,8 +114,8 @@ public class AntiCheatAPI {
|
|||||||
*
|
*
|
||||||
* @param player Player to reset
|
* @param player Player to reset
|
||||||
*/
|
*/
|
||||||
public static void resetPlayer(Player player) {
|
public static void resetPlayer(final Player player) {
|
||||||
umr.getUser(player.getUniqueId()).resetLevel();
|
USER_MANAGER.getUser(player.getUniqueId()).resetLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -127,8 +124,8 @@ public class AntiCheatAPI {
|
|||||||
* @param player Player whose group to find
|
* @param player Player whose group to find
|
||||||
* @return The player's group
|
* @return The player's group
|
||||||
*/
|
*/
|
||||||
public static Group getGroup(Player player) {
|
public static Group getGroup(final Player player) {
|
||||||
return umr.getUser(player.getUniqueId()).getGroup();
|
return USER_MANAGER.getUser(player.getUniqueId()).getGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -152,5 +149,4 @@ public class AntiCheatAPI {
|
|||||||
return AntiCheatReloaded.getManager();
|
return AntiCheatReloaded.getManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+5
-6
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.api;
|
package com.rammelkast.anticheatreloaded.api.event;
|
||||||
|
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
@@ -26,17 +26,16 @@ import com.rammelkast.anticheatreloaded.check.CheckType;
|
|||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fired when a player fails an AntiCheat check
|
* Fired when a player fails an AntiCheatReloaded check
|
||||||
*/
|
*/
|
||||||
|
public final class CheckFailEvent extends Event {
|
||||||
public class CheckFailEvent extends Event {
|
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
private final User user;
|
private final User user;
|
||||||
private final CheckType type;
|
private final CheckType type;
|
||||||
|
|
||||||
public CheckFailEvent(User user, CheckType type) {
|
public CheckFailEvent(final User user, final CheckType type) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
|
*
|
||||||
|
* 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 com.rammelkast.anticheatreloaded.api.event;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fired when a player is punished by AntiCheatReloaded
|
||||||
|
*/
|
||||||
|
public final class PlayerPunishEvent extends Event implements Cancellable {
|
||||||
|
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
private final User user;
|
||||||
|
private final List<String> actions;
|
||||||
|
|
||||||
|
private boolean cancelled;
|
||||||
|
|
||||||
|
public PlayerPunishEvent(final User user, final List<String> actions) {
|
||||||
|
this.user = user;
|
||||||
|
this.actions = actions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the {@link com.rammelkast.anticheatreloaded.util.User} who will be
|
||||||
|
* punished
|
||||||
|
*
|
||||||
|
* @return a {@link com.rammelkast.anticheatreloaded.util.User}
|
||||||
|
*/
|
||||||
|
public User getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of actions the punishment will perform
|
||||||
|
*
|
||||||
|
* @return a a list of punishment strings
|
||||||
|
*/
|
||||||
|
public List<String> getActions() {
|
||||||
|
return actions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
this.cancelled = cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,10 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.rammelkast.anticheatreloaded.check;
|
package com.rammelkast.anticheatreloaded.check;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@@ -37,10 +34,12 @@ import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|||||||
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
||||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
|
import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.AimbotCheck;
|
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.movement.NoSlowCheck;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.packet.MorePacketsCheck;
|
import com.rammelkast.anticheatreloaded.check.packet.MorePacketsCheck;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.player.NoFallCheck;
|
||||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Lang;
|
import com.rammelkast.anticheatreloaded.config.providers.Lang;
|
||||||
@@ -49,143 +48,132 @@ import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
|
|||||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
|
||||||
|
|
||||||
public class Backend {
|
public class Backend {
|
||||||
public Map<UUID, Long> velocitized = new HashMap<UUID, Long>();
|
|
||||||
private Map<UUID, Long> levitatingEnd = new HashMap<UUID, Long>();
|
|
||||||
private List<UUID> isAscending = new ArrayList<UUID>();
|
|
||||||
private Map<UUID, Integer> chatLevel = new HashMap<UUID, Integer>();
|
|
||||||
private Map<UUID, Integer> commandLevel = new HashMap<UUID, Integer>();
|
|
||||||
private Map<UUID, Integer> nofallViolation = new HashMap<UUID, Integer>();
|
|
||||||
private Map<UUID, Boolean> blockBreakHolder = new HashMap<UUID, Boolean>();
|
|
||||||
private Map<UUID, Integer> fastPlaceViolation = new HashMap<UUID, Integer>();
|
|
||||||
private Map<UUID, Long> lastBlockPlaced = new HashMap<UUID, Long>();
|
|
||||||
private Map<UUID, Long> lastBlockPlaceTime = new HashMap<UUID, Long>();
|
|
||||||
private Map<UUID, Integer> blockPunches = new HashMap<UUID, Integer>();
|
|
||||||
private Map<UUID, Integer> projectilesShot = new HashMap<UUID, Integer>();
|
|
||||||
private Map<UUID, Integer> velocitytrack = new HashMap<UUID, Integer>();
|
|
||||||
private Map<UUID, Long> startEat = new HashMap<UUID, Long>();
|
|
||||||
private Map<UUID, Long> lastHeal = new HashMap<UUID, Long>();
|
|
||||||
private Map<UUID, Long> projectileTime = new HashMap<UUID, Long>();
|
|
||||||
private Map<UUID, Long> bowWindUp = new HashMap<UUID, Long>();
|
|
||||||
private Map<UUID, Long> sprinted = new HashMap<UUID, Long>();
|
|
||||||
private Map<UUID, Long> brokenBlock = new HashMap<UUID, Long>();
|
|
||||||
public Map<UUID, Long> placedBlock = new HashMap<UUID, Long>();
|
|
||||||
private Map<UUID, Long> blockTime = new HashMap<UUID, Long>();
|
|
||||||
private Map<UUID, Integer> blocksDropped = new HashMap<UUID, Integer>();
|
|
||||||
private Map<UUID, Long> lastInventoryTime = new HashMap<UUID, Long>();
|
|
||||||
private Map<UUID, Long> inventoryTime = new HashMap<UUID, Long>();
|
|
||||||
private Map<UUID, Integer> inventoryClicks = new HashMap<UUID, Integer>();
|
|
||||||
private HashSet<Byte> transparent = new HashSet<Byte>();
|
|
||||||
private Map<UUID, Long> lastFallPacket = new HashMap<UUID, Long>();
|
|
||||||
private Map<UUID, Integer> fastSneakViolations = new HashMap<UUID, Integer>();
|
|
||||||
private Map<UUID, Long> lastSneak = new HashMap<UUID, Long>();
|
|
||||||
|
|
||||||
private Magic magic;
|
|
||||||
private Checks checksConfig;
|
|
||||||
private AntiCheatManager manager = null;
|
|
||||||
private Lang lang = null;
|
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public Backend(AntiCheatManager instance) {
|
public final Map<UUID, Long> placedBlock = new HashMap<UUID, Long>();
|
||||||
magic = instance.getConfiguration().getMagic();
|
|
||||||
checksConfig = instance.getConfiguration().getChecks();
|
private final Map<UUID, Long> levitatingEnd = new HashMap<UUID, Long>();
|
||||||
manager = instance;
|
private final Map<UUID, Integer> chatLevel = new HashMap<UUID, Integer>();
|
||||||
lang = manager.getConfiguration().getLang();
|
private final Map<UUID, Integer> commandLevel = new HashMap<UUID, Integer>();
|
||||||
transparent.add((byte) -1);
|
private final Map<UUID, Integer> fastPlaceViolation = new HashMap<UUID, Integer>();
|
||||||
|
private final Map<UUID, Long> lastBlockPlaced = new HashMap<UUID, Long>();
|
||||||
|
private final Map<UUID, Long> lastBlockPlaceTime = new HashMap<UUID, Long>();
|
||||||
|
private final Map<UUID, Integer> projectilesShot = new HashMap<UUID, Integer>();
|
||||||
|
private final Map<UUID, Long> startEat = new HashMap<UUID, Long>();
|
||||||
|
private final Map<UUID, Long> lastHeal = new HashMap<UUID, Long>();
|
||||||
|
private final Map<UUID, Long> projectileTime = new HashMap<UUID, Long>();
|
||||||
|
private final Map<UUID, Long> bowWindUp = new HashMap<UUID, Long>();
|
||||||
|
private final Map<UUID, Long> sprinted = new HashMap<UUID, Long>();
|
||||||
|
private final Map<UUID, Long> blockTime = new HashMap<UUID, Long>();
|
||||||
|
private final Map<UUID, Integer> blocksDropped = new HashMap<UUID, Integer>();
|
||||||
|
private final Map<UUID, Long> lastInventoryTime = new HashMap<UUID, Long>();
|
||||||
|
private final Map<UUID, Long> inventoryTime = new HashMap<UUID, Long>();
|
||||||
|
private final Map<UUID, Integer> inventoryClicks = new HashMap<UUID, Integer>();
|
||||||
|
private final Map<UUID, Integer> fastSneakViolations = new HashMap<UUID, Integer>();
|
||||||
|
private final Map<UUID, Long> lastSneak = new HashMap<UUID, Long>();
|
||||||
|
|
||||||
|
private final Checks checksConfig;
|
||||||
|
private final AntiCheatManager manager;
|
||||||
|
private Magic magic;
|
||||||
|
private Lang lang;
|
||||||
|
|
||||||
|
public Backend(final AntiCheatManager instance) {
|
||||||
|
this.magic = instance.getConfiguration().getMagic();
|
||||||
|
this.checksConfig = instance.getConfiguration().getChecks();
|
||||||
|
this.manager = instance;
|
||||||
|
this.lang = manager.getConfiguration().getLang();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Magic getMagic() {
|
public void updateConfig(final Configuration config) {
|
||||||
return magic;
|
this.magic = config.getMagic();
|
||||||
|
this.lang = config.getLang();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateConfig(Configuration config) {
|
public void resetChatLevel(final User user) {
|
||||||
magic = config.getMagic();
|
|
||||||
lang = config.getLang();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void resetChatLevel(User user) {
|
|
||||||
chatLevel.put(user.getUUID(), 0);
|
chatLevel.put(user.getUUID(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void garbageClean(Player player) {
|
public void cleanup(final Player player) {
|
||||||
UUID uuid = player.getUniqueId();
|
final UUID uuid = player.getUniqueId();
|
||||||
|
|
||||||
blocksDropped.remove(uuid);
|
blocksDropped.remove(uuid);
|
||||||
blockTime.remove(uuid);
|
blockTime.remove(uuid);
|
||||||
brokenBlock.remove(uuid);
|
|
||||||
placedBlock.remove(uuid);
|
placedBlock.remove(uuid);
|
||||||
bowWindUp.remove(uuid);
|
bowWindUp.remove(uuid);
|
||||||
startEat.remove(uuid);
|
startEat.remove(uuid);
|
||||||
lastHeal.remove(uuid);
|
lastHeal.remove(uuid);
|
||||||
sprinted.remove(uuid);
|
sprinted.remove(uuid);
|
||||||
isAscending.remove(uuid);
|
|
||||||
nofallViolation.remove(uuid);
|
|
||||||
blockBreakHolder.remove(uuid);
|
|
||||||
fastPlaceViolation.remove(uuid);
|
fastPlaceViolation.remove(uuid);
|
||||||
lastBlockPlaced.remove(uuid);
|
lastBlockPlaced.remove(uuid);
|
||||||
lastBlockPlaceTime.remove(uuid);
|
lastBlockPlaceTime.remove(uuid);
|
||||||
blockPunches.remove(uuid);
|
|
||||||
projectilesShot.remove(uuid);
|
projectilesShot.remove(uuid);
|
||||||
velocitized.remove(uuid);
|
|
||||||
velocitytrack.remove(uuid);
|
|
||||||
startEat.remove(uuid);
|
startEat.remove(uuid);
|
||||||
lastHeal.remove(uuid);
|
lastHeal.remove(uuid);
|
||||||
projectileTime.remove(uuid);
|
projectileTime.remove(uuid);
|
||||||
bowWindUp.remove(uuid);
|
bowWindUp.remove(uuid);
|
||||||
sprinted.remove(uuid);
|
sprinted.remove(uuid);
|
||||||
brokenBlock.remove(uuid);
|
|
||||||
placedBlock.remove(uuid);
|
placedBlock.remove(uuid);
|
||||||
blockTime.remove(uuid);
|
blockTime.remove(uuid);
|
||||||
blocksDropped.remove(uuid);
|
blocksDropped.remove(uuid);
|
||||||
lastInventoryTime.remove(uuid);
|
lastInventoryTime.remove(uuid);
|
||||||
inventoryTime.remove(uuid);
|
inventoryTime.remove(uuid);
|
||||||
inventoryClicks.remove(uuid);
|
inventoryClicks.remove(uuid);
|
||||||
lastFallPacket.remove(uuid);
|
|
||||||
fastSneakViolations.remove(uuid);
|
fastSneakViolations.remove(uuid);
|
||||||
lastSneak.remove(uuid);
|
lastSneak.remove(uuid);
|
||||||
levitatingEnd.remove(uuid);
|
levitatingEnd.remove(uuid);
|
||||||
AimbotCheck.LAST_DELTA_YAW.remove(uuid);
|
NoFallCheck.VIOLATIONS.remove(uuid);
|
||||||
VelocityCheck.VIOLATIONS.remove(uuid);
|
VelocityCheck.VIOLATIONS.remove(uuid);
|
||||||
MorePacketsCheck.LAST_PACKET_TIME.remove(uuid);
|
MorePacketsCheck.LAST_PACKET_TIME.remove(uuid);
|
||||||
MorePacketsCheck.PACKET_BALANCE.remove(uuid);
|
MorePacketsCheck.PACKET_BALANCE.remove(uuid);
|
||||||
MorePacketsCheck.EXEMPT_TIMINGS.remove(uuid);
|
MorePacketsCheck.EXEMPT_TIMINGS.remove(uuid);
|
||||||
ElytraCheck.JUMP_Y_VALUE.remove(uuid);
|
ElytraCheck.JUMP_Y_VALUE.remove(uuid);
|
||||||
KillAuraCheck.ANGLE_FLAGS.remove(uuid);
|
KillAuraCheck.ANGLE_FLAGS.remove(uuid);
|
||||||
|
KillAuraCheck.PACKETORDER_FLAGS.remove(uuid);
|
||||||
|
KillAuraCheck.THROUGHWALLS_FLAGS.remove(uuid);
|
||||||
FlightCheck.MOVING_EXEMPT.remove(uuid);
|
FlightCheck.MOVING_EXEMPT.remove(uuid);
|
||||||
|
NoSlowCheck.LAST_RELEASE.remove(uuid);
|
||||||
|
NoSlowCheck.VIOLATIONS.remove(uuid);
|
||||||
|
SpeedCheck.PREDICT_BUFFER.remove(uuid);
|
||||||
|
SpeedCheck.AIRSPEED_BUFFER.remove(uuid);
|
||||||
|
SpeedCheck.AIRACCELERATION_BUFFER.remove(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckResult checkFastBow(Player player, float force) {
|
public Magic getMagic() {
|
||||||
|
return magic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CheckResult checkFastBow(final Player player, final float force) {
|
||||||
// Ignore magic numbers here, they are minecrafty vanilla stuff.
|
// Ignore magic numbers here, they are minecrafty vanilla stuff.
|
||||||
if (!bowWindUp.containsKey(player.getUniqueId())) {
|
if (!this.bowWindUp.containsKey(player.getUniqueId())) {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
int ticks = (int) ((((System.currentTimeMillis() - bowWindUp.get(player.getUniqueId())) * 20) / 1000) + 3);
|
|
||||||
bowWindUp.remove(player.getUniqueId());
|
final int ticks = (int) ((((System.currentTimeMillis() - bowWindUp.get(player.getUniqueId())) * 20) / 1000) + 3);
|
||||||
float f = (float) ticks / 20.0F;
|
this.bowWindUp.remove(player.getUniqueId());
|
||||||
f = (f * f + f * 2.0F) / 3.0F;
|
float target = (float) ticks / 20.0F;
|
||||||
f = f > 1.0F ? 1.0F : f;
|
target = (target * target + target * 2.0F) / 3.0F;
|
||||||
double bowError = checksConfig.getDouble(CheckType.FAST_BOW, "bowError");
|
target = target > 1.0F ? 1.0F : target;
|
||||||
if (Math.abs(force - f) > bowError) {
|
final double bowError = checksConfig.getDouble(CheckType.FAST_BOW, "bowError");
|
||||||
|
if (Math.abs(force - target) > bowError) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
"fired their bow too fast (actual force=" + force + ", calculated force=" + f + ")");
|
"fired their bow too fast (force=" + force + ", target=" + target + ")");
|
||||||
} else {
|
} else {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckResult checkProjectile(Player player) {
|
public CheckResult checkProjectile(final Player player) {
|
||||||
incrementOld(player, projectilesShot, 10);
|
incrementOld(player, this.projectilesShot, 10);
|
||||||
int projectilesToWait = checksConfig.getInteger(CheckType.FAST_PROJECTILE, "projectilesToWait");
|
final int projectilesToWait = checksConfig.getInteger(CheckType.FAST_PROJECTILE, "projectilesToWait");
|
||||||
if (!projectileTime.containsKey(player.getUniqueId())) {
|
if (!this.projectileTime.containsKey(player.getUniqueId())) {
|
||||||
projectileTime.put(player.getUniqueId(), System.currentTimeMillis());
|
this.projectileTime.put(player.getUniqueId(), System.currentTimeMillis());
|
||||||
return new CheckResult(CheckResult.Result.PASSED);
|
return new CheckResult(CheckResult.Result.PASSED);
|
||||||
} else if (projectilesShot.get(player.getUniqueId()) == projectilesToWait) {
|
} else if (this.projectilesShot.get(player.getUniqueId()) == projectilesToWait) {
|
||||||
long time = System.currentTimeMillis() - projectileTime.get(player.getUniqueId());
|
final long time = System.currentTimeMillis() - this.projectileTime.get(player.getUniqueId());
|
||||||
int minimumTime = checksConfig.getInteger(CheckType.FAST_PROJECTILE, "minimumTime");
|
final int minimumTime = this.checksConfig.getInteger(CheckType.FAST_PROJECTILE, "minimumTime");
|
||||||
projectileTime.remove(player.getUniqueId());
|
this.projectileTime.remove(player.getUniqueId());
|
||||||
projectilesShot.remove(player.getUniqueId());
|
this.projectilesShot.remove(player.getUniqueId());
|
||||||
if (time < minimumTime) {
|
if (time < minimumTime) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
"wound up a bow too fast (actual time=" + time + ", min time=" + minimumTime + ")");
|
"wound up a bow too fast (actual time=" + time + ", min time=" + minimumTime + ")");
|
||||||
@@ -213,10 +201,12 @@ public class Backend {
|
|||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckResult checkSpider(Player player, double y) {
|
public CheckResult checkSpider(final Player player, final double y) {
|
||||||
if (y <= 0.11761 && y >= 0.11759 && !Utilities.isClimbableBlock(player.getLocation().getBlock())
|
if (y <= 0.11761 && y >= 0.11759 && !Utilities.isClimbableBlock(player.getLocation().getBlock())
|
||||||
&& !Utilities.isClimbableBlock(player.getEyeLocation().getBlock())
|
&& !Utilities.isClimbableBlock(player.getEyeLocation().getBlock())
|
||||||
&& !Utilities.isClimbableBlock(player.getLocation().clone().add(0, -0.98, 0).getBlock())) {
|
&& !Utilities.isClimbableBlock(player.getLocation().clone().add(0, -0.98, 0).getBlock())
|
||||||
|
&& !Utilities.isNearClimbable(player)
|
||||||
|
&& !player.isGliding()) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
"tried to climb a non-climbable block (" + player.getLocation().getBlock().getType() + ")");
|
"tried to climb a non-climbable block (" + player.getLocation().getBlock().getType() + ")");
|
||||||
} else {
|
} else {
|
||||||
@@ -224,47 +214,19 @@ public class Backend {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckResult checkNoFall(Player player, double y) {
|
public CheckResult checkSneakToggle(final Player player) {
|
||||||
UUID uuid = player.getUniqueId();
|
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
if (player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping()
|
|
||||||
&& !isMovingExempt(player) && !justPlaced(player) && !Utilities.isNearWater(player)
|
|
||||||
&& !Utilities.isInWeb(player) && !player.getLocation().getBlock().getType().name().endsWith("TRAPDOOR")
|
|
||||||
&& !VersionUtil.isSlowFalling(player)) {
|
|
||||||
if (player.getFallDistance() == 0) {
|
|
||||||
if (nofallViolation.get(uuid) == null) {
|
|
||||||
nofallViolation.put(uuid, 1);
|
|
||||||
} else {
|
|
||||||
nofallViolation.put(uuid, nofallViolation.get(player.getUniqueId()) + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
int i = nofallViolation.get(uuid);
|
|
||||||
int vlBeforeFlag = checksConfig.getInteger(CheckType.NOFALL, "vlBeforeFlag");
|
|
||||||
if (i >= vlBeforeFlag) {
|
|
||||||
nofallViolation.put(player.getUniqueId(), 1);
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "tried to avoid fall damage (fall distance = 0 "
|
|
||||||
+ i + " times in a row, max=" + vlBeforeFlag + ")");
|
|
||||||
} else {
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
nofallViolation.put(uuid, 0);
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CheckResult checkSneakToggle(Player player) {
|
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
|
||||||
final long lastSneak = this.lastSneak.getOrDefault(player.getUniqueId(), (long) 0);
|
final long lastSneak = this.lastSneak.getOrDefault(player.getUniqueId(), (long) 0);
|
||||||
this.lastSneak.put(player.getUniqueId(), System.currentTimeMillis());
|
this.lastSneak.put(player.getUniqueId(), System.currentTimeMillis());
|
||||||
if (System.currentTimeMillis() - lastSneak < checksConfig.getInteger(CheckType.SNEAK, "minToggleTime")
|
if (System.currentTimeMillis() - lastSneak < checksConfig.getInteger(CheckType.SNEAK, "minToggleTime")
|
||||||
&& (AntiCheatReloaded.getPlugin().getTPS() > checksConfig.getInteger(CheckType.SNEAK, "minimumTps"))) {
|
&& (AntiCheatReloaded.getPlugin().getTPS() > checksConfig.getInteger(CheckType.SNEAK, "minimumTps"))) {
|
||||||
if (user.isLagging() && checksConfig.getBoolean(CheckType.SNEAK, "disableForLagging"))
|
if (user.isLagging() && checksConfig.getBoolean(CheckType.SNEAK, "disableForLagging")) {
|
||||||
return PASS;
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.silentMode())
|
if (!silentMode()) {
|
||||||
player.teleport(user.getGoodLocation(player.getLocation()));
|
player.teleport(user.getGoodLocation(player.getLocation()));
|
||||||
|
}
|
||||||
|
|
||||||
return new CheckResult(Result.FAILED,
|
return new CheckResult(Result.FAILED,
|
||||||
"toggled sneak too fast (time=" + (System.currentTimeMillis() - lastSneak) + ")");
|
"toggled sneak too fast (time=" + (System.currentTimeMillis() - lastSneak) + ")");
|
||||||
@@ -272,9 +234,9 @@ public class Backend {
|
|||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckResult checkSprintHungry(PlayerToggleSprintEvent event) {
|
public CheckResult checkSprintHungry(final PlayerToggleSprintEvent event) {
|
||||||
Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
int sprintFoodMin = checksConfig.getInteger(CheckType.SPRINT, "sprintFoodMin");
|
final int sprintFoodMin = checksConfig.getInteger(CheckType.SPRINT, "sprintFoodMin");
|
||||||
if (event.isSprinting() && player.getGameMode() != GameMode.CREATIVE
|
if (event.isSprinting() && player.getGameMode() != GameMode.CREATIVE
|
||||||
&& player.getFoodLevel() <= sprintFoodMin) {
|
&& player.getFoodLevel() <= sprintFoodMin) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
@@ -284,16 +246,16 @@ public class Backend {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckResult checkVClip(Player player, Distance distance) {
|
public CheckResult checkVClip(final Player player, final Distance distance) {
|
||||||
double from = Math.round(distance.fromY());
|
final double from = Math.round(distance.fromY());
|
||||||
double to = Math.round(distance.toY());
|
final double to = Math.round(distance.toY());
|
||||||
|
|
||||||
if (player.isInsideVehicle() || (from == to || from < to) || Math.round(distance.getYDifference()) < 2) {
|
if (player.isInsideVehicle() || (from == to || from < to) || Math.round(distance.getYDifference()) < 2) {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < (Math.round(distance.getYDifference())) + 1; i++) {
|
for (int i = 0; i < (Math.round(distance.getYDifference())) + 1; i++) {
|
||||||
Block block = new Location(player.getWorld(), player.getLocation().getX(), to + i,
|
final Block block = new Location(player.getWorld(), player.getLocation().getX(), to + i,
|
||||||
player.getLocation().getZ()).getBlock();
|
player.getLocation().getZ()).getBlock();
|
||||||
if (block.getType() != Material.AIR && block.getType().isSolid()) {
|
if (block.getType() != Material.AIR && block.getType().isSolid()) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "tried to move through a solid block",
|
return new CheckResult(CheckResult.Result.FAILED, "tried to move through a solid block",
|
||||||
@@ -304,29 +266,20 @@ public class Backend {
|
|||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logAscension(Player player, double y1, double y2) {
|
public CheckResult checkFastPlace(final Player player) {
|
||||||
UUID name = player.getUniqueId();
|
final int vlBeforeFlagSurvival = checksConfig.getInteger(CheckType.FAST_PLACE, "vlBeforeFlagSurvival");
|
||||||
if (y1 < y2 && !isAscending.contains(name)) {
|
final int vlBeforeFlagCreative = checksConfig.getInteger(CheckType.FAST_PLACE, "vlBeforeFlagCreative");
|
||||||
isAscending.add(name);
|
final int blockPlacementTime = checksConfig.getInteger(CheckType.FAST_PLACE, "blockPlacementTime");
|
||||||
} else {
|
final int violations = player.getGameMode() == GameMode.CREATIVE ? vlBeforeFlagCreative : vlBeforeFlagSurvival;
|
||||||
isAscending.remove(name);
|
final long time = System.currentTimeMillis();
|
||||||
}
|
final UUID uuid = player.getUniqueId();
|
||||||
}
|
|
||||||
|
|
||||||
public CheckResult checkFastPlace(Player player) {
|
|
||||||
int vlBeforeFlagSurvival = checksConfig.getInteger(CheckType.FAST_PLACE, "vlBeforeFlagSurvival");
|
|
||||||
int vlBeforeFlagCreative = checksConfig.getInteger(CheckType.FAST_PLACE, "vlBeforeFlagCreative");
|
|
||||||
int blockPlacementTime = checksConfig.getInteger(CheckType.FAST_PLACE, "blockPlacementTime");
|
|
||||||
int violations = player.getGameMode() == GameMode.CREATIVE ? vlBeforeFlagCreative : vlBeforeFlagSurvival;
|
|
||||||
long time = System.currentTimeMillis();
|
|
||||||
UUID uuid = player.getUniqueId();
|
|
||||||
if (!lastBlockPlaceTime.containsKey(uuid) || !fastPlaceViolation.containsKey(uuid)) {
|
if (!lastBlockPlaceTime.containsKey(uuid) || !fastPlaceViolation.containsKey(uuid)) {
|
||||||
lastBlockPlaceTime.put(uuid, 0L);
|
lastBlockPlaceTime.put(uuid, 0L);
|
||||||
if (!fastPlaceViolation.containsKey(uuid)) {
|
if (!fastPlaceViolation.containsKey(uuid)) {
|
||||||
fastPlaceViolation.put(uuid, 0);
|
fastPlaceViolation.put(uuid, 0);
|
||||||
}
|
}
|
||||||
} else if (fastPlaceViolation.containsKey(uuid) && fastPlaceViolation.get(uuid) > violations) {
|
} else if (fastPlaceViolation.containsKey(uuid) && fastPlaceViolation.get(uuid) > violations) {
|
||||||
Long math = System.currentTimeMillis() - lastBlockPlaced.get(uuid);
|
final long math = System.currentTimeMillis() - lastBlockPlaced.get(uuid);
|
||||||
if (lastBlockPlaced.get(uuid) > 0 && math < blockPlacementTime) {
|
if (lastBlockPlaced.get(uuid) > 0 && math < blockPlacementTime) {
|
||||||
lastBlockPlaced.put(uuid, time);
|
lastBlockPlaced.put(uuid, time);
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "placed blocks too fast "
|
return new CheckResult(CheckResult.Result.FAILED, "placed blocks too fast "
|
||||||
@@ -335,10 +288,10 @@ public class Backend {
|
|||||||
fastPlaceViolation.put(uuid, 0);
|
fastPlaceViolation.put(uuid, 0);
|
||||||
}
|
}
|
||||||
} else if (lastBlockPlaced.containsKey(uuid)) {
|
} else if (lastBlockPlaced.containsKey(uuid)) {
|
||||||
long last = lastBlockPlaced.get(uuid);
|
final long last = lastBlockPlaced.get(uuid);
|
||||||
long lastTime = lastBlockPlaceTime.get(uuid);
|
final long lastTime = lastBlockPlaceTime.get(uuid);
|
||||||
long thisTime = time - last;
|
final long thisTime = time - last;
|
||||||
int minimumTime = checksConfig.getInteger(CheckType.FAST_PLACE, "minimumTime");
|
final int minimumTime = checksConfig.getInteger(CheckType.FAST_PLACE, "minimumTime");
|
||||||
|
|
||||||
if (lastTime != 0 && thisTime < minimumTime) {
|
if (lastTime != 0 && thisTime < minimumTime) {
|
||||||
lastBlockPlaceTime.put(uuid, (time - last));
|
lastBlockPlaceTime.put(uuid, (time - last));
|
||||||
@@ -353,42 +306,42 @@ public class Backend {
|
|||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logBowWindUp(Player player) {
|
public void logBowWindUp(final Player player) {
|
||||||
bowWindUp.put(player.getUniqueId(), System.currentTimeMillis());
|
bowWindUp.put(player.getUniqueId(), System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logEatingStart(Player player) {
|
public void logEatingStart(final Player player) {
|
||||||
startEat.put(player.getUniqueId(), System.currentTimeMillis());
|
startEat.put(player.getUniqueId(), System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEating(Player player) {
|
public boolean isEating(final Player player) {
|
||||||
return startEat.containsKey(player.getUniqueId())
|
return startEat.containsKey(player.getUniqueId())
|
||||||
&& startEat.get(player.getUniqueId()) < checksConfig.getInteger(CheckType.FAST_EAT, "eatTimeMin");
|
&& startEat.get(player.getUniqueId()) < checksConfig.getInteger(CheckType.FAST_EAT, "eatTimeMin");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logHeal(Player player) {
|
public void logHeal(final Player player) {
|
||||||
lastHeal.put(player.getUniqueId(), System.currentTimeMillis());
|
lastHeal.put(player.getUniqueId(), System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckResult checkChatSpam(Player player, String msg) {
|
public CheckResult checkChatSpam(final Player player, final String msg) {
|
||||||
UUID uuid = player.getUniqueId();
|
final UUID uuid = player.getUniqueId();
|
||||||
User user = manager.getUserManager().getUser(uuid);
|
final User user = manager.getUserManager().getUser(uuid);
|
||||||
if (user.getLastMessageTime() != -1) {
|
if (user.getLastMessageTime() != -1) {
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
String m = user.getMessage(i);
|
final String message = user.getMessage(i);
|
||||||
if (m == null) {
|
if (message == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Long l = user.getMessageTime(i);
|
final long messageTime = user.getMessageTime(i);
|
||||||
|
|
||||||
int repeatIgnore = checksConfig.getInteger(CheckType.CHAT_SPAM, "repeatIgnore");
|
final int repeatIgnore = checksConfig.getInteger(CheckType.CHAT_SPAM, "repeatIgnore");
|
||||||
if (System.currentTimeMillis() - l > repeatIgnore) {
|
if (System.currentTimeMillis() - messageTime > repeatIgnore) {
|
||||||
user.clearMessages();
|
user.clearMessages();
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
int timeMin = checksConfig.getInteger(CheckType.CHAT_SPAM, "timeMin");
|
final int timeMin = checksConfig.getInteger(CheckType.CHAT_SPAM, "timeMin");
|
||||||
if (manager.getConfiguration().getConfig().blockChatSpamRepetition.getValue()
|
if (manager.getConfiguration().getConfig().blockChatSpamRepetition.getValue()
|
||||||
&& m.equalsIgnoreCase(msg) && i == 1) {
|
&& message.equalsIgnoreCase(msg) && i == 1) {
|
||||||
manager.getLoggingManager().logFineInfo(player.getName() + " spam-repeated \"" + msg + "\"");
|
manager.getLoggingManager().logFineInfo(player.getName() + " spam-repeated \"" + msg + "\"");
|
||||||
return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING());
|
return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING());
|
||||||
} else if (manager.getConfiguration().getConfig().blockChatSpamSpeed.getValue()
|
} else if (manager.getConfiguration().getConfig().blockChatSpamSpeed.getValue()
|
||||||
@@ -403,9 +356,9 @@ public class Backend {
|
|||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckResult checkChatUnicode(Player player, String msg) {
|
public CheckResult checkChatUnicode(final Player player, final String msg) {
|
||||||
UUID uuid = player.getUniqueId();
|
final UUID uuid = player.getUniqueId();
|
||||||
User user = manager.getUserManager().getUser(uuid);
|
final User user = manager.getUserManager().getUser(uuid);
|
||||||
for (char ch : msg.toCharArray()) {
|
for (char ch : msg.toCharArray()) {
|
||||||
if (Character.UnicodeBlock.of(ch) != Character.UnicodeBlock.BASIC_LATIN
|
if (Character.UnicodeBlock.of(ch) != Character.UnicodeBlock.BASIC_LATIN
|
||||||
&& Character.UnicodeBlock.of(ch) != Character.UnicodeBlock.LATIN_1_SUPPLEMENT
|
&& Character.UnicodeBlock.of(ch) != Character.UnicodeBlock.LATIN_1_SUPPLEMENT
|
||||||
@@ -420,25 +373,25 @@ public class Backend {
|
|||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckResult checkCommandSpam(Player player, String cmd) {
|
public CheckResult checkCommandSpam(final Player player, final String cmd) {
|
||||||
UUID uuid = player.getUniqueId();
|
final UUID uuid = player.getUniqueId();
|
||||||
User user = manager.getUserManager().getUser(uuid);
|
final User user = manager.getUserManager().getUser(uuid);
|
||||||
if (user.getLastCommandTime() != -1) {
|
if (user.getLastCommandTime() != -1) {
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
String m = user.getCommand(i);
|
final String command = user.getCommand(i);
|
||||||
if (m == null) {
|
if (command == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Long l = user.getCommandTime(i);
|
final long commandTime = user.getCommandTime(i);
|
||||||
|
|
||||||
int repeatIgnore = checksConfig.getInteger(CheckType.COMMAND_SPAM, "repeatIgnore");
|
final int repeatIgnore = checksConfig.getInteger(CheckType.COMMAND_SPAM, "repeatIgnore");
|
||||||
if (System.currentTimeMillis() - l > repeatIgnore) {
|
if (System.currentTimeMillis() - commandTime > repeatIgnore) {
|
||||||
user.clearCommands();
|
user.clearCommands();
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
int timeMin = checksConfig.getInteger(CheckType.COMMAND_SPAM, "timeMin");
|
final int timeMin = checksConfig.getInteger(CheckType.COMMAND_SPAM, "timeMin");
|
||||||
if (manager.getConfiguration().getConfig().blockCommandSpamRepetition.getValue()
|
if (manager.getConfiguration().getConfig().blockCommandSpamRepetition.getValue()
|
||||||
&& m.equalsIgnoreCase(cmd) && i == 1) {
|
&& command.equalsIgnoreCase(cmd) && i == 1) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING());
|
return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING());
|
||||||
} else if (manager.getConfiguration().getConfig().blockCommandSpamSpeed.getValue()
|
} else if (manager.getConfiguration().getConfig().blockCommandSpamSpeed.getValue()
|
||||||
&& System.currentTimeMillis() - user.getLastCommandTime() < timeMin) {
|
&& System.currentTimeMillis() - user.getLastCommandTime() < timeMin) {
|
||||||
@@ -451,22 +404,24 @@ public class Backend {
|
|||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckResult checkInventoryClicks(Player player) {
|
public CheckResult checkInventoryClicks(final Player player) {
|
||||||
if (player.getGameMode() == GameMode.CREATIVE) {
|
if (player.getGameMode() == GameMode.CREATIVE) {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
UUID uuid = player.getUniqueId();
|
|
||||||
|
final UUID uuid = player.getUniqueId();
|
||||||
int clicks = 1;
|
int clicks = 1;
|
||||||
if (inventoryClicks.containsKey(uuid)) {
|
if (inventoryClicks.containsKey(uuid)) {
|
||||||
clicks = inventoryClicks.get(uuid) + 1;
|
clicks = inventoryClicks.get(uuid) + 1;
|
||||||
}
|
}
|
||||||
inventoryClicks.put(uuid, clicks);
|
inventoryClicks.put(uuid, clicks);
|
||||||
int clicksToWait = checksConfig.getInteger(CheckType.FAST_INVENTORY, "clicksToWait");
|
|
||||||
|
final int clicksToWait = checksConfig.getInteger(CheckType.FAST_INVENTORY, "clicksToWait");
|
||||||
if (clicks == 1) {
|
if (clicks == 1) {
|
||||||
inventoryTime.put(uuid, System.currentTimeMillis());
|
inventoryTime.put(uuid, System.currentTimeMillis());
|
||||||
} else if (clicks == clicksToWait) {
|
} else if (clicks == clicksToWait) {
|
||||||
int minimumTime = checksConfig.getInteger(CheckType.FAST_INVENTORY, "clicksToWait");
|
final int minimumTime = checksConfig.getInteger(CheckType.FAST_INVENTORY, "clicksToWait");
|
||||||
long time = System.currentTimeMillis() - inventoryTime.get(uuid);
|
final long time = System.currentTimeMillis() - inventoryTime.get(uuid);
|
||||||
inventoryClicks.put(uuid, 0);
|
inventoryClicks.put(uuid, 0);
|
||||||
if (time < minimumTime) {
|
if (time < minimumTime) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "clicked inventory slots " + clicks + " times in "
|
return new CheckResult(CheckResult.Result.FAILED, "clicked inventory slots " + clicks + " times in "
|
||||||
@@ -476,20 +431,20 @@ public class Backend {
|
|||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckResult checkFastHeal(Player player) {
|
public CheckResult checkFastHeal(final Player player) {
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
if (lastHeal.containsKey(player.getUniqueId())) // Otherwise it was modified by a plugin, don't worry about it.
|
if (lastHeal.containsKey(player.getUniqueId())) // Otherwise it was modified by a plugin, don't worry about it.
|
||||||
{
|
{
|
||||||
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
final double tps = AntiCheatReloaded.getPlugin().getTPS();
|
||||||
if (tps < checksConfig.getDouble(CheckType.FAST_HEAL, "minimumTps")
|
if (tps < checksConfig.getDouble(CheckType.FAST_HEAL, "minimumTps")
|
||||||
|| (user.isLagging() && checksConfig.getBoolean(CheckType.FAST_HEAL, "disableForLagging"))) {
|
|| (user.isLagging() && checksConfig.getBoolean(CheckType.FAST_HEAL, "disableForLagging"))) {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
long minHealTime = checksConfig.getInteger(CheckType.FAST_HEAL, "minHealTime");
|
final long minHealTime = checksConfig.getInteger(CheckType.FAST_HEAL, "minHealTime");
|
||||||
long lastHealTime = lastHeal.get(player.getUniqueId());
|
final long lastHealTime = lastHeal.get(player.getUniqueId());
|
||||||
int ping = user.getPing();
|
final int ping = user.getPing();
|
||||||
double pingCompensation = checksConfig.getInteger(CheckType.FAST_HEAL, "pingCompensation");
|
final double pingCompensation = checksConfig.getInteger(CheckType.FAST_HEAL, "pingCompensation");
|
||||||
long allowedHealTime = (long) (minHealTime - (ping * pingCompensation));
|
final long allowedHealTime = (long) (minHealTime - (ping * pingCompensation));
|
||||||
lastHeal.remove(player.getUniqueId());
|
lastHeal.remove(player.getUniqueId());
|
||||||
if ((System.currentTimeMillis() - lastHealTime) < allowedHealTime) {
|
if ((System.currentTimeMillis() - lastHealTime) < allowedHealTime) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "healed too quickly (time="
|
return new CheckResult(CheckResult.Result.FAILED, "healed too quickly (time="
|
||||||
@@ -499,16 +454,16 @@ public class Backend {
|
|||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckResult checkFastEat(Player player) {
|
public CheckResult checkFastEat(final Player player) {
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
if (startEat.containsKey(player.getUniqueId())) // Otherwise it was modified by a plugin, don't worry about it.
|
if (startEat.containsKey(player.getUniqueId())) // Otherwise it was modified by a plugin, don't worry about it.
|
||||||
{
|
{
|
||||||
if (AntiCheatReloaded.getPlugin().getTPS() < 17.5 || user.isLagging()) {
|
if (AntiCheatReloaded.getPlugin().getTPS() < 17.5 || user.isLagging()) {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
long l = startEat.get(player.getUniqueId());
|
final long l = startEat.get(player.getUniqueId());
|
||||||
startEat.remove(player.getUniqueId());
|
startEat.remove(player.getUniqueId());
|
||||||
int eatTimeMin = checksConfig.getInteger(CheckType.FAST_EAT, "eatTimeMin");
|
final int eatTimeMin = checksConfig.getInteger(CheckType.FAST_EAT, "eatTimeMin");
|
||||||
if ((System.currentTimeMillis() - l) < eatTimeMin) {
|
if ((System.currentTimeMillis() - l) < eatTimeMin) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "ate too quickly (time="
|
return new CheckResult(CheckResult.Result.FAILED, "ate too quickly (time="
|
||||||
+ (System.currentTimeMillis() - l) + " ms, min=" + eatTimeMin + " ms)");
|
+ (System.currentTimeMillis() - l) + " ms, min=" + eatTimeMin + " ms)");
|
||||||
@@ -521,86 +476,25 @@ public class Backend {
|
|||||||
sprinted.put(player.getUniqueId(), System.currentTimeMillis());
|
sprinted.put(player.getUniqueId(), System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logBlockBreak(final Player player) {
|
|
||||||
brokenBlock.put(player.getUniqueId(), System.currentTimeMillis());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean justBroke(Player player) {
|
|
||||||
// TODO config??
|
|
||||||
return isDoing(player, brokenBlock, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void logVelocity(final Player player) {
|
|
||||||
velocitized.put(player.getUniqueId(), System.currentTimeMillis());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void logLevitating(final Player player, final int duration) {
|
public void logLevitating(final Player player, final int duration) {
|
||||||
levitatingEnd.put(player.getUniqueId(), System.currentTimeMillis() + (duration * 1000L));
|
levitatingEnd.put(player.getUniqueId(), System.currentTimeMillis() + (duration * 1000L));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean justVelocity(Player player) {
|
public boolean justLevitated(final Player player) {
|
||||||
return (velocitized.containsKey(player.getUniqueId())
|
|
||||||
? (System.currentTimeMillis() - velocitized.get(player.getUniqueId())) < magic.VELOCITY_TIME()
|
|
||||||
: false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean justLevitated(Player player) {
|
|
||||||
return (levitatingEnd.containsKey(player.getUniqueId())
|
return (levitatingEnd.containsKey(player.getUniqueId())
|
||||||
? (System.currentTimeMillis() - levitatingEnd.get(player.getUniqueId())) < magic.VELOCITY_TIME()
|
? (System.currentTimeMillis() - levitatingEnd.get(player.getUniqueId())) < magic.VELOCITY_TIME()
|
||||||
: false);
|
: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean extendVelocityTime(final Player player) {
|
|
||||||
if (velocitytrack.containsKey(player.getUniqueId())) {
|
|
||||||
velocitytrack.put(player.getUniqueId(), velocitytrack.get(player.getUniqueId()) + 1);
|
|
||||||
if (velocitytrack.get(player.getUniqueId()) > magic.VELOCITY_MAXTIMES()) {
|
|
||||||
velocitized.put(player.getUniqueId(), System.currentTimeMillis() + magic.VELOCITY_PREVENT());
|
|
||||||
manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(manager.getPlugin(),
|
|
||||||
new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
velocitytrack.put(player.getUniqueId(), 0);
|
|
||||||
}
|
|
||||||
}, magic.VELOCITY_EXTENSION() * 20L);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
velocitytrack.put(player.getUniqueId(), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void logBlockPlace(final Player player) {
|
public void logBlockPlace(final Player player) {
|
||||||
placedBlock.put(player.getUniqueId(), System.currentTimeMillis());
|
placedBlock.put(player.getUniqueId(), System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean justPlaced(Player player) {
|
public boolean justPlaced(final Player player) {
|
||||||
// TODO config??
|
// TODO config??
|
||||||
return isDoing(player, placedBlock, 0.1);
|
return isDoing(player, placedBlock, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logDamage(final Player player, int type) {
|
|
||||||
long time;
|
|
||||||
switch (type) {
|
|
||||||
case 1:
|
|
||||||
time = magic.DAMAGE_TIME();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
time = magic.KNOCKBACK_DAMAGE_TIME();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
time = magic.EXPLOSION_DAMAGE_TIME();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
time = magic.DAMAGE_TIME();
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + time);
|
|
||||||
// Only map in which termination time is calculated beforehand.
|
|
||||||
}
|
|
||||||
|
|
||||||
public void logEnterExit(final Player player) {
|
public void logEnterExit(final Player player) {
|
||||||
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + magic.ENTERED_EXITED_TIME());
|
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + magic.ENTERED_EXITED_TIME());
|
||||||
}
|
}
|
||||||
@@ -609,14 +503,10 @@ public class Backend {
|
|||||||
manager.getUserManager().getUser(player.getUniqueId()).getMovementManager().lastTeleport = System
|
manager.getUserManager().getUser(player.getUniqueId()).getMovementManager().lastTeleport = System
|
||||||
.currentTimeMillis();
|
.currentTimeMillis();
|
||||||
/* Data for fly/speed should be reset */
|
/* Data for fly/speed should be reset */
|
||||||
nofallViolation.remove(player.getUniqueId());
|
NoFallCheck.VIOLATIONS.remove(player.getUniqueId());
|
||||||
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId());
|
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logExitFly(final Player player) {
|
|
||||||
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + magic.EXIT_FLY_TIME());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void logBoatCollision(final Player player) {
|
public void logBoatCollision(final Player player) {
|
||||||
// TODO config??
|
// TODO config??
|
||||||
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + 100 /* 2 ticks */);
|
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + 100 /* 2 ticks */);
|
||||||
@@ -627,15 +517,11 @@ public class Backend {
|
|||||||
MorePacketsCheck.EXEMPT_TIMINGS.put(player.getUniqueId(), System.currentTimeMillis() + magic.JOIN_TIME());
|
MorePacketsCheck.EXEMPT_TIMINGS.put(player.getUniqueId(), System.currentTimeMillis() + magic.JOIN_TIME());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMovingExempt(Player player) {
|
public boolean isMovingExempt(final Player player) {
|
||||||
return isDoing(player, FlightCheck.MOVING_EXEMPT, -1);
|
return isDoing(player, FlightCheck.MOVING_EXEMPT, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAscending(Player player) {
|
public boolean isDoing(final Player player, final Map<UUID, Long> map, final double max) {
|
||||||
return isAscending.contains(player.getUniqueId());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDoing(Player player, Map<UUID, Long> map, double max) {
|
|
||||||
if (map.containsKey(player.getUniqueId())) {
|
if (map.containsKey(player.getUniqueId())) {
|
||||||
if (max != -1) {
|
if (max != -1) {
|
||||||
if (((System.currentTimeMillis() - map.get(player.getUniqueId())) / 1000) > max) {
|
if (((System.currentTimeMillis() - map.get(player.getUniqueId())) / 1000) > max) {
|
||||||
@@ -658,21 +544,22 @@ public class Backend {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasJumpPotion(Player player) {
|
public boolean hasJumpPotion(final Player player) {
|
||||||
return player.hasPotionEffect(PotionEffectType.JUMP);
|
return player.hasPotionEffect(PotionEffectType.JUMP);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasSpeedPotion(Player player) {
|
public boolean hasSpeedPotion(final Player player) {
|
||||||
return player.hasPotionEffect(PotionEffectType.SPEED);
|
return player.hasPotionEffect(PotionEffectType.SPEED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processChatSpammer(Player player) {
|
public void processChatSpammer(final Player player) {
|
||||||
User user = manager.getUserManager().getUser(player.getUniqueId());
|
final User user = manager.getUserManager().getUser(player.getUniqueId());
|
||||||
int level = chatLevel.containsKey(user.getUUID()) ? chatLevel.get(user.getUUID()) : 0;
|
final int level = chatLevel.containsKey(user.getUUID()) ? chatLevel.get(user.getUUID()) : 0;
|
||||||
int levelActionOne = checksConfig.getInteger(CheckType.CHAT_SPAM, "levelActionOne");
|
final int levelActionOne = checksConfig.getInteger(CheckType.CHAT_SPAM, "levelActionOne");
|
||||||
int levelActionTwo = checksConfig.getInteger(CheckType.CHAT_SPAM, "levelActionTwo");
|
final int levelActionTwo = checksConfig.getInteger(CheckType.CHAT_SPAM, "levelActionTwo");
|
||||||
if (player != null && player.isOnline() && level >= levelActionOne) {
|
if (player != null && player.isOnline() && level >= levelActionOne) {
|
||||||
String event = level >= levelActionTwo ? manager.getConfiguration().getConfig().chatSpamActionTwo.getValue()
|
final String event = level >= levelActionTwo
|
||||||
|
? manager.getConfiguration().getConfig().chatSpamActionTwo.getValue()
|
||||||
: manager.getConfiguration().getConfig().chatSpamActionOne.getValue();
|
: manager.getConfiguration().getConfig().chatSpamActionOne.getValue();
|
||||||
manager.getUserManager().execute(manager.getUserManager().getUser(player.getUniqueId()),
|
manager.getUserManager().execute(manager.getUserManager().getUser(player.getUniqueId()),
|
||||||
Utilities.stringToList(event), CheckType.CHAT_SPAM, lang.SPAM_KICK_REASON(),
|
Utilities.stringToList(event), CheckType.CHAT_SPAM, lang.SPAM_KICK_REASON(),
|
||||||
@@ -681,13 +568,13 @@ public class Backend {
|
|||||||
chatLevel.put(user.getUUID(), level + 1);
|
chatLevel.put(user.getUUID(), level + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processCommandSpammer(Player player) {
|
public void processCommandSpammer(final Player player) {
|
||||||
User user = manager.getUserManager().getUser(player.getUniqueId());
|
final User user = manager.getUserManager().getUser(player.getUniqueId());
|
||||||
int level = commandLevel.containsKey(user.getUUID()) ? commandLevel.get(user.getUUID()) : 0;
|
final int level = commandLevel.containsKey(user.getUUID()) ? commandLevel.get(user.getUUID()) : 0;
|
||||||
int levelActionOne = checksConfig.getInteger(CheckType.COMMAND_SPAM, "levelActionOne");
|
final int levelActionOne = checksConfig.getInteger(CheckType.COMMAND_SPAM, "levelActionOne");
|
||||||
int levelActionTwo = checksConfig.getInteger(CheckType.COMMAND_SPAM, "levelActionTwo");
|
final int levelActionTwo = checksConfig.getInteger(CheckType.COMMAND_SPAM, "levelActionTwo");
|
||||||
if (player != null && player.isOnline() && level >= levelActionOne) {
|
if (player != null && player.isOnline() && level >= levelActionOne) {
|
||||||
String event = level >= levelActionTwo
|
final String event = level >= levelActionTwo
|
||||||
? manager.getConfiguration().getConfig().commandSpamActionTwo.getValue()
|
? manager.getConfiguration().getConfig().commandSpamActionTwo.getValue()
|
||||||
: manager.getConfiguration().getConfig().commandSpamActionOne.getValue();
|
: manager.getConfiguration().getConfig().commandSpamActionOne.getValue();
|
||||||
manager.getUserManager().execute(manager.getUserManager().getUser(player.getUniqueId()),
|
manager.getUserManager().execute(manager.getUserManager().getUser(player.getUniqueId()),
|
||||||
@@ -697,13 +584,13 @@ public class Backend {
|
|||||||
commandLevel.put(user.getUUID(), level + 1);
|
commandLevel.put(user.getUUID(), level + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int increment(Player player, Map<UUID, Integer> map, int num) {
|
public int increment(final Player player, final Map<UUID, Integer> map, final int num) {
|
||||||
UUID name = player.getUniqueId();
|
final UUID name = player.getUniqueId();
|
||||||
if (map.get(name) == null) {
|
if (map.get(name) == null) {
|
||||||
map.put(name, 1);
|
map.put(name, 1);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
int amount = map.get(name) + 1;
|
final int amount = map.get(name) + 1;
|
||||||
if (amount < num + 1) {
|
if (amount < num + 1) {
|
||||||
map.put(name, amount);
|
map.put(name, amount);
|
||||||
return amount;
|
return amount;
|
||||||
@@ -714,13 +601,13 @@ public class Backend {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int incrementOld(Player player, Map<UUID, Integer> map, int num) {
|
public int incrementOld(final Player player, final Map<UUID, Integer> map, final int num) {
|
||||||
UUID uuid = player.getUniqueId();
|
final UUID uuid = player.getUniqueId();
|
||||||
if (map.get(uuid) == null) {
|
if (map.get(uuid) == null) {
|
||||||
map.put(uuid, 1);
|
map.put(uuid, 1);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
int amount = map.get(uuid) + 1;
|
final int amount = map.get(uuid) + 1;
|
||||||
if (amount < num + 1) {
|
if (amount < num + 1) {
|
||||||
map.put(uuid, amount);
|
map.put(uuid, amount);
|
||||||
return amount;
|
return amount;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -26,6 +26,7 @@ public class CheckResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Result result;
|
private Result result;
|
||||||
|
private String subCheck;
|
||||||
private String message;
|
private String message;
|
||||||
private int data;
|
private int data;
|
||||||
|
|
||||||
@@ -34,6 +35,12 @@ public class CheckResult {
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CheckResult(Result result, String subcheck, String message) {
|
||||||
|
this(result);
|
||||||
|
this.subCheck = subcheck;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
public CheckResult(Result result, String message) {
|
public CheckResult(Result result, String message) {
|
||||||
this(result);
|
this(result);
|
||||||
this.message = message;
|
this.message = message;
|
||||||
@@ -46,11 +53,15 @@ public class CheckResult {
|
|||||||
public boolean failed() {
|
public boolean failed() {
|
||||||
return result == Result.FAILED;
|
return result == Result.FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSubCheck() {
|
||||||
|
return subCheck;
|
||||||
|
}
|
||||||
|
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result getResult() {
|
public Result getResult() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,25 +19,24 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.check;
|
package com.rammelkast.anticheatreloaded.check;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.api.CheckFailEvent;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.User;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.api.event.CheckFailEvent;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p/>
|
* <p/>
|
||||||
* All the types of checks and their corresponding permission nodes.
|
* All the types of checks and their corresponding permission nodes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public enum CheckType {
|
public enum CheckType {
|
||||||
FLIGHT(Permission.CHECK_FLIGHT, "Flight"),
|
FLIGHT(Permission.CHECK_FLIGHT, "Flight"),
|
||||||
ELYTRAFLY(Permission.CHECK_FLIGHT, "ElytraFly"),
|
ELYTRAFLY(Permission.CHECK_ELYTRAFLY, "ElytraFly"),
|
||||||
WATER_WALK(Permission.CHECK_WATERWALK, "WaterWalk"),
|
WATER_WALK(Permission.CHECK_WATERWALK, "WaterWalk"),
|
||||||
FAST_PLACE(Permission.CHECK_FASTPLACE, "FastPlace"),
|
FAST_PLACE(Permission.CHECK_FASTPLACE, "FastPlace"),
|
||||||
CHAT_SPAM(Permission.CHECK_CHATSPAM, "ChatSpam"),
|
CHAT_SPAM(Permission.CHECK_CHATSPAM, "ChatSpam"),
|
||||||
@@ -62,7 +61,10 @@ public enum CheckType {
|
|||||||
CHAT_UNICODE(Permission.CHECK_UNICODE, "ChatUnicode"),
|
CHAT_UNICODE(Permission.CHECK_UNICODE, "ChatUnicode"),
|
||||||
ILLEGAL_INTERACT(Permission.CHECK_ILLEGALINTERACT, "IllegalInteract"),
|
ILLEGAL_INTERACT(Permission.CHECK_ILLEGALINTERACT, "IllegalInteract"),
|
||||||
FASTLADDER(Permission.CHECK_FASTLADDER, "FastLadder"),
|
FASTLADDER(Permission.CHECK_FASTLADDER, "FastLadder"),
|
||||||
AIMBOT(Permission.CHECK_AIMBOT, "Aimbot");
|
AIMBOT(Permission.CHECK_AIMBOT, "Aimbot"),
|
||||||
|
STRAFE(Permission.CHECK_STRAFE, "Strafe"),
|
||||||
|
NOSLOW(Permission.CHECK_NOSLOW, "NoSlow"),
|
||||||
|
BOATFLY(Permission.CHECK_BOATFLY, "BoatFly");
|
||||||
|
|
||||||
private final Permission permission;
|
private final Permission permission;
|
||||||
private final String displayName;
|
private final String displayName;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -29,25 +29,27 @@ import com.rammelkast.anticheatreloaded.check.CheckType;
|
|||||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
|
||||||
public class CriticalsCheck {
|
public final class CriticalsCheck {
|
||||||
|
|
||||||
public static void doDamageEvent(EntityDamageByEntityEvent event, Player damager) {
|
public static void doDamageEvent(final EntityDamageByEntityEvent event, final Player damager) {
|
||||||
if (!(event.getDamager() instanceof Player) || event.getCause() != DamageCause.ENTITY_ATTACK)
|
if (!(event.getDamager() instanceof Player) || event.getCause() != DamageCause.ENTITY_ATTACK) {
|
||||||
return;
|
return;
|
||||||
Player player = (Player) event.getDamager();
|
}
|
||||||
|
final Player player = (Player) event.getDamager();
|
||||||
if (isCritical(player)) {
|
if (isCritical(player)) {
|
||||||
if ((player.getLocation().getY() % 1.0 == 0 || player.getLocation().getY() % 0.5 == 0)
|
if ((player.getLocation().getY() % 1.0 == 0 || player.getLocation().getY() % 0.5 == 0)
|
||||||
&& player.getLocation().clone().subtract(0, 1.0, 0).getBlock().getType().isSolid()) {
|
&& player.getLocation().clone().subtract(0, 1.0, 0).getBlock().getType().isSolid()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, "tried to do a critical without needed conditions")
|
EventListener.log(
|
||||||
|
new CheckResult(CheckResult.Result.FAILED, "tried to do a critical without needed conditions")
|
||||||
.getMessage(),
|
.getMessage(),
|
||||||
player, CheckType.CRITICALS);
|
player, CheckType.CRITICALS, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
private static boolean isCritical(Player player) {
|
private static boolean isCritical(final Player player) {
|
||||||
return player.getFallDistance() > 0.0f && !player.isOnGround() && !player.isInsideVehicle()
|
return player.getFallDistance() > 0.0f && !player.isOnGround() && !player.isInsideVehicle()
|
||||||
&& !player.hasPotionEffect(PotionEffectType.BLINDNESS)
|
&& !player.hasPotionEffect(PotionEffectType.BLINDNESS)
|
||||||
&& !Utilities.isHoveringOverWater(player.getLocation())
|
&& !Utilities.isHoveringOverWater(player.getLocation())
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -22,81 +22,119 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.FluidCollisionMode;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.util.RayTraceResult;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import com.google.common.collect.EvictingQueue;
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.MinecraftVersion;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.VersionLib;
|
||||||
|
|
||||||
public class KillAuraCheck {
|
public final class KillAuraCheck {
|
||||||
|
|
||||||
// Angle check
|
// Angle check
|
||||||
public static final Map<UUID, Integer> ANGLE_FLAGS = new HashMap<UUID, Integer>();
|
public static final Map<UUID, Integer> ANGLE_FLAGS = new HashMap<UUID, Integer>();
|
||||||
|
|
||||||
|
// PacketOrder check
|
||||||
|
public static final Map<UUID, Integer> PACKETORDER_FLAGS = new HashMap<UUID, Integer>();
|
||||||
|
|
||||||
|
// ThroughWalls check
|
||||||
|
public static final Map<UUID, Integer> THROUGHWALLS_FLAGS = new HashMap<UUID, Integer>();
|
||||||
|
private static final double RAY_LENGTH = 4.5;
|
||||||
|
|
||||||
|
// Variance check
|
||||||
|
public static final Map<UUID, EvictingQueue<Float>> FACTOR_MAP = new HashMap<UUID, EvictingQueue<Float>>();
|
||||||
|
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static CheckResult checkReach(Player player, Entity target) {
|
public static CheckResult checkReach(final Player player, final Entity target) {
|
||||||
if (!(target instanceof LivingEntity))
|
if (!(target instanceof LivingEntity) || player.getVehicle() != null || target.getVehicle() != null) {
|
||||||
return PASS;
|
return PASS;
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
}
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
|
||||||
|
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
|
||||||
// Check if enabled
|
// Check if enabled
|
||||||
if (!checksConfig.isSubcheckEnabled(CheckType.KILLAURA, "reach"))
|
if (!checksConfig.isSubcheckEnabled(CheckType.KILLAURA, "reach")) {
|
||||||
return PASS;
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
double allowedReach = target.getVelocity().length() < 0.08
|
double allowedReach = target.getVelocity().length() < 0.08
|
||||||
? checksConfig.getDouble(CheckType.KILLAURA, "reach", "baseMaxValue.normal")
|
? checksConfig.getDouble(CheckType.KILLAURA, "reach", "baseMaxValue.normal")
|
||||||
: checksConfig.getDouble(CheckType.KILLAURA, "reach", "baseMaxValue.velocitized");
|
: checksConfig.getDouble(CheckType.KILLAURA, "reach", "baseMaxValue.velocitized");
|
||||||
|
if (player.getGameMode() == GameMode.CREATIVE) {
|
||||||
|
allowedReach += 1.5D;
|
||||||
|
}
|
||||||
// Lag compensation
|
// Lag compensation
|
||||||
double lagExtraReach = checksConfig.getDouble(CheckType.KILLAURA, "reach", "lagCompensation.lagExtraReach");
|
final double lagExtraReach = checksConfig.getDouble(CheckType.KILLAURA, "reach",
|
||||||
double pingCompensation = checksConfig.getDouble(CheckType.KILLAURA, "reach",
|
"lagCompensation.lagExtraReach");
|
||||||
|
final double pingCompensation = checksConfig.getDouble(CheckType.KILLAURA, "reach",
|
||||||
"lagCompensation.pingCompensation");
|
"lagCompensation.pingCompensation");
|
||||||
allowedReach += user.getPing() * pingCompensation;
|
allowedReach += user.getPing() * pingCompensation;
|
||||||
if (user.isLagging())
|
if (user.isLagging()) {
|
||||||
allowedReach += lagExtraReach;
|
allowedReach += lagExtraReach;
|
||||||
|
}
|
||||||
if (target instanceof Player) {
|
if (target instanceof Player) {
|
||||||
User targetUser = AntiCheatReloaded.getManager().getUserManager().getUser(target.getUniqueId());
|
final User targetUser = AntiCheatReloaded.getManager().getUserManager().getUser(target.getUniqueId());
|
||||||
allowedReach += targetUser.getPing() * pingCompensation;
|
allowedReach += targetUser.getPing() * pingCompensation;
|
||||||
if (targetUser.isLagging())
|
if (targetUser.isLagging()) {
|
||||||
allowedReach += lagExtraReach;
|
allowedReach += lagExtraReach;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Velocity compensation
|
// Velocity compensation
|
||||||
double velocityMultiplier = checksConfig.getDouble(CheckType.KILLAURA, "reach", "velocityMultiplier");
|
final double velocityMultiplier = checksConfig.getDouble(CheckType.KILLAURA, "reach", "velocityMultiplier");
|
||||||
allowedReach += Math.abs(target.getVelocity().length()) * velocityMultiplier;
|
allowedReach += Math.abs(target.getVelocity().length()) * velocityMultiplier;
|
||||||
double reachedDistance = ((LivingEntity) target).getLocation().toVector()
|
final double reachedDistance = Utilities.roundDouble(
|
||||||
.distance(player.getLocation().toVector());
|
((LivingEntity) target).getLocation().toVector().distance(player.getLocation().toVector()), 2);
|
||||||
if (reachedDistance > allowedReach)
|
if (reachedDistance > Utilities.roundDouble(allowedReach, 2)) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED, "Reach", "reached too far (distance=" + reachedDistance
|
||||||
"reached too far (distance=" + Utilities.roundDouble(reachedDistance, 6) + ", max=" + Utilities.roundDouble(allowedReach, 6) + ")");
|
+ ", max=" + Utilities.roundDouble(allowedReach, 2) + ")");
|
||||||
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CheckResult checkAngle(Player player, EntityDamageEvent event) {
|
public static CheckResult checkAngle(final Player player, final EntityDamageEvent event) {
|
||||||
UUID uuid = player.getUniqueId();
|
final UUID uuid = player.getUniqueId();
|
||||||
Entity entity = event.getEntity();
|
final Entity entity = event.getEntity();
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
|
||||||
|
// Do not check while in vehicles
|
||||||
|
if (player.getVehicle() != null || entity.getVehicle() != null || VersionLib.isRiptiding(player)) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
|
||||||
// Check if enabled
|
// Check if enabled
|
||||||
if (!checksConfig.isSubcheckEnabled(CheckType.KILLAURA, "angle"))
|
if (!checksConfig.isSubcheckEnabled(CheckType.KILLAURA, "angle")) {
|
||||||
return PASS;
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
if (entity instanceof LivingEntity) {
|
if (entity instanceof LivingEntity) {
|
||||||
LivingEntity living = (LivingEntity) entity;
|
final LivingEntity living = (LivingEntity) entity;
|
||||||
Location eyeLocation = player.getEyeLocation();
|
final Location eyeLocation = player.getEyeLocation();
|
||||||
|
|
||||||
double yawDifference = calculateYawDifference(eyeLocation, living.getLocation());
|
final double yawDifference = calculateYawDifference(eyeLocation, living.getLocation());
|
||||||
double playerYaw = player.getEyeLocation().getYaw();
|
final double playerYaw = player.getEyeLocation().getYaw();
|
||||||
|
|
||||||
double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
|
final double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
|
||||||
int maxDifference = checksConfig.getInteger(CheckType.KILLAURA, "angle", "maxDifference");
|
final int maxDifference = checksConfig.getInteger(CheckType.KILLAURA, "angle", "maxDifference");
|
||||||
if (Math.round(angleDifference) > maxDifference) {
|
if (Math.round(angleDifference) > maxDifference) {
|
||||||
if (!ANGLE_FLAGS.containsKey(uuid)) {
|
if (!ANGLE_FLAGS.containsKey(uuid)) {
|
||||||
ANGLE_FLAGS.put(uuid, 1);
|
ANGLE_FLAGS.put(uuid, 1);
|
||||||
@@ -107,21 +145,174 @@ public class KillAuraCheck {
|
|||||||
int vlBeforeFlag = checksConfig.getInteger(CheckType.KILLAURA, "angle", "vlBeforeFlag");
|
int vlBeforeFlag = checksConfig.getInteger(CheckType.KILLAURA, "angle", "vlBeforeFlag");
|
||||||
if (flags >= vlBeforeFlag) {
|
if (flags >= vlBeforeFlag) {
|
||||||
ANGLE_FLAGS.remove(uuid);
|
ANGLE_FLAGS.remove(uuid);
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED, "Angle",
|
||||||
"tried to attack from an illegal angle (angle=" + Math.round(angleDifference) + ")");
|
"tried to attack from an illegal angle (angle=" + Math.round(angleDifference) + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
ANGLE_FLAGS.put(uuid, flags + 1);
|
ANGLE_FLAGS.put(uuid, flags + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double calculateYawDifference(Location from, Location to) {
|
public static CheckResult checkPacketOrder(final Player player, final Entity entity) {
|
||||||
Location clonedFrom = from.clone();
|
final UUID uuid = player.getUniqueId();
|
||||||
Vector startVector = clonedFrom.toVector();
|
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
||||||
Vector targetVector = to.toVector();
|
final MovementManager movementManager = user.getMovementManager();
|
||||||
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
|
||||||
|
// Check if enabled
|
||||||
|
if (!checksConfig.isSubcheckEnabled(CheckType.KILLAURA, "packetOrder")) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (user.isLagging() || (System.currentTimeMillis() - movementManager.lastTeleport) <= 100 || AntiCheatReloaded
|
||||||
|
.getPlugin().getTPS() < checksConfig.getDouble(CheckType.KILLAURA, "packetOrder", "minimumTps")) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
final long elapsed = System.currentTimeMillis() - movementManager.lastUpdate;
|
||||||
|
if (elapsed < checksConfig.getInteger(CheckType.KILLAURA, "packetOrder", "minElapsedTime")) {
|
||||||
|
if (!PACKETORDER_FLAGS.containsKey(uuid)) {
|
||||||
|
PACKETORDER_FLAGS.put(uuid, 1);
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int flags = PACKETORDER_FLAGS.get(uuid);
|
||||||
|
int vlBeforeFlag = checksConfig.getInteger(CheckType.KILLAURA, "packetOrder", "vlBeforeFlag");
|
||||||
|
if (flags >= vlBeforeFlag) {
|
||||||
|
PACKETORDER_FLAGS.remove(uuid);
|
||||||
|
return new CheckResult(Result.FAILED, "PacketOrder",
|
||||||
|
"suspicious packet order (elapsed=" + elapsed + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
PACKETORDER_FLAGS.put(uuid, flags + 1);
|
||||||
|
}
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CheckResult checkVariance(final Player player) {
|
||||||
|
final UUID uuid = player.getUniqueId();
|
||||||
|
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
||||||
|
final MovementManager movementManager = user.getMovementManager();
|
||||||
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
|
||||||
|
// Check if enabled
|
||||||
|
if (!checksConfig.isSubcheckEnabled(CheckType.KILLAURA, "variance")) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int samples = checksConfig.getInteger(CheckType.KILLAURA, "variance", "samples");
|
||||||
|
if (movementManager.deltaPitch > 0.0f && movementManager.lastDeltaPitch > 0.0f
|
||||||
|
&& movementManager.deltaYaw > 5.0f) {
|
||||||
|
final float factor = movementManager.deltaPitch % movementManager.lastDeltaPitch;
|
||||||
|
final EvictingQueue<Float> queue = FACTOR_MAP.getOrDefault(uuid, EvictingQueue.create(samples));
|
||||||
|
queue.add(factor);
|
||||||
|
if (queue.size() >= samples) {
|
||||||
|
final double variance = Utilities.getVariance(queue);
|
||||||
|
if (variance < 0.25) {
|
||||||
|
FACTOR_MAP.put(uuid, queue);
|
||||||
|
return new CheckResult(Result.FAILED, "Variance",
|
||||||
|
"had suspicous aim behaviour (variance: " + Utilities.roundDouble(variance, 3) + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FACTOR_MAP.put(uuid, queue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CheckResult checkRepeatedAim(final Player player) {
|
||||||
|
final UUID uuid = player.getUniqueId();
|
||||||
|
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
||||||
|
final MovementManager movementManager = user.getMovementManager();
|
||||||
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
|
||||||
|
// Check if enabled
|
||||||
|
if (!checksConfig.isSubcheckEnabled(CheckType.KILLAURA, "repeatedAim")) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
final float deltaYaw = movementManager.deltaYaw;
|
||||||
|
final float lastDeltaYaw = movementManager.lastDeltaYaw;
|
||||||
|
final float deltaPitch = movementManager.deltaPitch;
|
||||||
|
final float lastDeltaPitch = movementManager.lastDeltaPitch;
|
||||||
|
if (deltaYaw > 0.0f && Math.abs(deltaYaw - lastDeltaYaw) < 1e-5 && deltaPitch > 10.0f) {
|
||||||
|
return new CheckResult(Result.FAILED, "RepeatedAim",
|
||||||
|
"repeated aim pattern (type=yaw, deltaPitch=" + Utilities.roundFloat(deltaPitch, 1) + ")");
|
||||||
|
} else if (deltaPitch > 0.0f && Math.abs(deltaPitch - lastDeltaPitch) < 1e-5 && deltaYaw > 12.0f) {
|
||||||
|
return new CheckResult(Result.FAILED, "RepeatedAim",
|
||||||
|
"repeated aim pattern (type=pitch, deltaYaw=" + Utilities.roundFloat(deltaYaw, 1) + ")");
|
||||||
|
}
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CheckResult checkThroughWalls(final Player player, final Entity target) {
|
||||||
|
// TODO this does not work on 1.12.2
|
||||||
|
// Either we finally drop 1.12.2 as well, or we create a workaround
|
||||||
|
// For now we just skip if server version is 1.12.2
|
||||||
|
if (MinecraftVersion.getCurrentVersion().getMinor() <= 12) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
final UUID uuid = player.getUniqueId();
|
||||||
|
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
||||||
|
final MovementManager movementManager = user.getMovementManager();
|
||||||
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
|
||||||
|
// Check if enabled
|
||||||
|
if (!checksConfig.isSubcheckEnabled(CheckType.KILLAURA, "throughWalls")) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((user.isLagging() && checksConfig.getBoolean(CheckType.KILLAURA, "throughWalls", "disableForLagging"))
|
||||||
|
|| (System.currentTimeMillis() - movementManager.lastTeleport) <= 100 || AntiCheatReloaded.getPlugin()
|
||||||
|
.getTPS() < checksConfig.getDouble(CheckType.KILLAURA, "throughWalls", "minimumTps")) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Math.abs(player.getLocation().getPitch()) > 30.0f) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Location eyes = player.getEyeLocation().clone();
|
||||||
|
final World world = player.getWorld();
|
||||||
|
final double expansion = checksConfig.getDouble(CheckType.KILLAURA, "throughWalls", "expand");
|
||||||
|
final RayTraceResult result = world.rayTrace(eyes, eyes.getDirection(), RAY_LENGTH, FluidCollisionMode.NEVER,
|
||||||
|
true, expansion, entity -> entity.equals(target));
|
||||||
|
if (player.getLocation().toVector().clone().setY(0.0)
|
||||||
|
.distance(target.getLocation().toVector().clone().setY(0)) <= expansion) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result != null) {
|
||||||
|
final Block block = result.getHitBlock();
|
||||||
|
final Entity entity = result.getHitEntity();
|
||||||
|
final double distance = result.getHitPosition().distance(eyes.toVector());
|
||||||
|
if (entity == null && block != null && distance > 0.3) {
|
||||||
|
final int flags = THROUGHWALLS_FLAGS.getOrDefault(uuid, 0) + 1;
|
||||||
|
if (flags > checksConfig.getInteger(CheckType.KILLAURA, "throughWalls", "vlBeforeFlag")) {
|
||||||
|
THROUGHWALLS_FLAGS.put(uuid, 0);
|
||||||
|
return new CheckResult(Result.FAILED, "ThroughWalls",
|
||||||
|
"hit through object (distance: " + Utilities.roundDouble(distance, 2) + ", block: "
|
||||||
|
+ block.getType().name().toLowerCase() + ", pitch: "
|
||||||
|
+ Utilities.roundFloat(player.getLocation().getPitch(), 1) + ")");
|
||||||
|
}
|
||||||
|
THROUGHWALLS_FLAGS.put(uuid, flags);
|
||||||
|
} else {
|
||||||
|
final int flags = THROUGHWALLS_FLAGS.getOrDefault(uuid, 1) - 1;
|
||||||
|
THROUGHWALLS_FLAGS.put(uuid, flags);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// TODO should be covered by angle & reach check, but maybe continue anyway?
|
||||||
|
}
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double calculateYawDifference(final Location from, final Location to) {
|
||||||
|
final Location clonedFrom = from.clone();
|
||||||
|
final Vector startVector = clonedFrom.toVector();
|
||||||
|
final Vector targetVector = to.toVector();
|
||||||
clonedFrom.setDirection(targetVector.subtract(startVector));
|
clonedFrom.setDirection(targetVector.subtract(startVector));
|
||||||
return clonedFrom.getYaw();
|
return clonedFrom.getYaw();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -34,34 +34,37 @@ import com.rammelkast.anticheatreloaded.util.MovementManager;
|
|||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
|
||||||
public class VelocityCheck {
|
public final class VelocityCheck {
|
||||||
|
|
||||||
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
|
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, Distance distance) {
|
public static CheckResult runCheck(final Player player, final Distance distance) {
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
MovementManager movementManager = user.getMovementManager();
|
final MovementManager movementManager = user.getMovementManager();
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
final int minimumPercentage = checksConfig.getInteger(CheckType.VELOCITY, "minimumPercentage");
|
final int minimumPercentage = checksConfig.getInteger(CheckType.VELOCITY, "minimumPercentage");
|
||||||
final int vlBeforeFlag = checksConfig.getInteger(CheckType.VELOCITY, "vlBeforeFlag");
|
final int vlBeforeFlag = checksConfig.getInteger(CheckType.VELOCITY, "vlBeforeFlag");
|
||||||
|
|
||||||
if (movementManager.velocityExpectedMotionY > 0 && !movementManager.onGround) {
|
if (movementManager.velocityExpectedMotionY > 0 && !movementManager.onGround) {
|
||||||
double percentage = (movementManager.motionY / movementManager.velocityExpectedMotionY) * 100;
|
double percentage = (movementManager.motionY / movementManager.velocityExpectedMotionY) * 100;
|
||||||
if (percentage < 0)
|
if (percentage < 0) {
|
||||||
percentage = 0;
|
percentage = 0;
|
||||||
|
}
|
||||||
// Reset expected Y motion
|
// Reset expected Y motion
|
||||||
movementManager.velocityExpectedMotionY = 0;
|
movementManager.velocityExpectedMotionY = 0;
|
||||||
if (percentage < minimumPercentage) {
|
if (percentage < minimumPercentage) {
|
||||||
int vl = VIOLATIONS.getOrDefault(player.getUniqueId(), 0) + 1;
|
final int vl = VIOLATIONS.getOrDefault(player.getUniqueId(), 0) + 1;
|
||||||
VIOLATIONS.put(player.getUniqueId(), vl);
|
VIOLATIONS.put(player.getUniqueId(), vl);
|
||||||
if (vl >= vlBeforeFlag)
|
if (vl >= vlBeforeFlag) {
|
||||||
return new CheckResult(Result.FAILED, "ignored server velocity (pct=" + Utilities.roundDouble(percentage, 2) + ")");
|
return new CheckResult(Result.FAILED, "ignored server velocity (pct=" + Utilities.roundDouble(percentage, 2) + ")");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
VIOLATIONS.remove(player.getUniqueId());
|
VIOLATIONS.remove(player.getUniqueId());
|
||||||
}
|
}
|
||||||
} else if (movementManager.airTicks > 5 && movementManager.velocityExpectedMotionY > 0)
|
} else if (movementManager.airTicks > 5 && movementManager.velocityExpectedMotionY > 0) {
|
||||||
movementManager.velocityExpectedMotionY = 0;
|
movementManager.velocityExpectedMotionY = 0;
|
||||||
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,51 +18,51 @@
|
|||||||
*/
|
*/
|
||||||
package com.rammelkast.anticheatreloaded.check.movement;
|
package com.rammelkast.anticheatreloaded.check.movement;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
|
||||||
public class AimbotCheck {
|
public final class AimbotCheck {
|
||||||
|
|
||||||
public static final Map<UUID, Float> LAST_DELTA_YAW = new HashMap<UUID, Float>();
|
private static final double EXPANDER = Math.pow(2, 24);
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, PlayerMoveEvent event) {
|
/**
|
||||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
* This falses sometimes?
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
* TODO we need to check yaw deltas
|
||||||
|
*/
|
||||||
|
public static CheckResult runCheck(final Player player, final EntityDamageByEntityEvent event) {
|
||||||
|
final Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||||
if (backend.isMovingExempt(player)) {
|
if (backend.isMovingExempt(player)) {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID uuid = player.getUniqueId();
|
final User user = AntiCheatReloaded.getManager().getUserManager()
|
||||||
float dYaw = Math.abs(event.getTo().getYaw() - event.getFrom().getYaw());
|
.getUser(player.getUniqueId());
|
||||||
float dPitch = Math.abs(event.getTo().getPitch() - event.getFrom().getPitch());
|
final MovementManager movementManager = user.getMovementManager();
|
||||||
// Not interesting
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
if (dYaw < 0.05 && dPitch < 0.05) {
|
final float deltaPitch = movementManager.deltaPitch;
|
||||||
return PASS;
|
final float pitchAcceleration = Math.abs(deltaPitch - movementManager.lastDeltaPitch);
|
||||||
|
|
||||||
|
final long gcd = Utilities.getGcd((long) (deltaPitch * EXPANDER),
|
||||||
|
(long) (movementManager.lastDeltaPitch * EXPANDER));
|
||||||
|
final double mod = Math.abs(player.getLocation().getPitch() % (gcd / EXPANDER));
|
||||||
|
final double minAcceleration = checksConfig.getDouble(CheckType.AIMBOT, "minAcceleration");
|
||||||
|
final double maxMod = checksConfig.getDouble(CheckType.AIMBOT, "maxMod");
|
||||||
|
if ((gcd > 0L && gcd < 131072L) && mod <= maxMod && pitchAcceleration > minAcceleration && deltaPitch > 5.0f && deltaPitch < 20.0f) {
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
|
"failed computational check (gcd=" + gcd + ", mod="
|
||||||
|
+ Utilities.roundDouble(mod, 5) + ", accel=" + Utilities.roundDouble(pitchAcceleration, 3)
|
||||||
|
+ ", delta=" + Utilities.roundDouble(deltaPitch, 1) + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
final float lastDeltaYaw = LAST_DELTA_YAW.getOrDefault(uuid, -1F);
|
|
||||||
if (lastDeltaYaw == -1F) {
|
|
||||||
LAST_DELTA_YAW.put(uuid, dYaw);
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
LAST_DELTA_YAW.put(uuid, dYaw);
|
|
||||||
|
|
||||||
float absoluteYawDifference = Math.abs(dYaw - lastDeltaYaw);
|
|
||||||
int minYaw = checksConfig.getInteger(CheckType.AIMBOT, "minYaw");
|
|
||||||
int maxYaw = checksConfig.getInteger(CheckType.AIMBOT, "maxYaw");
|
|
||||||
if (absoluteYawDifference < 1E-8 && minYaw > 30 && dYaw < maxYaw)
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "repeated yaw difference (dYaw=" + dYaw + ")");
|
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
|
*
|
||||||
|
* 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 com.rammelkast.anticheatreloaded.check.movement;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.cryptomorin.xseries.XMaterial;
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.VersionLib;
|
||||||
|
|
||||||
|
public final class BoatFlyCheck {
|
||||||
|
|
||||||
|
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
|
||||||
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
|
public static CheckResult runCheck(final Player player, final MovementManager movementManager, final Location to) {
|
||||||
|
if (movementManager.motionY <= 1E-3
|
||||||
|
|| (System.currentTimeMillis() - movementManager.lastTeleport <= 150) || VersionLib.isFlying(player)
|
||||||
|
|| !player.isInsideVehicle()) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
final UUID uuid = player.getUniqueId();
|
||||||
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
if (player.getVehicle().getType() == EntityType.BOAT) {
|
||||||
|
final Block bottom = player.getWorld().getBlockAt(to.getBlockX(), to.getBlockY() - 1, to.getBlockZ());
|
||||||
|
if (!Utilities.cantStandAt(bottom) || bottom.getType() == XMaterial.WATER.parseMaterial()) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int violations = VIOLATIONS.getOrDefault(uuid, 1);
|
||||||
|
if (violations++ >= checksConfig.getInteger(CheckType.BOATFLY, "vlBeforeFlag")) {
|
||||||
|
violations = 0;
|
||||||
|
return new CheckResult(Result.FAILED, "tried to fly in a boat (mY=" + movementManager.motionY
|
||||||
|
+ ", bottom=" + bottom.getType().name().toLowerCase() + ")");
|
||||||
|
}
|
||||||
|
VIOLATIONS.put(uuid, violations);
|
||||||
|
}
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -23,28 +23,31 @@ import java.util.HashMap;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import com.cryptomorin.xseries.XMaterial;
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.util.MinecraftVersion;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
|
||||||
public class ElytraCheck {
|
public final class ElytraCheck {
|
||||||
|
|
||||||
public static final HashMap<UUID, Double> JUMP_Y_VALUE = new HashMap<UUID, Double>();
|
public static final HashMap<UUID, Double> JUMP_Y_VALUE = new HashMap<UUID, Double>();
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, Distance distance) {
|
public static CheckResult runCheck(final Player player, final Distance distance) {
|
||||||
// No elytra in server version
|
// Not relevant
|
||||||
if (VersionUtil.isBountifulUpdate()) {
|
if (Utilities.isNearWater(player)) {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID uuid = player.getUniqueId();
|
final UUID uuid = player.getUniqueId();
|
||||||
if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()) {
|
if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|
||||||
|
|| System.currentTimeMillis() - AntiCheatReloaded.getManager().getUserManager().getUser(uuid)
|
||||||
|
.getMovementManager().lastTeleport <= 500) {
|
||||||
// This was a teleport, so skip check.
|
// This was a teleport, so skip check.
|
||||||
JUMP_Y_VALUE.remove(uuid);
|
JUMP_Y_VALUE.remove(uuid);
|
||||||
return PASS;
|
return PASS;
|
||||||
@@ -55,28 +58,31 @@ public class ElytraCheck {
|
|||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
double changeY = distance.toY() - distance.fromY();
|
final double changeY = distance.toY() - distance.fromY();
|
||||||
boolean upwardMovement = changeY > 0;
|
final boolean upwardMovement = changeY > 0;
|
||||||
if (player.getInventory().getItemInMainHand().getType() == Material.TRIDENT) {
|
if (MinecraftVersion.getCurrentVersion().isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
|
||||||
if (upwardMovement) {
|
// Tident added in 1.13
|
||||||
// TODO continue check here
|
if (player.getInventory().getItemInMainHand().getType() == XMaterial.TRIDENT.parseMaterial()) {
|
||||||
JUMP_Y_VALUE.remove(uuid);
|
if (upwardMovement) {
|
||||||
return PASS;
|
JUMP_Y_VALUE.remove(uuid);
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changeY == 0.0D) {
|
|
||||||
// Seen no false positives here yet
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "had no Y-axis dropoff when gliding with Elytra");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!JUMP_Y_VALUE.containsKey(uuid)) {
|
if (!JUMP_Y_VALUE.containsKey(uuid)) {
|
||||||
JUMP_Y_VALUE.put(uuid, distance.toY());
|
// Distance + player height
|
||||||
|
JUMP_Y_VALUE.put(uuid, distance.toY() + 1.8D);
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
double lastY = JUMP_Y_VALUE.get(uuid);
|
|
||||||
|
final double lastY = JUMP_Y_VALUE.get(uuid);
|
||||||
|
if (changeY == 0.0D && lastY < 9999.99D) {
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "had no Y-axis dropoff when gliding with Elytra");
|
||||||
|
}
|
||||||
|
|
||||||
if (lastY < distance.toY()) {
|
if (lastY < distance.toY()) {
|
||||||
double diff = distance.toY() - lastY;
|
final double diff = distance.toY() - lastY;
|
||||||
if (diff > 0.7675) {
|
if (diff > 0.7675) {
|
||||||
if (!AntiCheatReloaded.getManager().getBackend().silentMode()) {
|
if (!AntiCheatReloaded.getManager().getBackend().silentMode()) {
|
||||||
Location to = player.getLocation();
|
Location to = player.getLocation();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,7 +16,6 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.check.movement;
|
package com.rammelkast.anticheatreloaded.check.movement;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -31,18 +30,19 @@ import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
|||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.VersionLib;
|
||||||
|
|
||||||
public class FastLadderCheck {
|
public final class FastLadderCheck {
|
||||||
|
|
||||||
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
|
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, double y) {
|
public static CheckResult runCheck(Player player, double y) {
|
||||||
// Only check if fully on ladder
|
// Only check if fully on ladder and not flying
|
||||||
// Liquids are climbable blocks, so we have to add a seperate check
|
// Liquids are climbable blocks, so we have to add a seperate check
|
||||||
if (!Utilities.isClimbableBlock(player.getLocation().getBlock())
|
if (!Utilities.isClimbableBlock(player.getLocation().getBlock())
|
||||||
|| !Utilities.isClimbableBlock(player.getEyeLocation().getBlock())
|
|| !Utilities.isClimbableBlock(player.getEyeLocation().getBlock())
|
||||||
|| player.getLocation().getBlock().isLiquid()) {
|
|| player.getLocation().getBlock().isLiquid() || VersionLib.isFlying(player)) {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -22,12 +22,12 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
@@ -35,127 +35,226 @@ import com.rammelkast.anticheatreloaded.util.Distance;
|
|||||||
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.util.VelocityTracker;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.VersionLib;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rammelkast
|
* @author Rammelkast
|
||||||
*/
|
*/
|
||||||
public class FlightCheck {
|
public final class FlightCheck {
|
||||||
|
|
||||||
public static final Map<UUID, Long> MOVING_EXEMPT = new HashMap<UUID, Long>();
|
public static final Map<UUID, Long> MOVING_EXEMPT = new HashMap<UUID, Long>();
|
||||||
public static final Map<UUID, Integer> GRAVITY_VIOLATIONS = new HashMap<UUID, Integer>();
|
public static final Map<UUID, Float> GRAVITY_VIOLATIONS = new HashMap<UUID, Float>();
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
|
||||||
private static final double GRAVITY_FRICTION = 0.9800000190734863D;
|
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, Distance distance) {
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
private static final double GRAVITY_FRICTION = 0.98f;
|
||||||
|
|
||||||
|
public static CheckResult runCheck(final Player player, final Distance distance) {
|
||||||
if (distance.getYDifference() >= AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|
if (distance.getYDifference() >= AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|
||||||
|| VersionUtil.isFlying(player)) {
|
|| VersionLib.isFlying(player) || player.getVehicle() != null
|
||||||
// This was a teleport or user is flying/using elytra, so we don't care
|
|| AntiCheatReloaded.getManager().getBackend().isMovingExempt(player)) {
|
||||||
// about it.
|
// This was a teleport or user is flying/using elytra/in a vehicle, so we don't
|
||||||
|
// care about it.
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
MovementManager movementManager = user.getMovementManager();
|
final MovementManager movementManager = user.getMovementManager();
|
||||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
final VelocityTracker velocityTracker = user.getVelocityTracker();
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
|
||||||
if (Utilities.isNearWater(player) || movementManager.halfMovement
|
if (movementManager.nearLiquidTicks > 0 || movementManager.halfMovement || Utilities.isNearClimbable(player)
|
||||||
|| Utilities.isClimbableBlock(distance.getFrom().getBlock())
|
|| movementManager.riptideTicks > 0) {
|
||||||
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN))
|
|
||||||
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.UP)))
|
|
||||||
return PASS;
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
int minAirTicks = 13;
|
int minAirTicks = 13;
|
||||||
if (player.hasPotionEffect(PotionEffectType.JUMP)) {
|
if (player.hasPotionEffect(PotionEffectType.JUMP)) {
|
||||||
minAirTicks += player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() * 3;
|
minAirTicks += VersionLib.getPotionLevel(player, PotionEffectType.JUMP) * 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (movementManager.halfMovementHistoryCounter > 25)
|
if (movementManager.halfMovementHistoryCounter > 25) {
|
||||||
minAirTicks += 5;
|
minAirTicks += 5;
|
||||||
|
}
|
||||||
|
|
||||||
// Start AirFlight
|
// Start AirFlight
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airFlight") && movementManager.airTicks > minAirTicks
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airFlight") && movementManager.airTicks > minAirTicks
|
||||||
&& !backend.justVelocity(player)) {
|
&& movementManager.elytraEffectTicks <= 25) {
|
||||||
// Config default base is 1200ms
|
// Config default base is 1200ms
|
||||||
// Ping clamped to max. 1000 to prevent spoofing for an advantage
|
// Ping clamped to max. 1000 to prevent spoofing for an advantage
|
||||||
int blockPlaceAccountingTime = (int) (checksConfig.getInteger(CheckType.FLIGHT, "airFlight",
|
int blockPlaceAccountingTime = (int) (checksConfig.getInteger(CheckType.FLIGHT, "airFlight",
|
||||||
"accountForBlockPlacement") + (0.25 * (user.getPing() > 1000 ? 1000 : user.getPing())));
|
"accountForBlockPlacement") + (0.25 * (user.getPing() > 1000 ? 1000 : user.getPing())));
|
||||||
// Config default account is 250ms
|
// Config default account is 250ms
|
||||||
if (AntiCheatReloaded.getPlugin().getTPS() < 18.0)
|
if (AntiCheatReloaded.getPlugin().getTPS() < 18.0) {
|
||||||
blockPlaceAccountingTime += checksConfig.getInteger(CheckType.FLIGHT, "airFlight",
|
blockPlaceAccountingTime += checksConfig.getInteger(CheckType.FLIGHT, "airFlight",
|
||||||
"accountForTpsDrops");
|
"accountForTpsDrops");
|
||||||
long lastPlacedBlock = AntiCheatReloaded.getManager().getBackend().placedBlock
|
}
|
||||||
|
|
||||||
|
final long lastPlacedBlock = AntiCheatReloaded.getManager().getBackend().placedBlock
|
||||||
.containsKey(player.getUniqueId())
|
.containsKey(player.getUniqueId())
|
||||||
? AntiCheatReloaded.getManager().getBackend().placedBlock.get(player.getUniqueId())
|
? AntiCheatReloaded.getManager().getBackend().placedBlock.get(player.getUniqueId())
|
||||||
: (blockPlaceAccountingTime + 1);
|
: (blockPlaceAccountingTime + 1);
|
||||||
double maxMotionY = System.currentTimeMillis() - lastPlacedBlock > blockPlaceAccountingTime ? 0 : 0.42;
|
double maxMotionY = System.currentTimeMillis() - lastPlacedBlock > blockPlaceAccountingTime ? 0 : 0.42;
|
||||||
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0)
|
// Fixes snow false positive
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
if (movementManager.motionY < 0.004 && Utilities
|
||||||
"tried to fly on the Y-axis (mY=" + movementManager.motionY + ", max=" + maxMotionY + ")");
|
.isNearHalfblock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN).getLocation())) {
|
||||||
|
maxMotionY += 0.004D;
|
||||||
|
}
|
||||||
|
|
||||||
if (Math.abs(movementManager.motionY - movementManager.lastMotionY) < 0.01
|
// Fixes water false positive
|
||||||
|
if (Utilities.isNearWater(player)
|
||||||
|
|| Utilities.isNearWater(distance.getFrom().clone().subtract(0, 0.51, 0))) {
|
||||||
|
maxMotionY += 0.05;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Velocity adjustment
|
||||||
|
maxMotionY += velocityTracker.getVertical();
|
||||||
|
|
||||||
|
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0
|
||||||
|
&& !Utilities.isNearClimbable(distance.getTo().clone().subtract(0, 1.25, 0))
|
||||||
|
&& !Utilities.isNearClimbable(distance.getTo().clone().subtract(0, 0.75, 0))
|
||||||
|
&& (!Utilities.isNearWater(distance.getTo().clone().subtract(0, 1.5, 0))
|
||||||
|
&& distance.getTo().clone().subtract(0, 0.5, 0).getBlock().getType() != Material.AIR)) {
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "AirFlight",
|
||||||
|
"tried to fly on the Y-axis (mY=" + Utilities.roundDouble(movementManager.motionY, 4) + ", max=" + Utilities.roundDouble(maxMotionY, 4) + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO falses when falling large distances
|
||||||
|
if (Math.abs(movementManager.motionY
|
||||||
|
- movementManager.lastMotionY) < (movementManager.airTicks >= 115 ? 1E-3 : 5E-3)
|
||||||
&& !Utilities.couldBeOnBoat(player)
|
&& !Utilities.couldBeOnBoat(player)
|
||||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
.getInteger(CheckType.FLIGHT, "airFlight", "accountForTeleports"))
|
.getInteger(CheckType.FLIGHT, "airFlight", "accountForTeleports"))
|
||||||
&& !VersionUtil.isSlowFalling(player) && !Utilities.isInWeb(player))
|
&& !VersionLib.isSlowFalling(player) && !Utilities.isNearWeb(player)
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "had too little Y dropoff (diff="
|
&& movementManager.elytraEffectTicks <= 25
|
||||||
+ Math.abs(movementManager.motionY - movementManager.lastMotionY) + ")");
|
&& !Utilities.isNearClimbable(distance.getFrom().clone().subtract(0, 0.51D, 0))
|
||||||
|
&& !Utilities.isNearWater(player)
|
||||||
|
&& !Utilities.isNearWater(distance.getFrom().clone().subtract(0, 0.51, 0))
|
||||||
|
&& velocityTracker.getVertical() == 0.0) {
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "AirFlight", "had too little Y dropoff (diff="
|
||||||
|
+ Utilities.roundDouble(Math.abs(movementManager.motionY - movementManager.lastMotionY), 4) + ")");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// End AirFlight
|
// End AirFlight
|
||||||
|
|
||||||
// Start AirClimb
|
// Start AirClimb
|
||||||
// TODO two hardcoded values here shouldn't be there, temp against false
|
|
||||||
// positive
|
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.lastMotionY > 0
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.lastMotionY > 0
|
||||||
&& movementManager.motionY > 0 && movementManager.airTicks == 2
|
&& movementManager.motionY > 0 && movementManager.airTicks == 2
|
||||||
&& Math.round(movementManager.lastMotionY * 1000) != 420
|
&& Math.round(movementManager.lastMotionY * 1000) != 420
|
||||||
|
&& Math.round(movementManager.motionY * 1000) != 248
|
||||||
&& !(Math.round(movementManager.motionY * 1000) == 333
|
&& !(Math.round(movementManager.motionY * 1000) == 333
|
||||||
&& Math.round(movementManager.lastMotionY * 1000) != 333)
|
&& Math.round(movementManager.lastMotionY * 1000) != 333)
|
||||||
&& !AntiCheatReloaded.getManager().getBackend().justVelocity(player)
|
&& !velocityTracker.isVelocitized() && !player.hasPotionEffect(PotionEffectType.JUMP)
|
||||||
&& !player.hasPotionEffect(PotionEffectType.JUMP)
|
|
||||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports")))
|
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
&& (!Utilities.isNearBed(distance.getTo()) || ((Utilities.isNearBed(distance.getTo())
|
||||||
"tried to climb air (mY=" + movementManager.motionY + ")");
|
|| Utilities.isNearBed(distance.getTo().clone().add(0, -0.51, 0)))
|
||||||
|
&& movementManager.motionY > 0.15))
|
||||||
|
&& movementManager.slimeInfluenceTicks == 0 && movementManager.elytraEffectTicks <= 25
|
||||||
|
&& !Utilities.couldBeOnBoat(player, 0.8, false)) {
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "AirClimb",
|
||||||
|
"tried to climb air (mY=" + Utilities.roundDouble(movementManager.motionY, 4) + ")");
|
||||||
|
}
|
||||||
|
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.motionY > 0.42
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.motionY > 0.42
|
||||||
&& movementManager.airTicks > 2 && !AntiCheatReloaded.getManager().getBackend().justVelocity(player)
|
&& movementManager.airTicks > 2 && !velocityTracker.isVelocitized()
|
||||||
&& !player.hasPotionEffect(PotionEffectType.JUMP)
|
&& !player.hasPotionEffect(PotionEffectType.JUMP)
|
||||||
|
&& !(Math.round(movementManager.motionY * 1000) == 425 && movementManager.airTicks == 11)
|
||||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports")))
|
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
&& movementManager.slimeInfluenceTicks == 0 && movementManager.elytraEffectTicks <= 25) {
|
||||||
"tried to climb air (mY=" + movementManager.motionY + ", at=" + movementManager.airTicks + ")");
|
return new CheckResult(CheckResult.Result.FAILED, "AirClimb",
|
||||||
|
"tried to climb air (mY=" + Utilities.roundDouble(movementManager.motionY, 4) + ", at=" + movementManager.airTicks + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.airTicks >= minAirTicks
|
||||||
|
&& movementManager.lastMotionY < 0 && movementManager.motionY > 0
|
||||||
|
&& movementManager.motionY > velocityTracker.getVertical() && movementManager.elytraEffectTicks <= 25
|
||||||
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
|
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))
|
||||||
|
&& !(Math.round(movementManager.motionY * 1000) == 396) && movementManager.airTicks == 15) {
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "AirClimb",
|
||||||
|
"tried to climb air (mY=" + Utilities.roundDouble(movementManager.motionY, 4) + ", at=" + movementManager.airTicks + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.lastMotionY > 0.0
|
||||||
|
&& movementManager.motionY > 0.0 && movementManager.airTicks > 3
|
||||||
|
&& movementManager.motionY > movementManager.lastMotionY
|
||||||
|
&& user.getVelocityTracker().getVertical() <= 0.0
|
||||||
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
|
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))) {
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "AirClimb",
|
||||||
|
"tried to climb air (mY=" + Utilities.roundDouble(movementManager.motionY, 4) + ", at=" + movementManager.airTicks + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.airTicks >= minAirTicks
|
||||||
|
&& !velocityTracker.isVelocitized() && movementManager.slimeInfluenceTicks <= 0
|
||||||
|
&& movementManager.elytraEffectTicks <= 25
|
||||||
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
|
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))
|
||||||
|
&& !Utilities.isNearClimbable(distance.getFrom(), 0.8)) {
|
||||||
|
// Config default base is 1200ms
|
||||||
|
// Ping clamped to max. 1000 to prevent spoofing for an advantage
|
||||||
|
int blockPlaceAccountingTime = (int) (checksConfig.getInteger(CheckType.FLIGHT, "airFlight",
|
||||||
|
"accountForBlockPlacement") + (0.25 * (user.getPing() > 1000 ? 1000 : user.getPing())));
|
||||||
|
// Config default account is 250ms
|
||||||
|
if (AntiCheatReloaded.getPlugin().getTPS() < 18.0) {
|
||||||
|
blockPlaceAccountingTime += checksConfig.getInteger(CheckType.FLIGHT, "airFlight",
|
||||||
|
"accountForTpsDrops");
|
||||||
|
}
|
||||||
|
|
||||||
|
final long lastPlacedBlock = AntiCheatReloaded.getManager().getBackend().placedBlock
|
||||||
|
.containsKey(player.getUniqueId())
|
||||||
|
? AntiCheatReloaded.getManager().getBackend().placedBlock.get(player.getUniqueId())
|
||||||
|
: (blockPlaceAccountingTime + 1);
|
||||||
|
final double maxMotionY = System.currentTimeMillis() - lastPlacedBlock > blockPlaceAccountingTime ? 0
|
||||||
|
: 0.42;
|
||||||
|
if (movementManager.motionY > maxMotionY) {
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "AirClimb",
|
||||||
|
"tried to climb air (mY=" + Utilities.roundDouble(movementManager.motionY, 4) + ", at=" + movementManager.airTicks + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
// End AirClimb
|
// End AirClimb
|
||||||
|
|
||||||
// Start GroundFlight
|
// Start GroundFlight
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "groundFlight") && movementManager.onGround
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "groundFlight") && movementManager.onGround
|
||||||
&& Utilities.cantStandAt(distance.getTo().getBlock().getRelative(BlockFace.DOWN))
|
&& Utilities.cantStandAt(distance.getTo().getBlock().getRelative(BlockFace.DOWN))
|
||||||
&& Utilities.cantStandAt(distance.getFrom().getBlock().getRelative(BlockFace.DOWN))
|
&& Utilities.cantStandAt(distance.getFrom().getBlock().getRelative(BlockFace.DOWN))
|
||||||
&& movementManager.groundTicks > 2) {
|
&& Utilities.cantStandAt(distance.getTo().getBlock())) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED, "GroundFlight",
|
||||||
"faked ground to fly (mY=" + movementManager.motionY + ", gt=" + movementManager.groundTicks + ")");
|
"faked ground to fly (mY=" + Utilities.roundDouble(movementManager.motionY, 4) + ", gt=" + movementManager.groundTicks + ")");
|
||||||
}
|
}
|
||||||
// End GroundFlight
|
// End GroundFlight
|
||||||
|
|
||||||
// Start Gravity
|
// Start Gravity
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "gravity") && !movementManager.onGround
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "gravity") && !movementManager.onGround
|
||||||
&& movementManager.motionY < 0 && !backend.justVelocity(player)
|
&& movementManager.motionY < 0 && Math.abs(movementManager.motionY) > velocityTracker.getVertical()
|
||||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
.getInteger(CheckType.FLIGHT, "gravity", "accountForTeleports"))
|
.getInteger(CheckType.FLIGHT, "gravity", "accountForTeleports"))
|
||||||
&& !Utilities.isInWeb(player)) {
|
&& !Utilities.isNearWeb(player) && movementManager.elytraEffectTicks <= 25
|
||||||
double gravitatedY = (movementManager.lastMotionY - 0.08) * GRAVITY_FRICTION;
|
&& !VersionLib.isSlowFalling(player)) {
|
||||||
double offset = Math.abs(gravitatedY - movementManager.motionY);
|
final double gravitatedY = (movementManager.lastMotionY - 0.08) * GRAVITY_FRICTION;
|
||||||
|
final double offset = Math.abs(gravitatedY - movementManager.motionY);
|
||||||
double maxOffset = checksConfig.getDouble(CheckType.FLIGHT, "gravity", "maxOffset");
|
double maxOffset = checksConfig.getDouble(CheckType.FLIGHT, "gravity", "maxOffset");
|
||||||
|
if (Utilities.isNearClimbable(distance.getFrom().clone().subtract(0, 0.51D, 0))
|
||||||
|
|| Utilities.isNearClimbable(distance.getFrom()) || Utilities.isNearWater(player)
|
||||||
|
|| (!Utilities.isNearWater(distance.getTo().clone().subtract(0, 1.5, 0))
|
||||||
|
&& distance.getTo().clone().subtract(0, 0.5, 0).getBlock().getType() != Material.AIR))
|
||||||
|
maxOffset += 0.15D;
|
||||||
if (offset > maxOffset && movementManager.airTicks > 2) {
|
if (offset > maxOffset && movementManager.airTicks > 2) {
|
||||||
int vl = GRAVITY_VIOLATIONS.getOrDefault(player.getUniqueId(), 0) + 1;
|
float vl = GRAVITY_VIOLATIONS.getOrDefault(player.getUniqueId(), 0f) + 1;
|
||||||
GRAVITY_VIOLATIONS.put(player.getUniqueId(), vl);
|
GRAVITY_VIOLATIONS.put(player.getUniqueId(), vl);
|
||||||
int vlBeforeFlag = checksConfig.getInteger(CheckType.FLIGHT, "gravity", "vlBeforeFlag");
|
int vlBeforeFlag = checksConfig.getInteger(CheckType.FLIGHT, "gravity", "vlBeforeFlag");
|
||||||
if (vl >= vlBeforeFlag)
|
if (vl >= vlBeforeFlag) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
GRAVITY_VIOLATIONS.put(player.getUniqueId(), Math.max(0, vl - 2));
|
||||||
"ignored gravity (offset=" + offset + ", at=" + movementManager.airTicks + ")");
|
return new CheckResult(CheckResult.Result.FAILED, "Gravity",
|
||||||
|
"ignored gravity (offset=" + Utilities.roundDouble(offset, 4) + ", at=" + movementManager.airTicks + ")");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
GRAVITY_VIOLATIONS.remove(player.getUniqueId());
|
if (GRAVITY_VIOLATIONS.containsKey(player.getUniqueId())) {
|
||||||
|
final float vl = GRAVITY_VIOLATIONS.getOrDefault(player.getUniqueId(), 0f);
|
||||||
|
GRAVITY_VIOLATIONS.put(player.getUniqueId(), Math.max(0, vl - 0.5f));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// End Gravity
|
// End Gravity
|
||||||
@@ -163,31 +262,4 @@ public class FlightCheck {
|
|||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isMovingExempt(Player player) {
|
|
||||||
return isDoing(player, MOVING_EXEMPT, -1) || player.isInsideVehicle();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isDoing(Player player, Map<UUID, Long> map, double max) {
|
|
||||||
if (map.containsKey(player.getUniqueId())) {
|
|
||||||
if (max != -1) {
|
|
||||||
if (((System.currentTimeMillis() - map.get(player.getUniqueId())) / 1000) > max) {
|
|
||||||
map.remove(player.getUniqueId());
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Termination time has already been calculated
|
|
||||||
if (map.get(player.getUniqueId()) < System.currentTimeMillis()) {
|
|
||||||
map.remove(player.getUniqueId());
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
|
*
|
||||||
|
* 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 com.rammelkast.anticheatreloaded.check.movement;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
|
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
|
|
||||||
|
public final class NoSlowCheck {
|
||||||
|
|
||||||
|
public static final Map<UUID, Long> LAST_RELEASE = new HashMap<UUID, Long>();
|
||||||
|
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
|
||||||
|
|
||||||
|
public static void runCheck(final Player player, final PacketEvent event) {
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
// Do not check if cancelled
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.NOSLOW)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final UUID uuid = player.getUniqueId();
|
||||||
|
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
||||||
|
final MovementManager movementManager = user.getMovementManager();
|
||||||
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
final long time = System.currentTimeMillis();
|
||||||
|
final long lastRelease = LAST_RELEASE.getOrDefault(uuid, 0L);
|
||||||
|
LAST_RELEASE.put(uuid, time);
|
||||||
|
if (lastRelease == 0L) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final long difference = time - lastRelease;
|
||||||
|
final long minimumDifference = checksConfig.getInteger(CheckType.NOSLOW, "minimumDifference");
|
||||||
|
if (difference < minimumDifference
|
||||||
|
&& movementManager.distanceXZ >= checksConfig.getDouble(CheckType.NOSLOW, "minimumDistXZ")) {
|
||||||
|
int violations = VIOLATIONS.getOrDefault(uuid, 1);
|
||||||
|
if (violations++ >= checksConfig.getInteger(CheckType.NOSLOW, "vlBeforeFlag")) {
|
||||||
|
violations = 0;
|
||||||
|
flag(player, event,
|
||||||
|
"toggled use item too fast (diff=" + difference + ", min=" + minimumDifference + ")");
|
||||||
|
}
|
||||||
|
VIOLATIONS.put(uuid, violations);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void flag(final Player player, final PacketEvent event, final String message) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
// We are currently not in the main server thread, so switch
|
||||||
|
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
EventListener.log(new CheckResult(CheckResult.Result.FAILED, message).getMessage(), player,
|
||||||
|
CheckType.NOSLOW, null);
|
||||||
|
player.teleport(player.getLocation());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,239 +18,492 @@
|
|||||||
*/
|
*/
|
||||||
package com.rammelkast.anticheatreloaded.check.movement;
|
package com.rammelkast.anticheatreloaded.check.movement;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import com.cryptomorin.xseries.XMaterial;
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Friction;
|
||||||
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.util.VelocityTracker;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.VersionLib;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rammelkast
|
* @author Rammelkast TODO soulsand speed TODO buffer system for all
|
||||||
* TODO soulsand speed
|
|
||||||
*/
|
*/
|
||||||
public class SpeedCheck {
|
public final class SpeedCheck {
|
||||||
|
|
||||||
|
public static final Map<UUID, Double> PREDICT_BUFFER = new HashMap<>();
|
||||||
|
public static final Map<UUID, Double> AIRSPEED_BUFFER = new HashMap<>();
|
||||||
|
public static final Map<UUID, Double> AIRACCELERATION_BUFFER = new HashMap<>();
|
||||||
|
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static boolean isSpeedExempt(Player player, Backend backend) {
|
private static boolean isSpeedExempt(final Player player, final Backend backend) {
|
||||||
return backend.isMovingExempt(player) || backend.justVelocity(player) || VersionUtil.isFlying(player);
|
return backend.isMovingExempt(player) || VersionLib.isFlying(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CheckResult checkXZSpeed(Player player, double x, double z, Location movingTowards) {
|
/**
|
||||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
* Largely based on Elevated's Frequency speed check
|
||||||
if (isSpeedExempt(player, backend) || player.getVehicle() != null || Utilities.isInWater(player))
|
* @see https://github.com/ElevatedDev/Frequency/blob/master/src/main/java/xyz/elevated/frequency/check/impl/speed/Speed.java
|
||||||
|
*
|
||||||
|
* TODO fix falses with entity collisions
|
||||||
|
*/
|
||||||
|
public static CheckResult checkPredict(final Player player, final Location movingTowards) {
|
||||||
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
if (!checksConfig.isSubcheckEnabled(CheckType.SPEED, "predict")) {
|
||||||
return PASS;
|
return PASS;
|
||||||
|
}
|
||||||
MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
|
||||||
.getMovementManager();
|
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
|
||||||
double distanceXZ = movementManager.distanceXZ;
|
|
||||||
boolean boxedIn = movementManager.topSolid && movementManager.bottomSolid;
|
|
||||||
|
|
||||||
|
final Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||||
|
if (isSpeedExempt(player, backend) || player.getVehicle() != null || Utilities.isInWater(player)
|
||||||
|
|| Utilities.isInWeb(player)) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
|
final UUID uuid = player.getUniqueId();
|
||||||
|
final MovementManager movementManager = user.getMovementManager();
|
||||||
|
final VelocityTracker velocityTracker = user.getVelocityTracker();
|
||||||
|
|
||||||
|
final double motion = movementManager.distanceXZ;
|
||||||
|
final boolean boxedIn = movementManager.topSolid && movementManager.bottomSolid;
|
||||||
|
final boolean sprinting = true; // TODO do this using packets
|
||||||
|
|
||||||
|
double buffer = PREDICT_BUFFER.getOrDefault(uuid, 0.0);
|
||||||
|
double movementSpeed = Utilities.getMovementSpeed(player);
|
||||||
|
if (movementManager.wasOnGround) {
|
||||||
|
if (sprinting) {
|
||||||
|
movementSpeed *= 1.3f;
|
||||||
|
}
|
||||||
|
|
||||||
|
movementSpeed *= 0.16277136 / Math.pow((movementManager.friction *= 0.91f), 3);
|
||||||
|
if (!movementManager.onGround && (movementManager.motionY >= 0.42f || (boxedIn && movementManager.motionY > 0.0f)) && sprinting) {
|
||||||
|
movementSpeed += 0.2f;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
movementSpeed = sprinting ? 0.026f : 0.02f;
|
||||||
|
movementManager.friction = 0.91f;
|
||||||
|
}
|
||||||
|
|
||||||
|
movementSpeed += velocityTracker.getHorizontal();
|
||||||
|
|
||||||
|
final double factor = (motion - movementManager.adjusted) / movementSpeed;
|
||||||
|
final boolean exempted = Utilities.isCollisionPoint(movingTowards,
|
||||||
|
material -> material == XMaterial.HONEY_BLOCK.parseMaterial());
|
||||||
|
if (factor > 1.001 && !exempted) {
|
||||||
|
if (buffer++ > 2.5) {
|
||||||
|
buffer /= 2;
|
||||||
|
PREDICT_BUFFER.put(uuid, buffer);
|
||||||
|
return new CheckResult(Result.FAILED, "Predict", "moved unexpectedly (factor=" + Utilities.roundDouble(factor, 3) + ")");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
buffer = Math.max(buffer - 0.05, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
PREDICT_BUFFER.put(uuid, buffer);
|
||||||
|
|
||||||
|
movementManager.adjusted = motion * movementManager.friction;
|
||||||
|
movementManager.friction = Friction.getFactor(movingTowards.clone().subtract(0, 1, 0).getBlock());
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CheckResult checkXZSpeed(final Player player, final Location movingTowards) {
|
||||||
|
final Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||||
|
if (isSpeedExempt(player, backend) || player.getVehicle() != null || Utilities.isInWater(player)) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
|
final UUID uuid = player.getUniqueId();
|
||||||
|
final MovementManager movementManager = user.getMovementManager();
|
||||||
|
final VelocityTracker velocityTracker = user.getVelocityTracker();
|
||||||
|
|
||||||
|
// Riptiding exemption
|
||||||
|
if (movementManager.riptideTicks > 0) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
final double distanceXZ = movementManager.distanceXZ;
|
||||||
|
final boolean boxedIn = movementManager.topSolid && movementManager.bottomSolid;
|
||||||
|
|
||||||
// AirSpeed
|
// AirSpeed
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "airSpeed") && movementManager.airTicks > 1 && movementManager.elytraEffectTicks <= 0) {
|
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "airSpeed") && movementManager.airTicks > 1
|
||||||
double multiplier = 0.985D;
|
&& movementManager.elytraEffectTicks <= 0 && !Utilities.isNearClimbable(player)) {
|
||||||
|
double buffer = AIRSPEED_BUFFER.getOrDefault(uuid, 0.0);
|
||||||
|
|
||||||
|
final double multiplier = 0.985D;
|
||||||
double predict = 0.36 * Math.pow(multiplier, movementManager.airTicks + 1);
|
double predict = 0.36 * Math.pow(multiplier, movementManager.airTicks + 1);
|
||||||
|
// Prevents false when falling from great heights
|
||||||
|
if (movementManager.airTicks >= 115) {
|
||||||
|
predict = Math.max(0.08, predict);
|
||||||
|
}
|
||||||
|
|
||||||
double limit = checksConfig.getDouble(CheckType.SPEED, "airSpeed", "baseLimit"); // Default 0.03125
|
double limit = checksConfig.getDouble(CheckType.SPEED, "airSpeed", "baseLimit"); // Default 0.03125
|
||||||
// Adjust for ice
|
// Adjust for ice
|
||||||
if (movementManager.iceInfluenceTicks > 0) {
|
if (movementManager.iceInfluenceTicks > 0) {
|
||||||
double iceIncrement = 0.025 * Math.pow(1.038, movementManager.iceInfluenceTicks);
|
double iceIncrement = 0.025 * Math.pow(1.038, movementManager.iceInfluenceTicks);
|
||||||
// Clamp to max value
|
// Clamp to max value
|
||||||
if (iceIncrement > 0.18D)
|
if (iceIncrement > 0.18D) {
|
||||||
iceIncrement = 0.18D;
|
iceIncrement = 0.18D;
|
||||||
if (boxedIn)
|
}
|
||||||
|
|
||||||
|
// Boxed in ice increment
|
||||||
|
if (boxedIn) {
|
||||||
iceIncrement += 0.45D;
|
iceIncrement += 0.45D;
|
||||||
if (!Utilities.couldBeOnIce(movingTowards))
|
}
|
||||||
iceIncrement *= 2.5D;
|
|
||||||
|
// Ice increment moving off ice
|
||||||
|
if (!Utilities.couldBeOnIce(movingTowards)) {
|
||||||
|
iceIncrement *= 2.5D;
|
||||||
|
}
|
||||||
|
|
||||||
predict += iceIncrement;
|
predict += iceIncrement;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Leniency when boxed in
|
// Leniency when boxed in
|
||||||
if (boxedIn && movementManager.airTicks < 3)
|
if (boxedIn && movementManager.airTicks < 3) {
|
||||||
limit *= 1.2D;
|
predict *= 1.2D;
|
||||||
|
}
|
||||||
|
|
||||||
// Adjust for slime
|
// Adjust for slime
|
||||||
if (movementManager.slimeInfluenceTicks > 0) {
|
if (movementManager.slimeInfluenceTicks > 0) {
|
||||||
double slimeIncrement = 0.022 * Math.pow(1.0375, movementManager.slimeInfluenceTicks);
|
double slimeIncrement = 0.022 * Math.pow(1.0375, movementManager.slimeInfluenceTicks);
|
||||||
// Clamp to max value
|
// Clamp to max value
|
||||||
if (slimeIncrement > 0.12D)
|
if (slimeIncrement > 0.12D) {
|
||||||
slimeIncrement = 0.12D;
|
slimeIncrement = 0.12D;
|
||||||
|
}
|
||||||
|
|
||||||
predict += slimeIncrement;
|
predict += slimeIncrement;
|
||||||
}
|
}
|
||||||
// Adjust for speed effects
|
|
||||||
if (player.hasPotionEffect(PotionEffectType.SPEED))
|
// Adjust for soul speed
|
||||||
predict += (player.getPotionEffect(PotionEffectType.SPEED).getAmplifier() + 1) * 0.05D;
|
final ItemStack boots = player.getInventory().getBoots();
|
||||||
// Adjust for jump boost effects
|
if (boots != null && movementManager.soilInfluenceTicks > 0 && VersionLib.isSoulSpeed(boots)) {
|
||||||
if (player.hasPotionEffect(PotionEffectType.JUMP))
|
predict += boots.getEnchantmentLevel(Enchantment.SOUL_SPEED) * 0.05D;
|
||||||
predict += (player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() + 1) * 0.05D;
|
|
||||||
// Adjust for custom walking speed
|
|
||||||
double walkSpeedMultiplier = checksConfig.getDouble(CheckType.SPEED, "airSpeed", "walkSpeedMultiplier"); // Default 1.4
|
|
||||||
predict += walkSpeedMultiplier * (Math.pow(1.1, ((player.getWalkSpeed() / 0.20) - 1)) - 1);
|
|
||||||
// Slabs sometimes allow for a slight boost after jump
|
|
||||||
if (movementManager.halfMovementHistoryCounter > 0)
|
|
||||||
predict *= 2.125D;
|
|
||||||
if (Utilities.couldBeOnHalfblock(movingTowards) && movementManager.halfMovementHistoryCounter == 0)
|
|
||||||
predict *= 1.25D;
|
|
||||||
// Boats sometimes give a false positive
|
|
||||||
if (Utilities.couldBeOnBoat(player, 0.5))
|
|
||||||
predict *= 1.25D;
|
|
||||||
// Strafing in air when nearing terminal velocity gives false positives
|
|
||||||
// This fixes the issue but gives hackers some leniency which means we need another check for this
|
|
||||||
double deltaMotionY = movementManager.motionY - movementManager.lastMotionY;
|
|
||||||
if (deltaMotionY < 0 && deltaMotionY >= -0.06)
|
|
||||||
predict *= 1.5D;
|
|
||||||
// Players can move faster in air with slow falling
|
|
||||||
if (VersionUtil.isSlowFalling(player))
|
|
||||||
predict *= 1.25D;
|
|
||||||
// Prevent NoSlow
|
|
||||||
// TODO better way for this
|
|
||||||
if (player.isBlocking() && movementManager.airTicks > 2)
|
|
||||||
predict *= 0.8D;
|
|
||||||
|
|
||||||
if (distanceXZ - predict > limit) {
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "moved too fast in air (speed=" + distanceXZ
|
|
||||||
+ ", limit=" + predict + ", block=" + player.isBlocking() + ", box=" + boxedIn + ", at=" + movementManager.airTicks + ")");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adjust for speed effects
|
||||||
|
if (movementManager.hasSpeedEffect) {
|
||||||
|
predict += VersionLib.getPotionLevel(player, PotionEffectType.SPEED) * 0.05D;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adjust for speed effects ending
|
||||||
|
if (movementManager.hadSpeedEffect && !movementManager.hasSpeedEffect) {
|
||||||
|
limit *= 1.2D;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adjust for jump boost effects
|
||||||
|
if (player.hasPotionEffect(PotionEffectType.JUMP)) {
|
||||||
|
predict += VersionLib.getPotionLevel(player, PotionEffectType.JUMP) * 0.05D;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adjust for custom walking speed
|
||||||
|
final double walkSpeedMultiplier = checksConfig.getDouble(CheckType.SPEED, "airSpeed",
|
||||||
|
"walkSpeedMultiplier"); // Default 1.4
|
||||||
|
predict += walkSpeedMultiplier * (Math.pow(1.1, ((player.getWalkSpeed() / 0.20) - 1)) - 1);
|
||||||
|
|
||||||
|
// Slabs sometimes allow for a slight boost after jump
|
||||||
|
if (movementManager.halfMovementHistoryCounter > 0) {
|
||||||
|
predict *= 2.125D;
|
||||||
|
}
|
||||||
|
if (Utilities.couldBeOnHalfblock(movingTowards) && movementManager.halfMovementHistoryCounter == 0) {
|
||||||
|
predict *= 1.25D;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Boats sometimes give a false positive
|
||||||
|
if (Utilities.couldBeOnBoat(player, 0.5, true)) {
|
||||||
|
predict *= 1.25D;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Strafing in air when nearing terminal velocity gives false positives
|
||||||
|
// This fixes the issue but gives hackers some leniency which means we need
|
||||||
|
// another check for this
|
||||||
|
final double deltaMotionY = movementManager.motionY - movementManager.lastMotionY;
|
||||||
|
if ((deltaMotionY < 0 && deltaMotionY >= -0.08) || movementManager.airTicks >= 40
|
||||||
|
&& (movingTowards.getBlockY() - player.getWorld().getHighestBlockYAt(movingTowards)) <= 1.5) {
|
||||||
|
predict *= (movementManager.airTicks > 60 ? 4.0D : (movementManager.airTicks > 30 ? 3.0D : 2.0D));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Players can move faster in air with slow falling
|
||||||
|
if (VersionLib.isSlowFalling(player)) {
|
||||||
|
predict *= 1.25D;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prevent NoSlow
|
||||||
|
if (movementManager.blockingTicks > 3 && movementManager.airTicks > 2) {
|
||||||
|
predict *= 0.8D;
|
||||||
|
}
|
||||||
|
if (movementManager.blockingTicks > 10 && movementManager.airTicks > 2) {
|
||||||
|
predict *= 0.5D;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fixes false positive when coming out of water
|
||||||
|
if (movementManager.nearLiquidTicks >= 7 && movementManager.airTicks >= 14
|
||||||
|
&& movementManager.motionY < -0.18 && movementManager.motionY > -0.182) {
|
||||||
|
predict += Math.abs(movementManager.motionY);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adjust for velocity
|
||||||
|
limit += velocityTracker.getHorizontal();
|
||||||
|
|
||||||
|
if (distanceXZ - predict > limit) {
|
||||||
|
if (buffer++ > 1.5) {
|
||||||
|
buffer /= 2;
|
||||||
|
AIRSPEED_BUFFER.put(uuid, buffer);
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "AirSpeed",
|
||||||
|
"moved too fast in air (speed=" + Utilities.roundDouble(distanceXZ, 4) + ", limit="
|
||||||
|
+ Utilities.roundDouble(predict, 4) + ", block=" + movementManager.blockingTicks
|
||||||
|
+ ", box=" + boxedIn + ", at=" + movementManager.airTicks + ")");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
buffer = Math.max(buffer - 0.05, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
AIRSPEED_BUFFER.put(uuid, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// AirAcceleration
|
// AirAcceleration
|
||||||
// As of right now, this falses sometimes, dont know why
|
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "airAcceleration") && movementManager.airTicks > 1
|
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "airAcceleration") && movementManager.airTicks > 1
|
||||||
&& movementManager.iceInfluenceTicks <= 0 && movementManager.slimeInfluenceTicks <= 0
|
&& movementManager.iceInfluenceTicks <= 0 && movementManager.slimeInfluenceTicks <= 0
|
||||||
&& movementManager.elytraEffectTicks <= 0) {
|
&& movementManager.elytraEffectTicks <= 0) {
|
||||||
double initialAcceleration = movementManager.acceleration;
|
final double initialAcceleration = movementManager.acceleration;
|
||||||
|
double buffer = AIRACCELERATION_BUFFER.getOrDefault(uuid, 0.0);
|
||||||
double limit = checksConfig.getDouble(CheckType.SPEED, "airAcceleration", "baseLimit"); // Default 0.3725
|
double limit = checksConfig.getDouble(CheckType.SPEED, "airAcceleration", "baseLimit"); // Default 0.3725
|
||||||
// Slight increase when boxed in
|
// Slight increase when boxed in
|
||||||
if (boxedIn)
|
if (boxedIn) {
|
||||||
limit *= 1.05D;
|
limit *= 1.08D;
|
||||||
// Adjust for speed effects
|
|
||||||
if (player.hasPotionEffect(PotionEffectType.SPEED))
|
|
||||||
limit += (player.getPotionEffect(PotionEffectType.SPEED).getAmplifier() + 1) * 0.0225D;
|
|
||||||
// Adjust for slabs
|
|
||||||
if (movementManager.halfMovementHistoryCounter > 15)
|
|
||||||
limit *= 2.0D;
|
|
||||||
// Adjust for custom walking speed
|
|
||||||
double walkSpeedMultiplier = checksConfig.getDouble(CheckType.SPEED, "airAcceleration", "walkSpeedMultiplier"); // Default 1.4
|
|
||||||
limit += walkSpeedMultiplier * (Math.pow(1.1, ((player.getWalkSpeed() / 0.20) - 1)) - 1);
|
|
||||||
// Boats sometimes give a false positive
|
|
||||||
if (Utilities.couldBeOnBoat(player))
|
|
||||||
limit *= 1.25D;
|
|
||||||
if (initialAcceleration > limit) {
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
|
||||||
"exceeded acceleration limits (acceleration=" + initialAcceleration + ", max=" + limit + ")");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adjust for soul speed
|
||||||
|
final ItemStack boots = player.getInventory().getBoots();
|
||||||
|
if (boots != null && movementManager.soilInfluenceTicks > 0 && VersionLib.isSoulSpeed(boots)) {
|
||||||
|
limit += boots.getEnchantmentLevel(Enchantment.SOUL_SPEED) * 0.025D;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adjust for speed effects
|
||||||
|
if (player.hasPotionEffect(PotionEffectType.SPEED)) {
|
||||||
|
limit += VersionLib.getPotionLevel(player, PotionEffectType.SPEED) * 0.0225D;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adjust for slabs
|
||||||
|
if (movementManager.halfMovementHistoryCounter > 15) {
|
||||||
|
limit *= 2.05D;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adjust for custom walking speed
|
||||||
|
final double walkSpeedMultiplier = checksConfig.getDouble(CheckType.SPEED, "airAcceleration",
|
||||||
|
"walkSpeedMultiplier"); // Default 1.4
|
||||||
|
limit += walkSpeedMultiplier * (Math.pow(1.1, ((player.getWalkSpeed() / 0.20) - 1)) - 1);
|
||||||
|
|
||||||
|
// Boats sometimes give a false positive
|
||||||
|
if (Utilities.couldBeOnBoat(player)) {
|
||||||
|
limit *= 1.25D;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add velocity
|
||||||
|
limit += velocityTracker.getHorizontal();
|
||||||
|
|
||||||
|
if (initialAcceleration > limit) {
|
||||||
|
if (buffer++ > 1.5) {
|
||||||
|
buffer /= 2;
|
||||||
|
AIRACCELERATION_BUFFER.put(uuid, buffer);
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "AirAcceleration",
|
||||||
|
"exceeded acceleration limits (acceleration=" + Utilities.roundDouble(initialAcceleration, 4)
|
||||||
|
+ ", max=" + Utilities.roundDouble(limit, 4) + ")");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
buffer = Math.max(buffer - 0.05, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
AIRACCELERATION_BUFFER.put(uuid, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// JumpBehaviour
|
// JumpBehaviour
|
||||||
// Works against YPorts and mini jumps
|
// Works against YPorts and mini jumps
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "jumpBehaviour") && movementManager.touchedGroundThisTick
|
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "jumpBehaviour") && movementManager.touchedGroundThisTick
|
||||||
&& !boxedIn && movementManager.slimeInfluenceTicks <= 10) {
|
&& !boxedIn && movementManager.slimeInfluenceTicks <= 10 && !Utilities.isNearHalfblock(movingTowards)
|
||||||
|
&& !Utilities.isNearHalfblock(movingTowards.clone().subtract(0, 0.51, 0))
|
||||||
|
&& !Utilities.couldBeOnBoat(player, 0.8, false) && movementManager.elytraEffectTicks <= 0) {
|
||||||
// This happens naturally
|
// This happens naturally
|
||||||
if (movementManager.airTicksBeforeGrounded == movementManager.groundTicks) {
|
if (movementManager.airTicksBeforeGrounded == movementManager.groundTicks) {
|
||||||
double minimumDistXZ = checksConfig.getDouble(CheckType.SPEED, "jumpBehaviour", "minimumDistXZ"); // Default 0.42
|
final double minimumDistXZ = checksConfig.getDouble(CheckType.SPEED, "jumpBehaviour", "minimumDistXZ"); // Default
|
||||||
if (distanceXZ >= minimumDistXZ) {
|
if (distanceXZ >= minimumDistXZ || movementManager.lastDistanceXZ >= minimumDistXZ) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "had unexpected jumping behaviour");
|
return new CheckResult(CheckResult.Result.FAILED, "JumpBehaviour",
|
||||||
|
"had unexpected jumping behaviour (dXZ=" + Utilities.roundDouble(distanceXZ, 4) + ", lXZ="
|
||||||
|
+ Utilities.roundDouble(movementManager.lastDistanceXZ, 4) + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GroundSpeed
|
// GroundSpeed
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "groundSpeed") && movementManager.groundTicks > 1) {
|
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "groundSpeed") && movementManager.groundTicks > 1
|
||||||
double initialLimit = checksConfig.getDouble(CheckType.SPEED, "groundSpeed", "initialLimit"); // Default 0.34
|
&& movementManager.elytraEffectTicks < 10) {
|
||||||
|
final double initialLimit = checksConfig.getDouble(CheckType.SPEED, "groundSpeed", "initialLimit"); // Default
|
||||||
|
// 0.34
|
||||||
double limit = initialLimit - 0.0055 * Math.min(9, movementManager.groundTicks);
|
double limit = initialLimit - 0.0055 * Math.min(9, movementManager.groundTicks);
|
||||||
// Leniency when moving back on ground
|
// Leniency when moving back on ground
|
||||||
if (movementManager.groundTicks < 5)
|
if (movementManager.groundTicks < 5) {
|
||||||
limit += 0.1D;
|
limit += 0.1D;
|
||||||
|
}
|
||||||
|
|
||||||
// Slab leniency
|
// Slab leniency
|
||||||
if (movementManager.halfMovementHistoryCounter > 8)
|
if (movementManager.halfMovementHistoryCounter > 8) {
|
||||||
limit += 0.2D;
|
limit += 0.2D;
|
||||||
|
}
|
||||||
|
|
||||||
|
// LivingEntities can give players a small push boost
|
||||||
|
if (!movingTowards.getWorld().getNearbyEntities(movingTowards, 0.3, 0.3, 0.3).isEmpty()) {
|
||||||
|
limit += 0.2D;
|
||||||
|
}
|
||||||
|
|
||||||
// Leniency when boxed in
|
// Leniency when boxed in
|
||||||
if (boxedIn)
|
if (boxedIn) {
|
||||||
limit *= 1.1D;
|
limit *= 1.1D;
|
||||||
|
}
|
||||||
|
|
||||||
// Adjust for speed effects
|
// Adjust for speed effects
|
||||||
if (player.hasPotionEffect(PotionEffectType.SPEED))
|
if (movementManager.hasSpeedEffect) {
|
||||||
limit += (player.getPotionEffect(PotionEffectType.SPEED).getAmplifier() + 1) * 0.06D;
|
limit += VersionLib.getPotionLevel(player, PotionEffectType.SPEED) * 0.06D;
|
||||||
|
}
|
||||||
|
if (movementManager.hasSpeedEffect && movementManager.groundTicks > 3) {
|
||||||
|
limit *= 1.4D;
|
||||||
|
}
|
||||||
|
if (movementManager.hadSpeedEffect && !movementManager.hasSpeedEffect) {
|
||||||
|
limit *= 1.2D;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ice adjustments
|
||||||
if (movementManager.iceInfluenceTicks >= 50) {
|
if (movementManager.iceInfluenceTicks >= 50) {
|
||||||
// When moving off ice
|
// When moving off ice
|
||||||
if (!Utilities.couldBeOnIce(movingTowards))
|
if (!Utilities.couldBeOnIce(movingTowards)) {
|
||||||
limit *= 2.5D;
|
limit *= 2.5D;
|
||||||
else {
|
} else {
|
||||||
// When boxed in and spamming space for boost
|
// When boxed in and spamming space for boost
|
||||||
if (movementManager.topSolid && movementManager.bottomSolid)
|
if (movementManager.topSolid && movementManager.bottomSolid) {
|
||||||
limit *= 3.0D;
|
limit *= 3.0D;
|
||||||
else
|
} else {
|
||||||
limit *= 1.25D;
|
limit *= 1.25D;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increased speed when stepping on/off half blocks
|
// Increased speed when stepping on/off half blocks
|
||||||
if (Utilities.isNearBed(movingTowards) || Utilities.couldBeOnHalfblock(movingTowards)
|
if (Utilities.isNearBed(movingTowards) || Utilities.couldBeOnHalfblock(movingTowards)
|
||||||
|| Utilities.isNearBed(movingTowards.clone().add(0, -0.5, 0)))
|
|| Utilities.isNearBed(movingTowards.clone().add(0, -0.5, 0))) {
|
||||||
limit *= 2.0D;
|
limit *= 2.0D;
|
||||||
|
}
|
||||||
|
|
||||||
// Increased speed when stepping on/off boat
|
// Increased speed when stepping on/off boat
|
||||||
if (Utilities.couldBeOnBoat(player))
|
if (Utilities.couldBeOnBoat(player)) {
|
||||||
limit += 0.2D;
|
limit += 0.2D;
|
||||||
|
}
|
||||||
|
|
||||||
// Adjust for custom walk speed
|
// Adjust for custom walk speed
|
||||||
limit += (player.getWalkSpeed() - 0.2) * 2.0D;
|
limit += (player.getWalkSpeed() - 0.2) * 2.0D;
|
||||||
|
|
||||||
// Prevent NoSlow
|
// Prevent NoSlow
|
||||||
if (player.isBlocking() && movementManager.groundTicks > 2)
|
if (player.isBlocking() && movementManager.groundTicks > 2) {
|
||||||
limit *= 0.45D;
|
limit *= 0.45D;
|
||||||
|
}
|
||||||
|
|
||||||
// Prevent NoWeb
|
// Prevent NoWeb
|
||||||
// TODO config
|
if (Utilities.isInWeb(player)) {
|
||||||
if (Utilities.isInWeb(player))
|
|
||||||
limit *= 0.65D;
|
limit *= 0.65D;
|
||||||
|
}
|
||||||
|
|
||||||
// Sneak speed check
|
// Sneak speed check
|
||||||
// TODO config
|
if (movementManager.sneakingTicks > 1) {
|
||||||
if (player.isSneaking())
|
|
||||||
limit *= 0.68D;
|
limit *= 0.68D;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Velocity adjustment
|
||||||
|
limit += velocityTracker.getHorizontal();
|
||||||
|
|
||||||
if (distanceXZ - limit > 0) {
|
if (distanceXZ - limit > 0) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED, "GroundSpeed",
|
||||||
"moved too fast on ground (speed=" + distanceXZ + ", limit=" + limit + ", blocking=" + player.isBlocking() + ")");
|
"moved too fast on ground (speed=" + Utilities.roundDouble(distanceXZ, 4) + ", limit="
|
||||||
|
+ Utilities.roundDouble(limit, 4) + ", blocking=" + player.isBlocking() + ", gt="
|
||||||
|
+ movementManager.groundTicks + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CheckResult checkVerticalSpeed(Player player, Distance distance) {
|
public static CheckResult checkVerticalSpeed(final Player player, final Distance distance) {
|
||||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
final Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||||
MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
if (isSpeedExempt(player, backend) || player.getVehicle() != null || player.isSleeping()
|
||||||
.getMovementManager();
|
|| Utilities.isNearWater(player)) {
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
|
||||||
if (!checksConfig.isSubcheckEnabled(CheckType.SPEED, "verticalSpeed"))
|
|
||||||
return PASS;
|
|
||||||
|
|
||||||
if (player.isInsideVehicle() || player.isSleeping()
|
|
||||||
|| backend.isDoing(player, backend.velocitized, backend.getMagic().VELOCITY_EXTENSION()) || VersionUtil.isFlying(player)
|
|
||||||
|| VersionUtil.isRiptiding(player)) {
|
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
|
final MovementManager movementManager = user.getMovementManager();
|
||||||
|
final VelocityTracker velocityTracker = user.getVelocityTracker();
|
||||||
|
// Riptiding exemption
|
||||||
|
if (movementManager.riptideTicks > 0) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
if (!checksConfig.isSubcheckEnabled(CheckType.SPEED, "verticalSpeed")) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
double maxMotionY = getMaxAcceptableMotionY(player, Utilities.isNearBed(distance.getTo()),
|
double maxMotionY = getMaxAcceptableMotionY(player, Utilities.isNearBed(distance.getTo()),
|
||||||
Utilities.couldBeOnBoat(player), Utilities.isClimbableBlock(distance.getFrom().getBlock())
|
Utilities.couldBeOnBoat(player),
|
||||||
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN)), movementManager.halfMovement, checksConfig);
|
Utilities.isClimbableBlock(distance.getFrom().getBlock())
|
||||||
|
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN)),
|
||||||
|
(movementManager.halfMovement || Utilities.isNearWall(distance.getFrom())), checksConfig);
|
||||||
|
// Fix false positive with soulsand boost
|
||||||
|
if (movementManager.nearLiquidTicks > 6) {
|
||||||
|
maxMotionY *= 1.0525D;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adjust for powdered snow
|
||||||
|
if (distance.getFrom().getBlock().getType() == XMaterial.POWDER_SNOW.parseMaterial()) {
|
||||||
|
maxMotionY += 0.17D;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adjust for velocity
|
||||||
|
maxMotionY += velocityTracker.getVertical();
|
||||||
|
|
||||||
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0) {
|
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED, "VerticalSpeed",
|
||||||
"exceeded vertical speed limit (mY=" + movementManager.motionY + ", max=" + maxMotionY + ")");
|
"exceeded vertical speed limit (mY=" + Utilities.roundDouble(movementManager.motionY, 4) + ", max="
|
||||||
|
+ Utilities.roundDouble(maxMotionY, 4) + ")");
|
||||||
}
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static double getMaxAcceptableMotionY(Player player, boolean nearBed, boolean couldBeOnBoat, boolean fromClimbable, boolean halfMovement, Checks checksConfig) {
|
private static double getMaxAcceptableMotionY(final Player player, final boolean nearBed,
|
||||||
// TODO config for these values
|
final boolean couldBeOnBoat, final boolean fromClimbable, final boolean halfMovement,
|
||||||
// TODO something funky vanilla stuff going on with 0.42, like 0.445.., check this..
|
final Checks checksConfig) {
|
||||||
double base = couldBeOnBoat ? 0.600000025 : (nearBed ? 0.5625 : (halfMovement ? 0.6 : 0.42));
|
double base = couldBeOnBoat ? 0.6f : (nearBed ? 0.5625f : ((halfMovement) ? 0.6f : 0.42f));
|
||||||
if (fromClimbable)
|
if (fromClimbable) {
|
||||||
base += checksConfig.getDouble(CheckType.SPEED, "verticalSpeed", "climbableCompensation"); // Default 0.04
|
base += checksConfig.getDouble(CheckType.SPEED, "verticalSpeed", "climbableCompensation"); // Default 0.04
|
||||||
|
}
|
||||||
|
|
||||||
if (player.hasPotionEffect(PotionEffectType.JUMP)) {
|
if (player.hasPotionEffect(PotionEffectType.JUMP)) {
|
||||||
base += player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() * 0.2D;
|
base += VersionLib.getPotionLevel(player, PotionEffectType.JUMP) * 0.2D;
|
||||||
}
|
}
|
||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
|
*
|
||||||
|
* 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 com.rammelkast.anticheatreloaded.check.movement;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.VelocityTracker;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.VersionLib;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rammelkast
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public final class StrafeCheck {
|
||||||
|
|
||||||
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
|
public static CheckResult runCheck(final Player player, final double x, final double z, final Location from,
|
||||||
|
final Location to) {
|
||||||
|
if (!Utilities.cantStandAtExp(from) || !Utilities.cantStandAtExp(to) || Utilities.isNearWater(player)
|
||||||
|
|| Utilities.isNearClimbable(player) || VersionLib.isFlying(player) || player.isDead()
|
||||||
|
|| Utilities.isHalfblock(to.getBlock().getRelative(BlockFace.DOWN)) || Utilities.isNearHalfblock(to)) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
|
final MovementManager movementManager = user.getMovementManager();
|
||||||
|
final VelocityTracker velocityTracker = user.getVelocityTracker();
|
||||||
|
if (velocityTracker.isVelocitized()) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
|
||||||
|
if (System.currentTimeMillis() - movementManager.lastTeleport <= checksConfig.getInteger(CheckType.STRAFE,
|
||||||
|
"accountForTeleports") || movementManager.elytraEffectTicks >= 20
|
||||||
|
|| movementManager.halfMovementHistoryCounter >= 20 || Utilities.couldBeOnBoat(player, 0.5, false)) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Vector oldAcceleration = new Vector(movementManager.lastDistanceX, 0, movementManager.lastDistanceZ);
|
||||||
|
final Vector newAcceleration = new Vector(x, 0, z);
|
||||||
|
|
||||||
|
final float angle = newAcceleration.angle(oldAcceleration);
|
||||||
|
final double distance = newAcceleration.lengthSquared();
|
||||||
|
if (angle > checksConfig.getDouble(CheckType.STRAFE, "maxAngleChange")
|
||||||
|
&& distance > checksConfig.getDouble(CheckType.STRAFE, "minActivationDistance")
|
||||||
|
&& Utilities.cantStandFar(to.getBlock())) {
|
||||||
|
return new CheckResult(Result.FAILED, "switched angle in air (angle=" + angle + ", dist=" + distance + ")");
|
||||||
|
}
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -32,47 +32,66 @@ import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
|||||||
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.VersionLib;
|
||||||
|
|
||||||
public class WaterWalkCheck {
|
public final class WaterWalkCheck {
|
||||||
|
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, double x, double y, double z) {
|
public static CheckResult runCheck(final Player player, final double x, final double y, final double z) {
|
||||||
UUID uuid = player.getUniqueId();
|
final UUID uuid = player.getUniqueId();
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
||||||
MovementManager movementManager = user.getMovementManager();
|
final MovementManager movementManager = user.getMovementManager();
|
||||||
|
|
||||||
if (movementManager.distanceXZ <= 0)
|
if (movementManager.distanceXZ <= 0 || player.getVehicle() != null || Utilities.isOnLilyPad(player) || Utilities.isOnCarpet(player)
|
||||||
|
|| movementManager.riptideTicks > 0 || VersionLib.isSwimming(player) || VersionLib.isFlying(player) || user.getVelocityTracker().isVelocitized()) {
|
||||||
return PASS;
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
Block blockBeneath = player.getLocation().clone().subtract(0, 0.1, 0).getBlock();
|
final Block blockBeneath = player.getLocation().clone().subtract(0, 0.1, 0).getBlock();
|
||||||
|
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "walk") && blockBeneath.isLiquid()
|
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "walk") && blockBeneath.isLiquid()
|
||||||
&& Utilities.isSurroundedByWater(player)
|
&& Utilities.isSurroundedByWater(player)
|
||||||
&& (movementManager.motionY == 0 || movementManager.motionY == Utilities.JUMP_MOTION_Y)
|
&& ((movementManager.motionY == 0 && movementManager.lastMotionY == 0)
|
||||||
&& movementManager.distanceXZ > checksConfig.getDouble(CheckType.WATER_WALK, "lunge", "minimumDistXZ"))
|
|| movementManager.motionY == Utilities.JUMP_MOTION_Y)
|
||||||
return new CheckResult(Result.FAILED,
|
&& movementManager.distanceXZ > checksConfig.getDouble(CheckType.WATER_WALK, "walk", "minimumDistXZ")
|
||||||
|
&& !movementManager.topSolid && !Utilities.couldBeOnBoat(player, 3, false)) {
|
||||||
|
return new CheckResult(Result.FAILED, "Walk",
|
||||||
"tried to walk on water (xz=" + Utilities.roundDouble(movementManager.distanceXZ, 5) + ")");
|
"tried to walk on water (xz=" + Utilities.roundDouble(movementManager.distanceXZ, 5) + ")");
|
||||||
|
}
|
||||||
|
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "hop") && blockBeneath.isLiquid()
|
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "hop") && blockBeneath.isLiquid()
|
||||||
&& Utilities.isSurroundedByWater(player) && movementManager.onGround
|
&& Utilities.isSurroundedByWater(player) && movementManager.onGround
|
||||||
&& Math.abs(movementManager.motionY) < checksConfig.getDouble(CheckType.WATER_WALK, "lunge", "maxMotionY"))
|
&& Math.abs(movementManager.motionY) < checksConfig.getDouble(CheckType.WATER_WALK, "hop", "maxMotionY")
|
||||||
return new CheckResult(Result.FAILED,
|
&& !Utilities.couldBeOnBoat(player, 0.3, false)) {
|
||||||
|
return new CheckResult(Result.FAILED, "Hop",
|
||||||
"tried to hop on water (mY=" + Utilities.roundDouble(movementManager.motionY, 5) + ")");
|
"tried to hop on water (mY=" + Utilities.roundDouble(movementManager.motionY, 5) + ")");
|
||||||
|
}
|
||||||
|
|
||||||
double minAbsMotionY = 0.08D;
|
final double minAbsMotionY = 0.12D + (VersionLib.getPotionLevel(player, PotionEffectType.SPEED) * 0.05D);
|
||||||
if (player.hasPotionEffect(PotionEffectType.SPEED))
|
|
||||||
minAbsMotionY += (player.getPotionEffect(PotionEffectType.SPEED).getAmplifier() + 1) * 0.05D;
|
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "lunge") && blockBeneath.isLiquid()
|
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "lunge") && blockBeneath.isLiquid()
|
||||||
&& Utilities.isSurroundedByWater(player)
|
&& Utilities.isSurroundedByWater(player)
|
||||||
&& Math.abs(movementManager.lastMotionY - movementManager.motionY) > minAbsMotionY
|
&& Math.abs(movementManager.lastMotionY - movementManager.motionY) > minAbsMotionY
|
||||||
&& movementManager.distanceXZ > checksConfig.getDouble(CheckType.WATER_WALK, "lunge", "minimumDistXZ")
|
&& movementManager.distanceXZ > checksConfig.getDouble(CheckType.WATER_WALK, "lunge", "minimumDistXZ")
|
||||||
&& movementManager.lastMotionY > -0.25)
|
&& movementManager.lastMotionY > -0.25
|
||||||
return new CheckResult(Result.FAILED, "tried to lunge in water (xz="
|
&& !Utilities.couldBeOnBoat(player, 0.3, false)) {
|
||||||
|
return new CheckResult(Result.FAILED, "Lunge", "tried to lunge in water (xz="
|
||||||
+ Utilities.roundDouble(movementManager.distanceXZ, 5) + ", absMotionY="
|
+ Utilities.roundDouble(movementManager.distanceXZ, 5) + ", absMotionY="
|
||||||
+ Utilities.roundDouble(Math.abs(movementManager.lastMotionY - movementManager.motionY), 5) + ")");
|
+ Utilities.roundDouble(Math.abs(movementManager.lastMotionY - movementManager.motionY), 5) + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "lunge") && Utilities.isSurroundedByWater(player)
|
||||||
|
&& movementManager.distanceXZ > 0.16 && movementManager.motionY > 0.0
|
||||||
|
&& movementManager.lastMotionY < 0.0
|
||||||
|
&& (Math.abs(movementManager.motionY) < 0.017 && Math.abs(movementManager.lastMotionY) < 0.02)
|
||||||
|
&& Math.abs(movementManager.lastMotionY - 0.004) < 0.021
|
||||||
|
&& user.getVelocityTracker().getHorizontal() < 0.04
|
||||||
|
&& !Utilities.couldBeOnBoat(player, 0.3, false)) {
|
||||||
|
return new CheckResult(Result.FAILED, "Lunge", "tried to lunge in water (xz="
|
||||||
|
+ Utilities.roundDouble(movementManager.distanceXZ, 5) + ", motionY="
|
||||||
|
+ Utilities.roundDouble(movementManager.motionY, 5) + ", lastMotionY="
|
||||||
|
+ Utilities.roundDouble(movementManager.lastMotionY, 5) + ")");
|
||||||
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,9 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.rammelkast.anticheatreloaded.check.packet;
|
package com.rammelkast.anticheatreloaded.check.packet;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@@ -32,62 +29,78 @@ import com.rammelkast.anticheatreloaded.check.CheckResult;
|
|||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
|
||||||
public class BadPacketsCheck {
|
public final class BadPacketsCheck {
|
||||||
|
|
||||||
public static void runCheck(Player player, PacketEvent event) {
|
public static void runCheck(final Player player, final PacketEvent event) {
|
||||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
if (event.isCancelled()) {
|
||||||
// Confirm if we should even check for BadPackets
|
// Do not check if cancelled
|
||||||
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.BADPACKETS) || backend.isMovingExempt(player)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
|
||||||
PacketContainer packet = event.getPacket();
|
final Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||||
float pitch = packet.getFloat().read(1);
|
// Confirm if we should even check for BadPackets
|
||||||
|
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.BADPACKETS)
|
||||||
|
|| backend.isMovingExempt(player) || player.isDead()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
|
final PacketContainer packet = event.getPacket();
|
||||||
|
final float pitch = packet.getFloat().read(1);
|
||||||
// Check for derp
|
// Check for derp
|
||||||
if (Math.abs(pitch) > 90) {
|
if (Math.abs(pitch) > 90) {
|
||||||
flag(player, event, "had an illegal pitch");
|
flag(player, event, "had an illegal pitch", null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
final double tps = AntiCheatReloaded.getPlugin().getTPS();
|
||||||
if (user.isLagging() || tps < checksConfig.getDouble(CheckType.MOREPACKETS, "minimumTps")) {
|
final MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager()
|
||||||
|
.getUser(player.getUniqueId()).getMovementManager();
|
||||||
|
if (user.isLagging() || tps < checksConfig.getDouble(CheckType.BADPACKETS, "minimumTps")
|
||||||
|
|| (System.currentTimeMillis() - movementManager.lastTeleport <= checksConfig
|
||||||
|
.getInteger(CheckType.BADPACKETS, "teleportCompensation"))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double x = packet.getDoubles().read(0);
|
final double x = packet.getDoubles().read(0);
|
||||||
double y = packet.getDoubles().read(1);
|
final double y = packet.getDoubles().read(1);
|
||||||
double z = packet.getDoubles().read(2);
|
final double z = packet.getDoubles().read(2);
|
||||||
float yaw = packet.getFloat().read(0);
|
final float yaw = packet.getFloat().read(0);
|
||||||
// Create location from new data
|
// Create location from new data
|
||||||
Location previous = player.getLocation();
|
final Location previous = player.getLocation().clone();
|
||||||
Location current = new Location(previous.getWorld(), x, y, z, yaw, pitch);
|
// Only take horizontal distance
|
||||||
double distance = previous.distanceSquared(current);
|
previous.setY(0);
|
||||||
double maxDistance = checksConfig.getDouble(CheckType.BADPACKETS, "maxDistance");
|
final Location current = new Location(previous.getWorld(), x, 0, z, yaw, pitch);
|
||||||
boolean hasNewLocation = packet.getBooleans().read(0);
|
final double distanceHorizontal = previous.distanceSquared(current);
|
||||||
if (distance > maxDistance) {
|
final double distanceVertical = y - player.getLocation().getY();
|
||||||
flag(player, event, "moved too far between packets (distance=" + new BigDecimal(distance).setScale(1, RoundingMode.HALF_UP) + ", max=" + maxDistance + ")");
|
final double maxDistanceHorizontal = checksConfig.getDouble(CheckType.BADPACKETS, "maxDistance")
|
||||||
|
+ user.getVelocityTracker().getHorizontal();
|
||||||
|
if (distanceHorizontal > maxDistanceHorizontal) {
|
||||||
|
flag(player, event,
|
||||||
|
"moved too far between packets (HT, distance=" + Utilities.roundDouble(distanceHorizontal, 1)
|
||||||
|
+ ", max=" + Utilities.roundDouble(maxDistanceHorizontal, 1) + ")", user.getGoodLocation(previous));
|
||||||
return;
|
return;
|
||||||
} else if (distance < 1E-10 && !hasNewLocation) {
|
}
|
||||||
// TODO this gives false positives when teleporting
|
|
||||||
// Only found this in 1.8.8 though
|
if (distanceVertical < -4.0D && user.getVelocityTracker().getVertical() == 0.0D) {
|
||||||
//flag(player, event, "sent the same packet twice");
|
flag(player, event, "moved too far between packets (VT, distance="
|
||||||
|
+ Utilities.roundDouble(Math.abs(distanceVertical), 1) + ", max=4.0)", user.getGoodLocation(previous));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void flag(Player player, PacketEvent event, String message) {
|
private static void flag(final Player player, final PacketEvent event, final String message, final Location setback) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
// We are currently not in the main server thread, so switch
|
// We are currently not in the main server thread, so switch
|
||||||
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
AntiCheatReloaded.sendToMainThread(() -> {
|
||||||
@Override
|
EventListener.log(new CheckResult(CheckResult.Result.FAILED, message).getMessage(), player,
|
||||||
public void run() {
|
CheckType.BADPACKETS, null);
|
||||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, message).getMessage(), player,
|
player.teleport(setback != null ? setback : player.getLocation());
|
||||||
CheckType.BADPACKETS);
|
|
||||||
player.teleport(player.getLocation());
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -36,40 +36,46 @@ import com.rammelkast.anticheatreloaded.util.User;
|
|||||||
/**
|
/**
|
||||||
* @author Rammelkast
|
* @author Rammelkast
|
||||||
*/
|
*/
|
||||||
public class MorePacketsCheck {
|
public final class MorePacketsCheck {
|
||||||
|
|
||||||
public static final Map<UUID, Long> LAST_PACKET_TIME = new HashMap<UUID, Long>();
|
public static final Map<UUID, Long> LAST_PACKET_TIME = new HashMap<UUID, Long>();
|
||||||
public static final Map<UUID, Long> EXEMPT_TIMINGS = new HashMap<UUID, Long>();
|
public static final Map<UUID, Long> EXEMPT_TIMINGS = new HashMap<UUID, Long>();
|
||||||
public static final Map<UUID, Double> PACKET_BALANCE = new HashMap<UUID, Double>();
|
public static final Map<UUID, Double> PACKET_BALANCE = new HashMap<UUID, Double>();
|
||||||
|
|
||||||
public static void runCheck(Player player, PacketEvent event) {
|
public static void runCheck(final Player player, final PacketEvent event) {
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
// Do not check if cancelled
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Confirm if we should even check for MorePackets
|
// Confirm if we should even check for MorePackets
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
final double tps = AntiCheatReloaded.getPlugin().getTPS();
|
||||||
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.MOREPACKETS)
|
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.MOREPACKETS)
|
||||||
|| tps < checksConfig.getDouble(CheckType.MOREPACKETS, "minimumTps")) {
|
|| tps < checksConfig.getDouble(CheckType.MOREPACKETS, "minimumTps")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID uuid = player.getUniqueId();
|
final UUID uuid = player.getUniqueId();
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
||||||
int maxPing = checksConfig.getInteger(CheckType.MOREPACKETS, "maxPing");
|
final int maxPing = checksConfig.getInteger(CheckType.MOREPACKETS, "maxPing");
|
||||||
boolean disableForLagging = checksConfig.getBoolean(CheckType.MOREPACKETS, "disableForLagging");
|
final boolean disableForLagging = checksConfig.getBoolean(CheckType.MOREPACKETS, "disableForLagging");
|
||||||
if (AntiCheatReloaded.getManager().getBackend().isDoing(player, EXEMPT_TIMINGS, -1)
|
if (AntiCheatReloaded.getManager().getBackend().isDoing(player, EXEMPT_TIMINGS, -1)
|
||||||
|| (maxPing > 0 && user.getPing() > maxPing) || (disableForLagging && user.isLagging())) {
|
|| (maxPing > 0 && user.getPing() > maxPing) || (disableForLagging && user.isLagging())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
long packetTimeNow = System.currentTimeMillis();
|
|
||||||
long lastPacketTime = LAST_PACKET_TIME.getOrDefault(uuid, packetTimeNow - 50L);
|
final long packetTimeNow = System.currentTimeMillis();
|
||||||
|
final long lastPacketTime = LAST_PACKET_TIME.getOrDefault(uuid, packetTimeNow - 50L);
|
||||||
double packetBalance = PACKET_BALANCE.getOrDefault(uuid, 0D);
|
double packetBalance = PACKET_BALANCE.getOrDefault(uuid, 0D);
|
||||||
|
|
||||||
long rate = packetTimeNow - lastPacketTime;
|
final long rate = packetTimeNow - lastPacketTime;
|
||||||
packetBalance += 50;
|
packetBalance += 50;
|
||||||
packetBalance -= rate;
|
packetBalance -= rate;
|
||||||
int triggerBalance = checksConfig.getInteger(CheckType.MOREPACKETS, "triggerBalance");
|
final int triggerBalance = checksConfig.getInteger(CheckType.MOREPACKETS, "triggerBalance");
|
||||||
int minimumClamp = checksConfig.getInteger(CheckType.MOREPACKETS, "minimumClamp");
|
final int minimumClamp = checksConfig.getInteger(CheckType.MOREPACKETS, "minimumClamp");
|
||||||
if (packetBalance >= triggerBalance) {
|
if (packetBalance >= triggerBalance) {
|
||||||
int ticks = (int) Math.round(packetBalance / 50);
|
final int ticks = (int) Math.round(packetBalance / 50);
|
||||||
packetBalance = -1 * (triggerBalance / 2);
|
packetBalance = -1 * (triggerBalance / 2);
|
||||||
flag(player, event, "overshot timer by " + ticks + " tick(s)");
|
flag(player, event, "overshot timer by " + ticks + " tick(s)");
|
||||||
} else if (packetBalance < -1 * minimumClamp) {
|
} else if (packetBalance < -1 * minimumClamp) {
|
||||||
@@ -81,23 +87,23 @@ public class MorePacketsCheck {
|
|||||||
PACKET_BALANCE.put(uuid, packetBalance);
|
PACKET_BALANCE.put(uuid, packetBalance);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void flag(Player player, PacketEvent event, String message) {
|
private static void flag(final Player player, final PacketEvent event, final String message) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
// We are currently not in the main server thread, so switch
|
// We are currently not in the main server thread, so switch
|
||||||
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, message).getMessage(), player,
|
EventListener.log(new CheckResult(CheckResult.Result.FAILED, message).getMessage(), player,
|
||||||
CheckType.MOREPACKETS);
|
CheckType.MOREPACKETS, null);
|
||||||
player.teleport(player.getLocation());
|
player.teleport(player.getLocation());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void compensate(Player player) {
|
public static void compensate(final Player player) {
|
||||||
UUID uuid = player.getUniqueId();
|
final UUID uuid = player.getUniqueId();
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
double packetBalance = PACKET_BALANCE.getOrDefault(uuid, 0D);
|
final double packetBalance = PACKET_BALANCE.getOrDefault(uuid, 0D);
|
||||||
PACKET_BALANCE.put(uuid, packetBalance - checksConfig.getInteger(CheckType.MOREPACKETS, "teleportCompensation"));
|
PACKET_BALANCE.put(uuid, packetBalance - checksConfig.getInteger(CheckType.MOREPACKETS, "teleportCompensation"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+40
-26
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -21,11 +21,13 @@ package com.rammelkast.anticheatreloaded.check.player;
|
|||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
@@ -34,29 +36,31 @@ import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
|||||||
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.util.VersionLib;
|
||||||
|
|
||||||
public class IllegalInteract {
|
public final class IllegalInteractCheck {
|
||||||
|
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static CheckResult performCheck(Player player, Event event) {
|
public static CheckResult runCheck(final Player player, final Event event) {
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
if (event instanceof BlockPlaceEvent && checksConfig.isSubcheckEnabled(CheckType.ILLEGAL_INTERACT, "place")) {
|
if (event instanceof BlockPlaceEvent && checksConfig.isSubcheckEnabled(CheckType.ILLEGAL_INTERACT, "place")) {
|
||||||
return checkBlockPlace(player, (BlockPlaceEvent) event);
|
return checkBlockPlace(player, (BlockPlaceEvent) event);
|
||||||
} else if (event instanceof BlockBreakEvent
|
} else if (event instanceof BlockBreakEvent
|
||||||
&& checksConfig.isSubcheckEnabled(CheckType.ILLEGAL_INTERACT, "break")) {
|
&& checksConfig.isSubcheckEnabled(CheckType.ILLEGAL_INTERACT, "break")) {
|
||||||
return checkBlockBreak(player, (BlockBreakEvent) event);
|
return checkBlockBreak(player, (BlockBreakEvent) event);
|
||||||
} else if (event instanceof PlayerInteractEvent && checksConfig.isSubcheckEnabled(CheckType.ILLEGAL_INTERACT, "interact")) {
|
} else if (event instanceof PlayerInteractEvent
|
||||||
|
&& checksConfig.isSubcheckEnabled(CheckType.ILLEGAL_INTERACT, "interact")) {
|
||||||
return checkInteract(player, (PlayerInteractEvent) event);
|
return checkInteract(player, (PlayerInteractEvent) event);
|
||||||
}
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CheckResult checkInteract(Player player, PlayerInteractEvent event) {
|
private static CheckResult checkInteract(final Player player, final PlayerInteractEvent event) {
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
double distance = player.getEyeLocation().toVector().distance(event.getClickedBlock().getLocation().toVector());
|
final double distance = player.getEyeLocation().toVector()
|
||||||
|
.distance(event.getClickedBlock().getLocation().toVector());
|
||||||
double maxDistance = player.getGameMode() == GameMode.CREATIVE
|
double maxDistance = player.getGameMode() == GameMode.CREATIVE
|
||||||
? checksConfig.getDouble(CheckType.ILLEGAL_INTERACT, "interact", "creativeRange")
|
? checksConfig.getDouble(CheckType.ILLEGAL_INTERACT, "interact", "creativeRange")
|
||||||
: checksConfig.getDouble(CheckType.ILLEGAL_INTERACT, "interact", "survivalRange");
|
: checksConfig.getDouble(CheckType.ILLEGAL_INTERACT, "interact", "survivalRange");
|
||||||
@@ -67,31 +71,41 @@ public class IllegalInteract {
|
|||||||
maxDistance += player.getVelocity().length()
|
maxDistance += player.getVelocity().length()
|
||||||
* checksConfig.getDouble(CheckType.ILLEGAL_INTERACT, "interact", "velocityMultiplier");
|
* checksConfig.getDouble(CheckType.ILLEGAL_INTERACT, "interact", "velocityMultiplier");
|
||||||
if (distance > maxDistance) {
|
if (distance > maxDistance) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "tried to interact out of range (dist=" + distance + ", max=" + maxDistance + ")");
|
return new CheckResult(CheckResult.Result.FAILED, "Interact",
|
||||||
|
"tried to interact out of range (dist=" + distance + ", max=" + maxDistance + ")");
|
||||||
}
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CheckResult checkBlockBreak(Player player, BlockBreakEvent event) {
|
private static CheckResult checkBlockBreak(final Player player, final BlockBreakEvent event) {
|
||||||
if (!isValidTarget(player, event.getBlock())) {
|
if (!isValidTarget(player, event.getBlock())) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "tried to break a block which was out of view");
|
return new CheckResult(CheckResult.Result.FAILED, "Break", "tried to break a block which was out of view");
|
||||||
}
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CheckResult checkBlockPlace(Player player, BlockPlaceEvent event) {
|
private static CheckResult checkBlockPlace(final Player player, final BlockPlaceEvent event) {
|
||||||
if (!isValidTarget(player, event.getBlock())) {
|
final BlockFace face = event.getBlock().getFace(event.getBlockAgainst());
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "tried to place a block out of their view");
|
if (face == null) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Vector vector = new Vector(face.getModX(), face.getModY(), face.getModZ());
|
||||||
|
if (event.getBlock().getType().isSolid()
|
||||||
|
&& player.getLocation().getDirection().angle(vector) > Math.toRadians(90)) {
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "Place",
|
||||||
|
"tried to place a block out of their view (angle="
|
||||||
|
+ Utilities.roundFloat(player.getLocation().getDirection().angle(vector), 1)
|
||||||
|
+ ", max=90.0");
|
||||||
}
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isValidTarget(Player player, Block block) {
|
private static boolean isValidTarget(final Player player, final Block block) {
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
double distance = player.getGameMode() == GameMode.CREATIVE ? 6.0
|
final double distance = player.getGameMode() == GameMode.CREATIVE ? 6.0
|
||||||
: player.getLocation().getDirection().getY() > 0.9 ? 6.0
|
: player.getLocation().getDirection().getY() > 0.9 ? 6.0 : 5.5;
|
||||||
: 5.5;
|
final Block targetBlock = VersionLib.getTargetBlock(player, ((int) Math.ceil(distance)));
|
||||||
Block targetBlock = VersionUtil.getTargetBlock(player, ((int) Math.ceil(distance)));
|
|
||||||
if (targetBlock == null) {
|
if (targetBlock == null) {
|
||||||
// TODO better check here
|
// TODO better check here
|
||||||
return true;
|
return true;
|
||||||
@@ -107,10 +121,10 @@ public class IllegalInteract {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Location eyeLocation = player.getEyeLocation();
|
final Location eyeLocation = player.getEyeLocation();
|
||||||
double yawDifference = KillAuraCheck.calculateYawDifference(eyeLocation, block.getLocation());
|
final double yawDifference = KillAuraCheck.calculateYawDifference(eyeLocation, block.getLocation());
|
||||||
double playerYaw = player.getEyeLocation().getYaw();
|
final double playerYaw = player.getEyeLocation().getYaw();
|
||||||
double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
|
final double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
|
||||||
if (Math.round(angleDifference) > checksConfig.getInteger(CheckType.ILLEGAL_INTERACT, "maxAngleDifference")) {
|
if (Math.round(angleDifference) > checksConfig.getInteger(CheckType.ILLEGAL_INTERACT, "maxAngleDifference")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
|
*
|
||||||
|
* 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 com.rammelkast.anticheatreloaded.check.player;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.VersionLib;
|
||||||
|
|
||||||
|
public final class NoFallCheck {
|
||||||
|
|
||||||
|
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<>();
|
||||||
|
|
||||||
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
|
public static CheckResult runCheck(final Player player, final double motionY) {
|
||||||
|
final UUID uuid = player.getUniqueId();
|
||||||
|
final Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||||
|
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
if (player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping()
|
||||||
|
&& !backend.isMovingExempt(player) && !backend.justPlaced(player) && !Utilities.isNearWater(player)
|
||||||
|
&& !Utilities.isInWeb(player) && !player.getLocation().getBlock().getType().name().endsWith("TRAPDOOR")
|
||||||
|
&& !VersionLib.isSlowFalling(player)
|
||||||
|
&& !Utilities
|
||||||
|
.isNearShulkerBox(player.getLocation().getBlock().getRelative(BlockFace.DOWN).getLocation())
|
||||||
|
&& !Utilities.isNearClimbable(player)
|
||||||
|
&& !Utilities.isNearWater(player.getLocation().clone().subtract(0, 1.5, 0))
|
||||||
|
&& !Utilities.couldBeOnBoat(player, 0.35, false)) {
|
||||||
|
if (player.getFallDistance() == 0.0) {
|
||||||
|
if (VIOLATIONS.get(uuid) == null) {
|
||||||
|
VIOLATIONS.put(uuid, 1);
|
||||||
|
} else {
|
||||||
|
VIOLATIONS.put(uuid, VIOLATIONS.get(player.getUniqueId()) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
final int violations = VIOLATIONS.get(uuid);
|
||||||
|
final int vlBeforeFlag = checksConfig.getInteger(CheckType.NOFALL, "vlBeforeFlag");
|
||||||
|
if (violations >= vlBeforeFlag) {
|
||||||
|
VIOLATIONS.put(player.getUniqueId(), 1);
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
|
"tried to avoid fall damage (" + violations + " times in a row, max=" + vlBeforeFlag + ")");
|
||||||
|
} else {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
VIOLATIONS.put(uuid, 0);
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -64,21 +64,23 @@ public class CommandBase {
|
|||||||
public void run(CommandSender cs, String[] args) {
|
public void run(CommandSender cs, String[] args) {
|
||||||
if (permission.get(cs)) {
|
if (permission.get(cs)) {
|
||||||
execute(cs, args);
|
execute(cs, args);
|
||||||
} else {
|
} else {
|
||||||
if (args == null) {
|
if (args == null) {
|
||||||
cs.sendMessage(GOLD + "" + ChatColor.BOLD + "AntiCheatReloaded " + GRAY + "version " + AntiCheatReloaded.getVersion());
|
cs.sendMessage(GOLD + "" + ChatColor.BOLD + "ACR" + ChatColor.DARK_GRAY + " > "
|
||||||
} else {
|
+ ChatColor.GRAY + "Running " + GOLD + "AntiCheatReloaded " + GRAY + "version "
|
||||||
cs.sendMessage(PERMISSIONS_ERROR + " (" + WHITE + permission.toString() + RED + ")");
|
+ GOLD + AntiCheatReloaded.getVersion());
|
||||||
}
|
} else {
|
||||||
}
|
cs.sendMessage(PERMISSIONS_ERROR + " (" + WHITE + permission.toString() + RED + ")");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void execute(CommandSender cs, String[] args) {
|
protected void execute(CommandSender cs, String[] args) {
|
||||||
return; // Stub
|
return; // Stub
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendHelp(CommandSender cs) {
|
public void sendHelp(CommandSender cs) {
|
||||||
cs.sendMessage(GOLD + "" + ChatColor.BOLD + "AntiCheatReloaded " + ChatColor.GRAY + "Help Menu");
|
cs.sendMessage(GOLD + "" + ChatColor.BOLD + "AntiCheatReloaded" + ChatColor.DARK_GRAY + " > " + ChatColor.GRAY + "Help Menu");
|
||||||
cs.sendMessage(GOLD + "Usage: " + GRAY + (cs instanceof Player ? "/" : "") + getUsage());
|
cs.sendMessage(GOLD + "Usage: " + GRAY + (cs instanceof Player ? "/" : "") + getUsage());
|
||||||
cs.sendMessage(GOLD + "Permission: " + GRAY + getPermission().toString());
|
cs.sendMessage(GOLD + "Permission: " + GRAY + getPermission().toString());
|
||||||
for (String string : getHelp()) {
|
for (String string : getHelp()) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+30
-25
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,39 +19,44 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.command.executors;
|
package com.rammelkast.anticheatreloaded.command.executors;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||||
|
import com.rammelkast.anticheatreloaded.manage.CheckManager;
|
||||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||||
|
|
||||||
public class CommandChecks extends CommandBase {
|
public class CommandChecks extends CommandBase {
|
||||||
|
|
||||||
private static final String NAME = "AntiCheatReloaded Checks Management";
|
private static final String NAME = "AntiCheatReloaded Checks Management";
|
||||||
private static final String COMMAND = "checks";
|
private static final String COMMAND = "checks";
|
||||||
private static final String USAGE = "anticheat checks";
|
private static final String USAGE = "anticheat checks";
|
||||||
private static final Permission PERMISSION = Permission.SYSTEM_CHECK;
|
private static final Permission PERMISSION = Permission.SYSTEM_CHECK;
|
||||||
private static final String[] HELP = new String[2];
|
private static final String[] HELP = new String[2];
|
||||||
|
|
||||||
static {
|
static {
|
||||||
HELP[0] = GRAY + "Use: " + AQUA + "/anticheat checks" + GRAY + " for a list of checks";
|
HELP[0] = GRAY + "Use: " + AQUA + "/anticheat checks" + GRAY + " for a list of checks";
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append(GRAY + "Checks: ");
|
CheckManager checkManager = AntiCheatReloaded.getManager().getCheckManager();
|
||||||
for (int i=0;i<CheckType.values().length;i++) {
|
builder.append(GRAY + "Checks: ");
|
||||||
builder.append(CheckType.values()[i]);
|
for (int i = 0; i < CheckType.values().length; i++) {
|
||||||
if (i<CheckType.values().length-1) {
|
CheckType type = CheckType.values()[i];
|
||||||
builder.append(", ");
|
builder.append((checkManager.isActive(type) ? ChatColor.GREEN : ChatColor.RED) + type.getName());
|
||||||
}
|
if (i < CheckType.values().length - 1) {
|
||||||
}
|
builder.append(", ");
|
||||||
HELP[1] = builder.toString();
|
}
|
||||||
}
|
}
|
||||||
|
HELP[1] = builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
public CommandChecks() {
|
public CommandChecks() {
|
||||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void execute(CommandSender cs, String[] args) {
|
protected void execute(CommandSender cs, String[] args) {
|
||||||
sendHelp(cs);
|
sendHelp(cs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.command.executors;
|
package com.rammelkast.anticheatreloaded.command.executors;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||||
@@ -41,6 +42,7 @@ public class CommandReload extends CommandBase {
|
|||||||
@Override
|
@Override
|
||||||
protected void execute(CommandSender cs, String[] args) {
|
protected void execute(CommandSender cs, String[] args) {
|
||||||
CONFIG.load();
|
CONFIG.load();
|
||||||
cs.sendMessage(GREEN + "AntiCheat configuration reloaded.");
|
cs.sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> "
|
||||||
|
+ ChatColor.GRAY + "The configuration was reloaded");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+145
-141
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,7 +16,6 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.command.executors;
|
package com.rammelkast.anticheatreloaded.command.executors;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -25,8 +24,8 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
@@ -38,153 +37,158 @@ import com.rammelkast.anticheatreloaded.util.Utilities;
|
|||||||
|
|
||||||
public class CommandReport extends CommandBase {
|
public class CommandReport extends CommandBase {
|
||||||
|
|
||||||
private static final String NAME = "AntiCheatReloaded Reports";
|
private static final String NAME = "AntiCheatReloaded Reports";
|
||||||
private static final String COMMAND = "report";
|
private static final String COMMAND = "report";
|
||||||
private static final String USAGE = "anticheat report [group/user]";
|
private static final String USAGE = "anticheat report [group/user]";
|
||||||
private static final Permission PERMISSION = Permission.SYSTEM_REPORT;
|
private static final Permission PERMISSION = Permission.SYSTEM_REPORT;
|
||||||
private static final String[] HELP = {
|
private static final String[] HELP = {
|
||||||
GRAY + "Use: " + GOLD + "/anticheat report [group]" + GRAY + " to see all users in a given group",
|
GRAY + "Use: " + GOLD + "/anticheat report [group]" + GRAY + " to see all users in a given group",
|
||||||
GRAY + "Use: " + GOLD + "/anticheat report [user]" + GRAY + " to see a single user's report",
|
GRAY + "Use: " + GOLD + "/anticheat report [user]" + GRAY + " to see a single user's report",
|
||||||
GRAY + "Use: " + GOLD + "/anticheat report [user/group] [num]" + GRAY + " to see pages of a report",
|
GRAY + "Use: " + GOLD + "/anticheat report [user/group] [num]" + GRAY + " to see pages of a report", };
|
||||||
};
|
|
||||||
|
|
||||||
public CommandReport() {
|
public CommandReport() {
|
||||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void execute(CommandSender cs, String[] args) {
|
protected void execute(CommandSender cs, String[] args) {
|
||||||
if (args.length >= 1) {
|
if (args.length >= 1) {
|
||||||
int page = 1;
|
int page = 1;
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
if (Utilities.isInt(args[1])) {
|
if (Utilities.isInt(args[1])) {
|
||||||
page = Integer.parseInt(args[1]);
|
page = Integer.parseInt(args[1]);
|
||||||
} else {
|
} else {
|
||||||
cs.sendMessage(RED + "Not a valid page number: " + WHITE + args[1]);
|
cs.sendMessage(RED + "Not a valid page number: " + WHITE + args[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("low".equalsIgnoreCase(args[0])) {
|
if ("low".equalsIgnoreCase(args[0])) {
|
||||||
groupReport(cs, null, page);
|
groupReport(cs, null, page);
|
||||||
}
|
} else if ("all".equalsIgnoreCase(args[0])) {
|
||||||
else if ("all".equalsIgnoreCase(args[0])) {
|
cs.sendMessage(GREEN + "Low: " + WHITE + USER_MANAGER.getUsersInGroup(null).size() + " players");
|
||||||
cs.sendMessage(GREEN + "Low: " + WHITE + USER_MANAGER.getUsersInGroup(null).size() + " players");
|
for (Group g : CONFIG.getGroups().getGroups()) {
|
||||||
for (Group g : CONFIG.getGroups().getGroups()) {
|
int numPlayers = USER_MANAGER.getUsersInGroup(g).size();
|
||||||
int numPlayers = USER_MANAGER.getUsersInGroup(g).size();
|
cs.sendMessage(g.getColor() + g.getName() + WHITE + ": " + numPlayers + " players");
|
||||||
cs.sendMessage(g.getColor() + g.getName() + WHITE + ": " + numPlayers + " players");
|
}
|
||||||
}
|
cs.sendMessage(GRAY + "Use " + GOLD + "/anticheat report [group]" + GRAY
|
||||||
cs.sendMessage(GRAY + "Use " + GOLD + "/anticheat report [group]" + GRAY + " for a list of players in each group.");
|
+ " for a list of players in each group.");
|
||||||
} else {
|
} else {
|
||||||
// Test groups
|
// Test groups
|
||||||
for (Group group : CONFIG.getGroups().getGroups()) {
|
for (Group group : CONFIG.getGroups().getGroups()) {
|
||||||
if (group.getName().equalsIgnoreCase(args[0]) || "low".equalsIgnoreCase(args[0]) || "all".equalsIgnoreCase(args[0])) {
|
if (group.getName().equalsIgnoreCase(args[0]) || "low".equalsIgnoreCase(args[0])
|
||||||
groupReport(cs, group, page);
|
|| "all".equalsIgnoreCase(args[0])) {
|
||||||
return;
|
groupReport(cs, group, page);
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Player targetPlayer = Bukkit.getPlayer(args[0]);
|
|
||||||
if (targetPlayer == null) {
|
|
||||||
cs.sendMessage(RED + "Not a valid group or user: " + WHITE + args[0]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test users
|
@SuppressWarnings("deprecation")
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
OfflinePlayer targetPlayer = Bukkit.getOfflinePlayer(args[0]);
|
||||||
if (player.getUniqueId().equals(Bukkit.getPlayer(args[0]).getUniqueId())) {
|
if (targetPlayer == null) {
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
cs.sendMessage(RED + "Not a valid group or user: " + WHITE + args[0]);
|
||||||
playerReport(cs, user, page);
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Neither of these
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(targetPlayer.getUniqueId());
|
||||||
cs.sendMessage(RED + "Not a valid group or user: " + WHITE + args[0]);
|
if (user != null) {
|
||||||
}
|
playerReport(cs, user, page);
|
||||||
} else {
|
return;
|
||||||
sendHelp(cs);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void groupReport(CommandSender cs, Group group, int page) {
|
cs.sendMessage(RED + "Not a valid group or user: " + WHITE + args[0]);
|
||||||
List<User> users = USER_MANAGER.getUsersInGroup(group);
|
}
|
||||||
ChatColor color = group == null ? GREEN : group.getColor();
|
} else {
|
||||||
String groupName = group == null ? "Low" : group.getName();
|
sendHelp(cs);
|
||||||
int pages = (int) Math.ceil(((float) users.size()) / 7);
|
}
|
||||||
if (page <= pages && page > 0) {
|
}
|
||||||
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page " + page + "/" + pages + "" + GOLD + "]----------------------");
|
|
||||||
cs.sendMessage(GRAY + "Group: " + color + groupName);
|
|
||||||
for (int x = 0; x < 7; x++) {
|
|
||||||
int index = ((page - 1) * 6) + (x + ((page - 1) * 1));
|
|
||||||
if (index < users.size()) {
|
|
||||||
String player = users.get(index).getName();
|
|
||||||
cs.sendMessage(GRAY + player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cs.sendMessage(MENU_END);
|
|
||||||
} else {
|
|
||||||
if (pages == 0) {
|
|
||||||
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page 1/1" + GOLD + "]----------------------");
|
|
||||||
cs.sendMessage(GRAY + "Group: " + color + groupName);
|
|
||||||
cs.sendMessage(GRAY + "There are no users in this group.");
|
|
||||||
cs.sendMessage(MENU_END);
|
|
||||||
} else {
|
|
||||||
cs.sendMessage(RED + "Page not found. Requested " + WHITE + page + RED + ", Max " + WHITE + pages);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void playerReport(CommandSender cs, User user, int page) {
|
private void groupReport(CommandSender cs, Group group, int page) {
|
||||||
List<CheckType> types = new ArrayList<CheckType>();
|
List<User> users = USER_MANAGER.getUsersInGroup(group);
|
||||||
for (CheckType type : CheckType.values()) {
|
ChatColor color = group == null ? GREEN : group.getColor();
|
||||||
if (type.getUses(user.getUUID()) > 0) {
|
String groupName = group == null ? "Low" : group.getName();
|
||||||
types.add(type);
|
int pages = (int) Math.ceil(((float) users.size()) / 7);
|
||||||
}
|
if (page <= pages && page > 0) {
|
||||||
}
|
cs.sendMessage(GOLD + "----------------------[" + WHITE + "Page " + page + "/" + pages + "" + GOLD
|
||||||
|
+ "]----------------------");
|
||||||
|
cs.sendMessage(GRAY + "Group: " + color + groupName);
|
||||||
|
for (int x = 0; x < 7; x++) {
|
||||||
|
int index = ((page - 1) * 6) + (x + ((page - 1) * 1));
|
||||||
|
if (index < users.size()) {
|
||||||
|
String player = users.get(index).getName();
|
||||||
|
cs.sendMessage(GRAY + player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cs.sendMessage(MENU_END);
|
||||||
|
} else {
|
||||||
|
if (pages == 0) {
|
||||||
|
cs.sendMessage(GOLD + "----------------------[" + WHITE + "Page 1/1" + GOLD + "]----------------------");
|
||||||
|
cs.sendMessage(GRAY + "Group: " + color + groupName);
|
||||||
|
cs.sendMessage(GRAY + "There are no users in this group.");
|
||||||
|
cs.sendMessage(MENU_END);
|
||||||
|
} else {
|
||||||
|
cs.sendMessage(RED + "Page not found. Requested " + WHITE + page + RED + ", Max " + WHITE + pages);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UUID uuid = user.getUUID();
|
private void playerReport(CommandSender cs, User user, int page) {
|
||||||
String name = user.getName();
|
List<CheckType> types = new ArrayList<CheckType>();
|
||||||
int pages = (int) Math.ceil(((float) types.size()) / 6);
|
for (CheckType type : CheckType.values()) {
|
||||||
|
if (type.getUses(user.getUUID()) > 0) {
|
||||||
|
types.add(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Group group = user.getGroup();
|
UUID uuid = user.getUUID();
|
||||||
String groupString = GREEN + "Low";
|
String name = user.getName();
|
||||||
|
int pages = (int) Math.ceil(((float) types.size()) / 6);
|
||||||
|
|
||||||
if (group != null) {
|
Group group = user.getGroup();
|
||||||
groupString = group.getColor() + group.getName();
|
String groupString = GREEN + "Low";
|
||||||
}
|
|
||||||
groupString += " (" + user.getLevel() + ")";
|
|
||||||
|
|
||||||
if (page <= pages && page > 0) {
|
if (group != null) {
|
||||||
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page " + page + "/" + pages + "" + GOLD + "]----------------------");
|
groupString = group.getColor() + group.getName();
|
||||||
cs.sendMessage(GRAY + "Player: " + WHITE + name);
|
}
|
||||||
cs.sendMessage(GRAY + "Ping: " + WHITE + user.getPing() + "ms " + (user.isLagging() ? ChatColor.RED + "(lagging)" : ChatColor.GREEN + "(not lagging)"));
|
groupString += " (" + user.getLevel() + ")";
|
||||||
cs.sendMessage(GRAY + "Group: " + groupString);
|
|
||||||
for (int x = 0; x < 6; x++) {
|
if (page <= pages && page > 0) {
|
||||||
int index = ((page - 1) * 5) + (x + ((page - 1)));
|
cs.sendMessage(GOLD + "----------------------[" + WHITE + "Page " + page + "/" + pages + "" + GOLD
|
||||||
if (index < types.size()) {
|
+ "]----------------------");
|
||||||
CheckType type = types.get(index);
|
cs.sendMessage(GRAY + "Player: " + WHITE + name);
|
||||||
int use = type.getUses(uuid);
|
int ping = user.getPing();
|
||||||
ChatColor color = WHITE;
|
cs.sendMessage(GRAY + "Ping: " + ((ping == -1) ? (RED + "Offline")
|
||||||
if (use >= 20) {
|
: (WHITE + "" + ping + "ms "
|
||||||
color = YELLOW;
|
+ (user.isLagging() ? ChatColor.RED + "(lagging)" : ChatColor.GREEN + "(not lagging)"))));
|
||||||
} else if (use > 50) {
|
cs.sendMessage(GRAY + "Group: " + groupString);
|
||||||
color = RED;
|
for (int x = 0; x < 6; x++) {
|
||||||
}
|
int index = ((page - 1) * 5) + (x + ((page - 1)));
|
||||||
cs.sendMessage(GRAY + type.getName() + ": " + color + use);
|
if (index < types.size()) {
|
||||||
}
|
CheckType type = types.get(index);
|
||||||
}
|
int use = type.getUses(uuid);
|
||||||
cs.sendMessage(MENU_END);
|
ChatColor color = WHITE;
|
||||||
} else {
|
if (use >= 20) {
|
||||||
if (pages == 0 && page == 1) {
|
color = YELLOW;
|
||||||
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page 1/1" + GOLD + "]----------------------");
|
} else if (use > 50) {
|
||||||
cs.sendMessage(GRAY + "Player: " + WHITE + name);
|
color = RED;
|
||||||
cs.sendMessage(GRAY + "Ping: " + WHITE + user.getPing() + "ms " + (user.isLagging() ? ChatColor.RED + "(lagging)" : ChatColor.GREEN + "(not lagging)"));
|
}
|
||||||
cs.sendMessage(GRAY + "Group: " + groupString);
|
cs.sendMessage(GRAY + type.getName() + ": " + color + use);
|
||||||
cs.sendMessage(GRAY + "This user has not failed any checks.");
|
}
|
||||||
cs.sendMessage(MENU_END);
|
}
|
||||||
} else {
|
cs.sendMessage(MENU_END);
|
||||||
cs.sendMessage(RED + "Page not found. Requested " + WHITE + page + RED + ", Max " + WHITE + pages + 1);
|
} else {
|
||||||
}
|
if (pages == 0 && page == 1) {
|
||||||
}
|
cs.sendMessage(GOLD + "----------------------[" + WHITE + "Page 1/1" + GOLD + "]----------------------");
|
||||||
}
|
cs.sendMessage(GRAY + "Player: " + WHITE + name);
|
||||||
|
int ping = user.getPing();
|
||||||
|
cs.sendMessage(GRAY + "Ping: " + ((ping == -1) ? (RED + "Offline")
|
||||||
|
: (WHITE + "" + ping + "ms "
|
||||||
|
+ (user.isLagging() ? ChatColor.RED + "(lagging)" : ChatColor.GREEN + "(not lagging)"))));
|
||||||
|
cs.sendMessage(GRAY + "Group: " + groupString);
|
||||||
|
cs.sendMessage(GRAY + "This user has not failed any checks.");
|
||||||
|
cs.sendMessage(MENU_END);
|
||||||
|
} else {
|
||||||
|
cs.sendMessage(RED + "Page not found. Requested " + WHITE + page + RED + ", Max " + WHITE + pages + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -151,12 +151,15 @@ public class Configuration {
|
|||||||
file.load();
|
file.load();
|
||||||
checkReload(file);
|
checkReload(file);
|
||||||
}
|
}
|
||||||
for (ConfigurationTable table : dbfiles) {
|
|
||||||
|
for (ConfigurationTable table : dbfiles)
|
||||||
table.load();
|
table.load();
|
||||||
}
|
|
||||||
if (manager.getBackend() != null) {
|
if (manager.getBackend() != null)
|
||||||
manager.getBackend().updateConfig(this);
|
manager.getBackend().updateConfig(this);
|
||||||
}
|
|
||||||
|
if (manager.getCheckManager() != null)
|
||||||
|
manager.getCheckManager().loadCheckIgnoreList(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkReload(ConfigurationFile file) {
|
private void checkReload(ConfigurationFile file) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -36,6 +36,7 @@ public class Config extends ConfigurationFile {
|
|||||||
public ConfigValue<Boolean> eventChains;
|
public ConfigValue<Boolean> eventChains;
|
||||||
public ConfigValue<Boolean> enterprise;
|
public ConfigValue<Boolean> enterprise;
|
||||||
public ConfigValue<Boolean> debugMode;
|
public ConfigValue<Boolean> debugMode;
|
||||||
|
public ConfigValue<Boolean> disableBroadcast;
|
||||||
|
|
||||||
public ConfigValue<Boolean> blockChatSpamSpeed;
|
public ConfigValue<Boolean> blockChatSpamSpeed;
|
||||||
public ConfigValue<Boolean> blockCommandSpamSpeed;
|
public ConfigValue<Boolean> blockCommandSpamSpeed;
|
||||||
@@ -51,6 +52,7 @@ public class Config extends ConfigurationFile {
|
|||||||
public ConfigValue<List<String>> disabledWorlds;
|
public ConfigValue<List<String>> disabledWorlds;
|
||||||
|
|
||||||
public ConfigValue<Integer> notifyEveryVl;
|
public ConfigValue<Integer> notifyEveryVl;
|
||||||
|
public ConfigValue<Integer> maxSetbackDistance;
|
||||||
|
|
||||||
public Config(AntiCheatReloaded plugin, Configuration config) {
|
public Config(AntiCheatReloaded plugin, Configuration config) {
|
||||||
super(plugin, config, FILENAME);
|
super(plugin, config, FILENAME);
|
||||||
@@ -66,6 +68,7 @@ public class Config extends ConfigurationFile {
|
|||||||
eventChains = new ConfigValue<Boolean>("system.event-chains");
|
eventChains = new ConfigValue<Boolean>("system.event-chains");
|
||||||
enterprise = new ConfigValue<Boolean>("system.enterprise");
|
enterprise = new ConfigValue<Boolean>("system.enterprise");
|
||||||
debugMode = new ConfigValue<Boolean>("system.debug-mode");
|
debugMode = new ConfigValue<Boolean>("system.debug-mode");
|
||||||
|
disableBroadcast = new ConfigValue<Boolean>("system.disable-broadcast");
|
||||||
|
|
||||||
blockChatSpamSpeed = new ConfigValue<Boolean>("spam.chat.block-speed");
|
blockChatSpamSpeed = new ConfigValue<Boolean>("spam.chat.block-speed");
|
||||||
blockChatSpamRepetition = new ConfigValue<Boolean>("spam.chat.block-repetition");
|
blockChatSpamRepetition = new ConfigValue<Boolean>("spam.chat.block-repetition");
|
||||||
@@ -85,5 +88,9 @@ public class Config extends ConfigurationFile {
|
|||||||
if (notifyEveryVl.getValue() < 1) {
|
if (notifyEveryVl.getValue() < 1) {
|
||||||
notifyEveryVl.setValue(5);
|
notifyEveryVl.setValue(5);
|
||||||
}
|
}
|
||||||
|
maxSetbackDistance = new ConfigValue<Integer>("system.max-setback-distance");
|
||||||
|
if (maxSetbackDistance.getValue() < 5) {
|
||||||
|
maxSetbackDistance.setValue(50);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -102,7 +102,7 @@ public class MySQLLevelsHolder extends ConfigurationTable implements Levels {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AntiCheatReloaded.getManager().getUserManager().remove(user);
|
AntiCheatReloaded.getManager().getUserManager().removeUser(user);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+38
-10
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,6 +20,7 @@ package com.rammelkast.anticheatreloaded.config.holders.yaml;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
@@ -42,8 +43,12 @@ public class YamlChecksHolder extends ConfigurationFile implements Checks {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getBoolean(CheckType checkType, String subcheck, String name) {
|
public boolean getBoolean(CheckType checkType, String subcheck, String name) {
|
||||||
return this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getConfigurationSection(subcheck)
|
final ConfigurationSection section = this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getConfigurationSection(subcheck);
|
||||||
.getBoolean(name);
|
if (!section.contains(name)) {
|
||||||
|
AntiCheatReloaded.getPlugin().getLogger().warning("Configuration is missing option '" + section.getCurrentPath() + "." + name + "'");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return section.getBoolean(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -53,29 +58,52 @@ public class YamlChecksHolder extends ConfigurationFile implements Checks {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getDouble(CheckType checkType, String subcheck, String name) {
|
public double getDouble(CheckType checkType, String subcheck, String name) {
|
||||||
return this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getConfigurationSection(subcheck)
|
final ConfigurationSection section = this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getConfigurationSection(subcheck);
|
||||||
.getDouble(name);
|
if (!section.contains(name)) {
|
||||||
|
AntiCheatReloaded.getPlugin().getLogger().warning("Configuration is missing option '" + section.getCurrentPath() + "." + name + "'");
|
||||||
|
return 0.0D;
|
||||||
|
}
|
||||||
|
return section.getDouble(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getInteger(CheckType checkType, String subcheck, String name) {
|
public int getInteger(CheckType checkType, String subcheck, String name) {
|
||||||
return this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getConfigurationSection(subcheck)
|
final ConfigurationSection section = this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getConfigurationSection(subcheck);
|
||||||
.getInt(name);
|
if (!section.contains(name)) {
|
||||||
|
AntiCheatReloaded.getPlugin().getLogger().warning("Configuration is missing option '" + section.getCurrentPath() + "." + name + "'");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return section.getInt(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getBoolean(CheckType checkType, String name) {
|
public boolean getBoolean(CheckType checkType, String name) {
|
||||||
return this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getBoolean(name);
|
final ConfigurationSection section = this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase());
|
||||||
|
if (!section.contains(name)) {
|
||||||
|
AntiCheatReloaded.getPlugin().getLogger().warning("Configuration is missing option '" + section.getCurrentPath() + "." + name + "'");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return section.getBoolean(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getDouble(CheckType checkType, String name) {
|
public double getDouble(CheckType checkType, String name) {
|
||||||
return this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getDouble(name);
|
final ConfigurationSection section = this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase());
|
||||||
|
if (!section.contains(name)) {
|
||||||
|
AntiCheatReloaded.getPlugin().getLogger().warning("Configuration is missing option '" + section.getCurrentPath() + "." + name + "'");
|
||||||
|
return 0.0D;
|
||||||
|
}
|
||||||
|
return section.getDouble(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getInteger(CheckType checkType, String name) {
|
public int getInteger(CheckType checkType, String name) {
|
||||||
return this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getInt(name);
|
final ConfigurationSection section = this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase());
|
||||||
|
if (!section.contains(name)) {
|
||||||
|
AntiCheatReloaded.getPlugin().getLogger().warning("Configuration is missing option '" + section.getCurrentPath() + "." + name + "'");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return section.getInt(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -48,7 +48,7 @@ public class YamlLevelsHolder extends ConfigurationFile implements Levels {
|
|||||||
|
|
||||||
private void saveLevelFromUser(User user, boolean remove) {
|
private void saveLevelFromUser(User user, boolean remove) {
|
||||||
saveLevel(user.getUUID(), user.getLevel());
|
saveLevel(user.getUUID(), user.getLevel());
|
||||||
if (remove) AntiCheatReloaded.getManager().getUserManager().remove(user);
|
if (remove) AntiCheatReloaded.getManager().getUserManager().removeUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -99,4 +99,12 @@ public interface Lang {
|
|||||||
* @return Kicking broadcast.
|
* @return Kicking broadcast.
|
||||||
*/
|
*/
|
||||||
public String KICK_BROADCAST();
|
public String KICK_BROADCAST();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the alert prefix for staff and debug.
|
||||||
|
*
|
||||||
|
* @return Alert prefix.
|
||||||
|
*/
|
||||||
|
public String ALERT_PREFIX();
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -46,42 +46,14 @@ public interface Magic {
|
|||||||
* Time to exempt a player from moving because of teleporting; Type=SYSTEM, Leniency=INCREASE.
|
* Time to exempt a player from moving because of teleporting; Type=SYSTEM, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
public int TELEPORT_TIME();
|
public int TELEPORT_TIME();
|
||||||
/**
|
|
||||||
* Time to exempt a player from moving because of exiting fly mode; Type=SYSTEM, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int EXIT_FLY_TIME();
|
|
||||||
/**
|
/**
|
||||||
* Time to exempt a player from moving because of joining the server; Type=SYSTEM, Leniency=INCREASE.
|
* Time to exempt a player from moving because of joining the server; Type=SYSTEM, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
public int JOIN_TIME();
|
public int JOIN_TIME();
|
||||||
/**
|
|
||||||
* Time to exempt a player from moving because of taking damage; Type=SYSTEM, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int DAMAGE_TIME();
|
|
||||||
/**
|
|
||||||
* Time to exempt a player from moving because of taking damage with knockback effects; Type=SYSTEM, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int KNOCKBACK_DAMAGE_TIME();
|
|
||||||
/**
|
|
||||||
* Time to exempt a player from moving because of taking damage from an explosion; Type=SYSTEM, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int EXPLOSION_DAMAGE_TIME();
|
|
||||||
/**
|
|
||||||
* Time used to schedule increasing a players velocity count - probably not touching this would be good; Type=INTEGER.
|
|
||||||
*/
|
|
||||||
public int VELOCITY_EXTENSION();
|
|
||||||
/**
|
/**
|
||||||
* Time a player is considered to have a change in velocity; Type=SYSTEM, Leniency=INCREASE.
|
* Time a player is considered to have a change in velocity; Type=SYSTEM, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
public int VELOCITY_TIME();
|
public int VELOCITY_TIME();
|
||||||
/**
|
|
||||||
* Time to extend a player's velocity count by; Type=SYSTEM, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int VELOCITY_PREVENT();
|
|
||||||
/**
|
|
||||||
* Maximum amount of velocity tracks; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int VELOCITY_MAXTIMES();
|
|
||||||
/**
|
/**
|
||||||
* Minimum travel distance for move to be considered a teleport and subsequently be ignored; Type=INTEGER, Leniency=INCREASE.
|
* Minimum travel distance for move to be considered a teleport and subsequently be ignored; Type=INTEGER, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+28
-15
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,20 +16,8 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.config.yaml;
|
package com.rammelkast.anticheatreloaded.config.yaml;
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
import org.bukkit.configuration.file.YamlConstructor;
|
|
||||||
import org.bukkit.configuration.file.YamlRepresenter;
|
|
||||||
import org.yaml.snakeyaml.DumperOptions;
|
|
||||||
import org.yaml.snakeyaml.Yaml;
|
|
||||||
import org.yaml.snakeyaml.error.YAMLException;
|
|
||||||
import org.yaml.snakeyaml.representer.Representer;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -40,6 +28,18 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.Validate;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.configuration.file.YamlConstructor;
|
||||||
|
import org.bukkit.configuration.file.YamlRepresenter;
|
||||||
|
import org.yaml.snakeyaml.DumperOptions;
|
||||||
|
import org.yaml.snakeyaml.Yaml;
|
||||||
|
import org.yaml.snakeyaml.error.YAMLException;
|
||||||
|
import org.yaml.snakeyaml.representer.Representer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An extension of {@link org.bukkit.configuration.file.YamlConfiguration} which preserves comments.
|
* An extension of {@link org.bukkit.configuration.file.YamlConfiguration} which preserves comments.
|
||||||
* Note that this implementation is not synchronized.
|
* Note that this implementation is not synchronized.
|
||||||
@@ -87,7 +87,7 @@ public class CommentedConfiguration extends YamlConfiguration {
|
|||||||
blank++;
|
blank++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (lines[i].contains(COMMENT_PREFIX)) {
|
if (lines[i].contains("# ")) {
|
||||||
comments.put(i - blank, lines[i]);
|
comments.put(i - blank, lines[i]);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
@@ -104,7 +104,7 @@ public class CommentedConfiguration extends YamlConfiguration {
|
|||||||
// String header = buildHeader(); - CommentedConfiguration
|
// String header = buildHeader(); - CommentedConfiguration
|
||||||
String dump = yaml.dump(getValues(false));
|
String dump = yaml.dump(getValues(false));
|
||||||
|
|
||||||
if (dump.equals(BLANK_CONFIG)) {
|
if (dump.equals("{}\\n")) {
|
||||||
dump = "";
|
dump = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,4 +201,17 @@ public class CommentedConfiguration extends YamlConfiguration {
|
|||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void convertMapsToSections(Map<?, ?> input, ConfigurationSection section) {
|
||||||
|
for (Map.Entry<?, ?> entry : input.entrySet()) {
|
||||||
|
String key = entry.getKey().toString();
|
||||||
|
Object value = entry.getValue();
|
||||||
|
|
||||||
|
if (value instanceof Map) {
|
||||||
|
convertMapsToSections((Map<?, ?>) value, section.createSection(key));
|
||||||
|
} else {
|
||||||
|
section.set(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,60 +20,55 @@ package com.rammelkast.anticheatreloaded.event;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.check.player.IllegalInteract;
|
import com.rammelkast.anticheatreloaded.check.player.IllegalInteractCheck;
|
||||||
|
|
||||||
public class BlockListener extends EventListener {
|
public final class BlockListener extends EventListener {
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
public void onBlockPlace(final BlockPlaceEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
boolean noHack = true;
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.FAST_PLACE)) {
|
if (getCheckManager().willCheck(player, CheckType.FAST_PLACE)) {
|
||||||
CheckResult result = getBackend().checkFastPlace(player);
|
final CheckResult result = getBackend().checkFastPlace(player);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
log(result.getMessage(), player, CheckType.FAST_PLACE);
|
log(result.getMessage(), player, CheckType.FAST_PLACE, result.getSubCheck());
|
||||||
noHack = false;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) {
|
if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) {
|
||||||
CheckResult result = IllegalInteract.performCheck(player, event);
|
final CheckResult result = IllegalInteractCheck.runCheck(player, event);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT);
|
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT, result.getSubCheck());
|
||||||
noHack = false;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (noHack) {
|
|
||||||
decrease(player);
|
decrease(player);
|
||||||
getBackend().logBlockPlace(player);
|
getBackend().logBlockPlace(player);
|
||||||
}
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
public void onBlockBreak(final BlockBreakEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
boolean noHack = true;
|
|
||||||
CheckResult result;
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) {
|
if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) {
|
||||||
result = IllegalInteract.performCheck(player, event);
|
final CheckResult result = IllegalInteractCheck.runCheck(player, event);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT);
|
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT, result.getSubCheck());
|
||||||
noHack = false;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (noHack) {
|
|
||||||
decrease(player);
|
decrease(player);
|
||||||
}
|
|
||||||
getBackend().logBlockBreak(player);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,15 +19,12 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.event;
|
package com.rammelkast.anticheatreloaded.event;
|
||||||
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
import org.bukkit.entity.Creeper;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||||
@@ -38,127 +35,142 @@ import com.rammelkast.anticheatreloaded.check.CheckResult;
|
|||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.check.combat.CriticalsCheck;
|
import com.rammelkast.anticheatreloaded.check.combat.CriticalsCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.check.movement.AimbotCheck;
|
||||||
|
|
||||||
public class EntityListener extends EventListener {
|
public class EntityListener extends EventListener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntityPotionEffect(EntityPotionEffectEvent event) {
|
public void onEntityShootBow(EntityShootBowEvent event) {
|
||||||
if (!(event.getEntity() instanceof Player))
|
if (event.getEntity() instanceof Player) {
|
||||||
return;
|
Player player = (Player) event.getEntity();
|
||||||
if (event.getNewEffect() == null)
|
if (getCheckManager().willCheck(player, CheckType.FAST_BOW)) {
|
||||||
return;
|
CheckResult result = getBackend().checkFastBow(player, event.getForce());
|
||||||
if (!VersionUtil.isLevitationEffect(event.getNewEffect()))
|
if (result.failed()) {
|
||||||
return;
|
event.setCancelled(!silentMode());
|
||||||
getBackend().logLevitating((Player) event.getEntity(), event.getNewEffect().getDuration());
|
log(result.getMessage(), player, CheckType.FAST_BOW, result.getSubCheck());
|
||||||
|
} else {
|
||||||
|
decrease(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntityShootBow(EntityShootBowEvent event) {
|
public void onEntityRegainHealth(EntityRegainHealthEvent event) {
|
||||||
if (event.getEntity() instanceof Player) {
|
if (event.getEntity() instanceof Player && event.getRegainReason() == RegainReason.SATIATED) {
|
||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
if (getCheckManager().willCheck(player, CheckType.FAST_BOW)) {
|
if (getCheckManager().willCheck(player, CheckType.FAST_HEAL)) {
|
||||||
CheckResult result = getBackend().checkFastBow(player, event.getForce());
|
CheckResult result = getBackend().checkFastHeal(player);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
log(result.getMessage(), player, CheckType.FAST_BOW);
|
log(result.getMessage(), player, CheckType.FAST_HEAL, result.getSubCheck());
|
||||||
} else {
|
} else {
|
||||||
decrease(player);
|
decrease(player);
|
||||||
}
|
getBackend().logHeal(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntityRegainHealth(EntityRegainHealthEvent event) {
|
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
||||||
if (event.getEntity() instanceof Player && event.getRegainReason() == RegainReason.SATIATED) {
|
if (event.getEntity() instanceof Player) {
|
||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
if (getCheckManager().willCheck(player, CheckType.FAST_HEAL)) {
|
if (player.getFoodLevel() < event.getFoodLevel()
|
||||||
CheckResult result = getBackend().checkFastHeal(player);
|
&& getCheckManager().willCheck(player, CheckType.FAST_EAT)) {
|
||||||
if (result.failed()) {
|
CheckResult result = getBackend().checkFastEat(player);
|
||||||
event.setCancelled(!silentMode());
|
if (result.failed()) {
|
||||||
log(result.getMessage(), player, CheckType.FAST_HEAL);
|
event.setCancelled(!silentMode());
|
||||||
} else {
|
log(result.getMessage(), player, CheckType.FAST_EAT, result.getSubCheck());
|
||||||
decrease(player);
|
} else {
|
||||||
getBackend().logHeal(player);
|
decrease(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
public void onEntityDamage(final EntityDamageEvent event) {
|
||||||
if (event.getEntity() instanceof Player) {
|
if (event instanceof EntityDamageByEntityEvent) {
|
||||||
Player player = (Player) event.getEntity();
|
final EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event;
|
||||||
if (player.getFoodLevel() < event.getFoodLevel() && getCheckManager().willCheck(player, CheckType.FAST_EAT)) // Make sure it's them actually gaining a food level
|
if (e.getDamager() instanceof Player) {
|
||||||
{
|
if (getCheckManager().willCheck((Player) e.getDamager(), CheckType.CRITICALS)) {
|
||||||
CheckResult result = getBackend().checkFastEat(player);
|
CriticalsCheck.doDamageEvent(e, (Player) e.getDamager());
|
||||||
if (result.failed()) {
|
}
|
||||||
event.setCancelled(!silentMode());
|
if (getCheckManager().willCheckQuick((Player) e.getDamager(), CheckType.AIMBOT)) {
|
||||||
log(result.getMessage(), player, CheckType.FAST_EAT);
|
final CheckResult result = AimbotCheck.runCheck((Player) e.getDamager(), e);
|
||||||
} else {
|
if (result.failed()) {
|
||||||
decrease(player);
|
log(result.getMessage(), (Player) e.getDamager(), CheckType.AIMBOT, result.getSubCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
if (e.getDamager() instanceof Player && event.getCause() == DamageCause.ENTITY_ATTACK) {
|
||||||
}
|
final Player player = (Player) e.getDamager();
|
||||||
|
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||||
|
final CheckResult result = KillAuraCheck.checkAngle(player, event);
|
||||||
|
if (result.failed()) {
|
||||||
|
event.setCancelled(!silentMode());
|
||||||
|
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled = true)
|
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||||
public void onEntityDamage(EntityDamageEvent event) {
|
final CheckResult result = KillAuraCheck.checkReach(player, event.getEntity());
|
||||||
boolean noHack = true;
|
if (result.failed()) {
|
||||||
if (event instanceof EntityDamageByEntityEvent) {
|
event.setCancelled(!silentMode());
|
||||||
EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event;
|
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
|
||||||
if (e.getDamager() instanceof Player) {
|
return;
|
||||||
if (getCheckManager().willCheck((Player)e.getDamager(), CheckType.CRITICALS)) {
|
}
|
||||||
CriticalsCheck.doDamageEvent(e, (Player)e.getDamager());
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
if (event.getEntity() instanceof Player) {
|
|
||||||
Player player = (Player) event.getEntity();
|
|
||||||
if (e.getDamager() instanceof Player) {
|
|
||||||
Player p = (Player) e.getDamager();
|
|
||||||
getBackend().logDamage(p, 1);
|
|
||||||
int value = VersionUtil.getItemInHand(player).containsEnchantment(Enchantment.KNOCKBACK) ? 2 : 1;
|
|
||||||
getBackend().logDamage(player, value);
|
|
||||||
} else {
|
|
||||||
if (e.getDamager() instanceof TNTPrimed || e.getDamager() instanceof Creeper) {
|
|
||||||
getBackend().logDamage(player, 3);
|
|
||||||
} else {
|
|
||||||
getBackend().logDamage(player, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (e.getDamager() instanceof Player) {
|
|
||||||
Player player = (Player) e.getDamager();
|
|
||||||
getBackend().logDamage(player, 1);
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
|
||||||
CheckResult result = KillAuraCheck.checkAngle(player, event);
|
|
||||||
if (result.failed()) {
|
|
||||||
event.setCancelled(!silentMode());
|
|
||||||
log(result.getMessage(), player, CheckType.KILLAURA);
|
|
||||||
noHack = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
|
||||||
CheckResult result = KillAuraCheck.checkReach(player, event.getEntity());
|
|
||||||
if (result.failed()) {
|
|
||||||
event.setCancelled(!silentMode());
|
|
||||||
log(result.getMessage(), player, CheckType.KILLAURA);
|
|
||||||
noHack = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (noHack) {
|
|
||||||
decrease(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||||
}
|
final CheckResult result = KillAuraCheck.checkPacketOrder(player, event.getEntity());
|
||||||
|
if (result.failed()) {
|
||||||
|
event.setCancelled(!silentMode());
|
||||||
|
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||||
|
final CheckResult result = KillAuraCheck.checkRepeatedAim(player);
|
||||||
|
if (result.failed()) {
|
||||||
|
event.setCancelled(!silentMode());
|
||||||
|
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||||
|
final CheckResult result = KillAuraCheck.checkVariance(player);
|
||||||
|
if (result.failed()) {
|
||||||
|
event.setCancelled(!silentMode());
|
||||||
|
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||||
|
final CheckResult result = KillAuraCheck.checkThroughWalls(player, event.getEntity());
|
||||||
|
if (result.failed()) {
|
||||||
|
event.setCancelled(!silentMode());
|
||||||
|
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
decrease(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,12 +16,13 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.event;
|
package com.rammelkast.anticheatreloaded.event;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
import java.text.DecimalFormatSymbols;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@@ -48,7 +49,12 @@ public class EventListener implements Listener {
|
|||||||
private static final Configuration CONFIG = AntiCheatReloaded.getManager().getConfiguration();
|
private static final Configuration CONFIG = AntiCheatReloaded.getManager().getConfiguration();
|
||||||
private static final DecimalFormat TPS_FORMAT = new DecimalFormat("##.##");
|
private static final DecimalFormat TPS_FORMAT = new DecimalFormat("##.##");
|
||||||
|
|
||||||
public static void log(String message, Player player, CheckType type) {
|
static {
|
||||||
|
// What the hell, Java..
|
||||||
|
TPS_FORMAT.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ENGLISH));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void log(String message, Player player, CheckType type, String subcheck) {
|
||||||
User user = getUserManager().getUser(player.getUniqueId());
|
User user = getUserManager().getUser(player.getUniqueId());
|
||||||
if (user == null)
|
if (user == null)
|
||||||
return;
|
return;
|
||||||
@@ -56,23 +62,26 @@ public class EventListener implements Listener {
|
|||||||
boolean debugMode = CONFIG.getConfig().debugMode.getValue();
|
boolean debugMode = CONFIG.getConfig().debugMode.getValue();
|
||||||
int vlForType = type.getUses(player.getUniqueId()) + 1;
|
int vlForType = type.getUses(player.getUniqueId()) + 1;
|
||||||
int notifyEveryVl = CONFIG.getConfig().notifyEveryVl.getValue();
|
int notifyEveryVl = CONFIG.getConfig().notifyEveryVl.getValue();
|
||||||
|
String prefix = ChatColor.translateAlternateColorCodes('&', CONFIG.getLang().ALERT_PREFIX());
|
||||||
if (message == null || message.equals("")) {
|
if (message == null || message.equals("")) {
|
||||||
if (debugMode) {
|
if (debugMode) {
|
||||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.GRAY + player.getName() + " failed "
|
message = prefix + player.getName() + " failed "
|
||||||
+ type.getName();
|
+ type.getName() + (subcheck != null ? (" (" + subcheck + ")") : "");
|
||||||
} else {
|
} else {
|
||||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.GRAY + player.getName() + " failed "
|
message = prefix + player.getName() + " failed "
|
||||||
+ type.getName() + ChatColor.GOLD + " (x" + vlForType + ")";
|
+ type.getName() + (subcheck != null ? (" (" + subcheck + ")") : "") + ChatColor.GOLD + " (x" + vlForType + ")";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (debugMode) {
|
if (debugMode) {
|
||||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.GRAY + player.getName() + " failed "
|
message = prefix + player.getName() + " failed "
|
||||||
+ type.getName() + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + message
|
+ type.getName() + (subcheck != null ? (" (" + subcheck + ")") : "") + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + message
|
||||||
+ ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + "ping: " + user.getPing() + "ms"
|
+ ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + "ping: " + user.getPing() + "ms"
|
||||||
+ ", tps: " + TPS_FORMAT.format(AntiCheatReloaded.getPlugin().getTPS());
|
+ ", tps: " + TPS_FORMAT.format(AntiCheatReloaded.getPlugin().getTPS());
|
||||||
} else {
|
} else {
|
||||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.GRAY + player.getName() + " failed "
|
message = prefix
|
||||||
+ type.getName() + ChatColor.GOLD + " (x" + vlForType + ")" + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + "ping: " + user.getPing() + "ms"
|
+ player.getName() + " failed " + type.getName() + ChatColor.GOLD + " (x" + vlForType + ")"
|
||||||
|
+ ChatColor.DARK_GRAY + " | " + ChatColor.GRAY
|
||||||
|
+ (subcheck != null ? ("type: " + subcheck.toLowerCase() + ", ") : "") + "ping: " + user.getPing() + "ms"
|
||||||
+ ", tps: " + TPS_FORMAT.format(AntiCheatReloaded.getPlugin().getTPS());
|
+ ", tps: " + TPS_FORMAT.format(AntiCheatReloaded.getPlugin().getTPS());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -22,14 +22,10 @@ package com.rammelkast.anticheatreloaded.event;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.util.User;
|
|
||||||
|
|
||||||
public class InventoryListener extends EventListener {
|
public class InventoryListener extends EventListener {
|
||||||
|
|
||||||
@@ -41,11 +37,9 @@ public class InventoryListener extends EventListener {
|
|||||||
CheckResult result = getBackend().checkInventoryClicks(player);
|
CheckResult result = getBackend().checkInventoryClicks(player);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
//getUserManager().getUser(player.getName()).restoreInventory(event.getInventory());
|
|
||||||
player.getInventory().clear();
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.FAST_INVENTORY);
|
log(result.getMessage(), player, CheckType.FAST_INVENTORY, result.getSubCheck());
|
||||||
} else {
|
} else {
|
||||||
decrease(player);
|
decrease(player);
|
||||||
}
|
}
|
||||||
@@ -55,18 +49,4 @@ public class InventoryListener extends EventListener {
|
|||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onInventoryOpen(InventoryOpenEvent event) {
|
|
||||||
if (event.getInventory().getType() != InventoryType.BEACON) {
|
|
||||||
getUserManager().getUser(event.getPlayer().getUniqueId()).setInventorySnapshot(event.getInventory().getContents());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onInventoryClose(InventoryCloseEvent event) {
|
|
||||||
User user = getUserManager().getUser(event.getPlayer().getUniqueId());
|
|
||||||
if (user != null) {
|
|
||||||
user.removeInventorySnapshot();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
|
*
|
||||||
|
* 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 com.rammelkast.anticheatreloaded.event;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.PacketType;
|
||||||
|
import com.comphenix.protocol.events.ListenerPriority;
|
||||||
|
import com.comphenix.protocol.events.PacketAdapter;
|
||||||
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
|
import com.comphenix.protocol.injector.server.TemporaryPlayer;
|
||||||
|
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerDigType;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.movement.NoSlowCheck;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.packet.BadPacketsCheck;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.packet.MorePacketsCheck;
|
||||||
|
|
||||||
|
public final class PacketListener extends PacketAdapter {
|
||||||
|
|
||||||
|
public PacketListener(final Plugin plugin) {
|
||||||
|
super(plugin, ListenerPriority.LOWEST, PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK,
|
||||||
|
PacketType.Play.Client.LOOK, PacketType.Play.Server.POSITION, PacketType.Play.Client.BLOCK_DIG);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPacketReceiving(final PacketEvent event) {
|
||||||
|
final Player player = event.getPlayer();
|
||||||
|
if (player == null || !player.isOnline()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if we have an actual player object
|
||||||
|
if (player instanceof TemporaryPlayer) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final PacketType type = event.getPacketType();
|
||||||
|
final PacketContainer packet = event.getPacket();
|
||||||
|
if (type == PacketType.Play.Client.POSITION || type == PacketType.Play.Client.POSITION_LOOK) {
|
||||||
|
// Run MorePackets check
|
||||||
|
MorePacketsCheck.runCheck(player, event);
|
||||||
|
// Run BadPackets check
|
||||||
|
BadPacketsCheck.runCheck(player, event);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getPacketType() == PacketType.Play.Client.BLOCK_DIG) {
|
||||||
|
if (packet.getPlayerDigTypes().read(0) == PlayerDigType.RELEASE_USE_ITEM) {
|
||||||
|
// Run NoSlow check
|
||||||
|
NoSlowCheck.runCheck(event.getPlayer(), event);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPacketSending(final PacketEvent event) {
|
||||||
|
final Player player = event.getPlayer();
|
||||||
|
if (player == null || !player.isOnline()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if we have an actual player object
|
||||||
|
if (player instanceof TemporaryPlayer) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final PacketType type = event.getPacketType();
|
||||||
|
if (type == PacketType.Play.Server.POSITION) {
|
||||||
|
// Compensate for teleport
|
||||||
|
MorePacketsCheck.compensate(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,6 +19,10 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.event;
|
package com.rammelkast.anticheatreloaded.event;
|
||||||
|
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -32,7 +36,6 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
|
||||||
import org.bukkit.event.player.PlayerBedEnterEvent;
|
import org.bukkit.event.player.PlayerBedEnterEvent;
|
||||||
import org.bukkit.event.player.PlayerBedLeaveEvent;
|
import org.bukkit.event.player.PlayerBedLeaveEvent;
|
||||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||||
@@ -46,7 +49,6 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
|||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
|
||||||
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||||
@@ -55,145 +57,148 @@ import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
|||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import com.cryptomorin.xseries.XMaterial;
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
|
import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.AimbotCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.BoatFlyCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.FastLadderCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.FastLadderCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.movement.StrafeCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.WaterWalkCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.WaterWalkCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.player.IllegalInteract;
|
import com.rammelkast.anticheatreloaded.check.player.IllegalInteractCheck;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.player.NoFallCheck;
|
||||||
|
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
|
||||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.util.VersionLib;
|
||||||
|
|
||||||
public class PlayerListener extends EventListener {
|
public final class PlayerListener extends EventListener {
|
||||||
|
|
||||||
|
private static final AntiCheatManager MANAGER = AntiCheatReloaded.getManager();
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||||
Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
if (getCheckManager().willCheck(player, CheckType.COMMAND_SPAM)
|
if (getCheckManager().willCheck(player, CheckType.COMMAND_SPAM)
|
||||||
&& !Permission.getCommandExempt(player, event.getMessage().split(" ")[0])) {
|
&& !Permission.getCommandExempt(player, event.getMessage().split(" ")[0])) {
|
||||||
CheckResult result = getBackend().checkCommandSpam(player, event.getMessage());
|
final CheckResult result = getBackend().checkCommandSpam(player, event.getMessage());
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
if (!silentMode())
|
if (!silentMode())
|
||||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', result.getMessage()));
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&', result.getMessage()));
|
||||||
getBackend().processCommandSpammer(player);
|
getBackend().processCommandSpammer(player);
|
||||||
log(null, player, CheckType.COMMAND_SPAM);
|
log(null, player, CheckType.COMMAND_SPAM, result.getSubCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
MANAGER.addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerToggleFlight(PlayerToggleFlightEvent event) {
|
public void onPlayerToggleFlight(final PlayerToggleFlightEvent event) {
|
||||||
if (!event.isFlying()) {
|
if (!event.isFlying()) {
|
||||||
getBackend().logEnterExit(event.getPlayer());
|
getBackend().logEnterExit(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
MANAGER.addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {
|
public void onPlayerGameModeChange(final PlayerGameModeChangeEvent event) {
|
||||||
if (event.getNewGameMode() != GameMode.CREATIVE) {
|
if (event.getNewGameMode() != GameMode.CREATIVE) {
|
||||||
getBackend().logEnterExit(event.getPlayer());
|
getBackend().logEnterExit(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
MANAGER.addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
public void onProjectileLaunch(final ProjectileLaunchEvent event) {
|
||||||
if (event.getEntity().getShooter() instanceof Player) {
|
if (event.getEntity().getShooter() instanceof Player) {
|
||||||
Player player = (Player) event.getEntity().getShooter();
|
final Player player = (Player) event.getEntity().getShooter();
|
||||||
|
|
||||||
if (event.getEntity() instanceof Arrow) {
|
if (event.getEntity() instanceof Arrow) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.FAST_PROJECTILE)) {
|
if (getCheckManager().willCheck(player, CheckType.FAST_PROJECTILE)) {
|
||||||
CheckResult result = getBackend().checkProjectile(player);
|
final CheckResult result = getBackend().checkProjectile(player);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
log(result.getMessage(), player, CheckType.FAST_PROJECTILE);
|
log(result.getMessage(), player, CheckType.FAST_PROJECTILE, result.getSubCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
MANAGER.addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
public void onPlayerTeleport(final PlayerTeleportEvent event) {
|
||||||
if (event.getCause() == TeleportCause.ENDER_PEARL || event.getCause() == TeleportCause.PLUGIN) {
|
getBackend().logTeleport(event.getPlayer());
|
||||||
getBackend().logTeleport(event.getPlayer());
|
MANAGER.addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerChangeWorlds(PlayerChangedWorldEvent event) {
|
public void onPlayerChangeWorlds(final PlayerChangedWorldEvent event) {
|
||||||
getBackend().logTeleport(event.getPlayer());
|
getBackend().logTeleport(event.getPlayer());
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
MANAGER.addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerToggleSneak(PlayerToggleSneakEvent event) {
|
public void onPlayerToggleSneak(final PlayerToggleSneakEvent event) {
|
||||||
Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
if (event.isSneaking()) {
|
if (event.isSneaking()) {
|
||||||
if (getCheckManager().willCheck(player, CheckType.SNEAK)) {
|
if (getCheckManager().willCheck(player, CheckType.SNEAK)) {
|
||||||
CheckResult result = getBackend().checkSneakToggle(player);
|
final CheckResult result = getBackend().checkSneakToggle(player);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
log(result.getMessage(), player, CheckType.SNEAK);
|
log(result.getMessage(), player, CheckType.SNEAK, result.getSubCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// getBackend().logToggleSneak(event.getPlayer());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
MANAGER.addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerVelocity(PlayerVelocityEvent event) {
|
public void onPlayerVelocity(final PlayerVelocityEvent event) {
|
||||||
Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
if (getCheckManager().willCheck(player, CheckType.FLIGHT)) {
|
final Vector velocity = event.getVelocity();
|
||||||
if (getBackend().justVelocity(player) && getBackend().extendVelocityTime(player)) {
|
final User user = MANAGER.getUserManager().getUser(player.getUniqueId());
|
||||||
event.setCancelled(!silentMode());
|
final boolean debugMode = MANAGER.getConfiguration().getConfig().debugMode.getValue();
|
||||||
return;
|
user.getVelocityTracker().registerVelocity(velocity);
|
||||||
}
|
if (debugMode) {
|
||||||
getBackend().logVelocity(player);
|
player.sendMessage(AntiCheatReloaded.PREFIX + "Registered velocity [" + velocity.toString() + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Part of Velocity check
|
// Part of Velocity check
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager()
|
if (!user.getMovementManager().onGround) {
|
||||||
.getUser(event.getPlayer().getUniqueId());
|
|
||||||
if (!user.getMovementManager().onGround)
|
|
||||||
return;
|
return;
|
||||||
double motionY = event.getVelocity().getY();
|
}
|
||||||
|
|
||||||
|
final double motionY = velocity.getY();
|
||||||
user.getMovementManager().velocityExpectedMotionY = motionY;
|
user.getMovementManager().velocityExpectedMotionY = motionY;
|
||||||
// End part of Velocity check
|
// End part of Velocity check
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
MANAGER.addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
public void onPlayerChat(final AsyncPlayerChatEvent event) {
|
||||||
Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.CHAT_SPAM)) {
|
if (getCheckManager().willCheck(player, CheckType.CHAT_SPAM)) {
|
||||||
CheckResult result = getBackend().checkChatSpam(player, event.getMessage());
|
final CheckResult result = getBackend().checkChatSpam(player, event.getMessage());
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
if (!result.getMessage().equals("") && !silentMode()) {
|
if (!result.getMessage().equals("") && !silentMode()) {
|
||||||
@@ -203,87 +208,92 @@ public class PlayerListener extends EventListener {
|
|||||||
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
log(null, player, CheckType.CHAT_SPAM);
|
log(null, player, CheckType.CHAT_SPAM, result.getSubCheck());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.CHAT_UNICODE)) {
|
if (getCheckManager().willCheck(player, CheckType.CHAT_UNICODE)) {
|
||||||
CheckResult result = getBackend().checkChatUnicode(player, event.getMessage());
|
final CheckResult result = getBackend().checkChatUnicode(player, event.getMessage());
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', result.getMessage()));
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&', result.getMessage()));
|
||||||
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
log(null, player, CheckType.CHAT_UNICODE);
|
log(null, player, CheckType.CHAT_UNICODE, result.getSubCheck());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
MANAGER.addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerKick(PlayerKickEvent event) {
|
public void onPlayerKick(PlayerKickEvent event) {
|
||||||
getBackend().garbageClean(event.getPlayer());
|
getBackend().cleanup(event.getPlayer());
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
MANAGER.addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
public void onPlayerQuit(final PlayerQuitEvent event) {
|
||||||
getBackend().garbageClean(event.getPlayer());
|
final Player player = event.getPlayer();
|
||||||
|
try {
|
||||||
User user = getUserManager().getUser(event.getPlayer().getUniqueId());
|
final User user = AntiCheatReloaded.getExecutor().submit(new Callable<User>() {
|
||||||
|
@Override
|
||||||
getConfig().getLevels().saveLevelFromUser(user);
|
public User call() throws Exception {
|
||||||
|
getBackend().cleanup(player);
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
final User user = getUserManager().getUser(player.getUniqueId());
|
||||||
}
|
getConfig().getLevels().saveLevelFromUser(user);
|
||||||
|
return user;
|
||||||
@EventHandler
|
}
|
||||||
public void onPlayerVehicleCollide(VehicleEntityCollisionEvent event) {
|
}).get();
|
||||||
if (!(event.getVehicle() instanceof Boat) || !(event.getEntity() instanceof Player))
|
getUserManager().removeUser(user);
|
||||||
|
} catch (final InterruptedException | ExecutionException exception) {
|
||||||
|
AntiCheatReloaded.getPlugin().getLogger().log(Level.SEVERE, "Failed to destroy user object async",
|
||||||
|
exception);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Player player = (Player) event.getEntity();
|
MANAGER.addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
public void onPlayerVehicleCollide(final VehicleEntityCollisionEvent event) {
|
||||||
|
if (!(event.getVehicle() instanceof Boat) || !(event.getEntity() instanceof Player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Player player = (Player) event.getEntity();
|
||||||
getBackend().logBoatCollision(player);
|
getBackend().logBoatCollision(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerToggleSprint(PlayerToggleSprintEvent event) {
|
public void onPlayerToggleSprint(PlayerToggleSprintEvent event) {
|
||||||
Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
if (!event.isSprinting()) {
|
|
||||||
getBackend().logEnterExit(player);
|
|
||||||
}
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.SPRINT)) {
|
if (getCheckManager().willCheck(player, CheckType.SPRINT)) {
|
||||||
CheckResult result = getBackend().checkSprintHungry(event);
|
final CheckResult result = getBackend().checkSprintHungry(event);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
log(result.getMessage(), player, CheckType.SPRINT);
|
log(result.getMessage(), player, CheckType.SPRINT, result.getSubCheck());
|
||||||
} else {
|
} else {
|
||||||
decrease(player);
|
decrease(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
MANAGER.addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(final PlayerInteractEvent event) {
|
||||||
Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
PlayerInventory inv = player.getInventory();
|
final PlayerInventory inv = player.getInventory();
|
||||||
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
ItemStack itemInHand;
|
final ItemStack itemInHand = ((event.getHand() == EquipmentSlot.HAND) ? inv.getItemInMainHand()
|
||||||
if (VersionUtil.isBountifulUpdate()) {
|
: inv.getItemInOffHand());
|
||||||
itemInHand = VersionUtil.getItemInHand(player);
|
|
||||||
} else {
|
|
||||||
itemInHand = ((event.getHand() == EquipmentSlot.HAND) ? inv.getItemInMainHand()
|
|
||||||
: inv.getItemInOffHand());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itemInHand.getType() == Material.BOW) {
|
if (itemInHand.getType() == Material.BOW) {
|
||||||
getBackend().logBowWindUp(player);
|
getBackend().logBowWindUp(player);
|
||||||
@@ -291,80 +301,86 @@ public class PlayerListener extends EventListener {
|
|||||||
getBackend().logEatingStart(player);
|
getBackend().logEatingStart(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!VersionUtil.isBountifulUpdate()) {
|
if (itemInHand.getType() == XMaterial.FIREWORK_ROCKET.parseMaterial()) {
|
||||||
if (itemInHand.getType() == Material.FIREWORK_ROCKET) {
|
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId());
|
||||||
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId());
|
if (player.isGliding()) {
|
||||||
if (player.isGliding()) {
|
ElytraCheck.JUMP_Y_VALUE.put(player.getUniqueId(), 9999.99D);
|
||||||
// TODO config max elytra height?
|
|
||||||
ElytraCheck.JUMP_Y_VALUE.put(player.getUniqueId(), 9999.99D);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Block block = event.getClickedBlock();
|
final Block block = event.getClickedBlock();
|
||||||
if (block != null
|
if (block != null
|
||||||
&& (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK)) {
|
&& (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK)) {
|
||||||
if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) {
|
if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) {
|
||||||
CheckResult result = IllegalInteract.performCheck(player, event);
|
final CheckResult result = IllegalInteractCheck.runCheck(player, event);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT);
|
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT, result.getSubCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
MANAGER.addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||||
Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
if (getCheckManager().willCheck(player, CheckType.ITEM_SPAM)) {
|
if (getCheckManager().willCheck(player, CheckType.ITEM_SPAM)) {
|
||||||
CheckResult result = getBackend().checkFastDrop(player);
|
CheckResult result = getBackend().checkFastDrop(player);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
log(result.getMessage(), player, CheckType.ITEM_SPAM);
|
log(result.getMessage(), player, CheckType.ITEM_SPAM, result.getSubCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
MANAGER.addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerEnterBed(PlayerBedEnterEvent event) {
|
public void onPlayerEnterBed(PlayerBedEnterEvent event) {
|
||||||
if (event.getBed().getType().name().endsWith("BED"))
|
if (event.getBed().getType().name().endsWith("BED")) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
getBackend().logEnterExit(event.getPlayer());
|
getBackend().logEnterExit(event.getPlayer());
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
MANAGER.addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerExitBed(PlayerBedLeaveEvent event) {
|
public void onPlayerExitBed(PlayerBedLeaveEvent event) {
|
||||||
if (event.getBed().getType().name().endsWith("BED"))
|
if (event.getBed().getType().name().endsWith("BED")) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
getBackend().logEnterExit(event.getPlayer());
|
getBackend().logEnterExit(event.getPlayer());
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
MANAGER.addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerAnimation(PlayerAnimationEvent event) {
|
public void onPlayerJoin(final PlayerJoinEvent event) {
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
final Player player = event.getPlayer();
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
getBackend().logJoin(player);
|
getBackend().logJoin(player);
|
||||||
|
|
||||||
User user = new User(player.getUniqueId());
|
try {
|
||||||
user.setIsWaitingOnLevelSync(true);
|
final User user = AntiCheatReloaded.getExecutor().submit(new Callable<User>() {
|
||||||
getConfig().getLevels().loadLevelToUser(user);
|
@Override
|
||||||
getUserManager().addUser(user);
|
public User call() throws Exception {
|
||||||
|
final User user = new User(player.getUniqueId());
|
||||||
|
user.setIsWaitingOnLevelSync(true);
|
||||||
|
getConfig().getLevels().loadLevelToUser(user);
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
}).get();
|
||||||
|
getUserManager().addUser(user);
|
||||||
|
} catch (final InterruptedException | ExecutionException exception) {
|
||||||
|
AntiCheatReloaded.getPlugin().getLogger().log(Level.SEVERE, "Failed to create user object async",
|
||||||
|
exception);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
MANAGER.addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
|
|
||||||
if (player.hasPermission("anticheat.admin") && !AntiCheatReloaded.getUpdateManager().isLatest()) {
|
if (player.hasPermission("anticheat.admin") && !AntiCheatReloaded.getUpdateManager().isLatest()) {
|
||||||
player.sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY
|
player.sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY
|
||||||
@@ -374,8 +390,8 @@ public class PlayerListener extends EventListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void onPlayerMove(PlayerMoveEvent event) {
|
public void onPlayerMove(final PlayerMoveEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
if (getCheckManager().checkInWorld(player) && !getCheckManager().isOpExempt(player)) {
|
if (getCheckManager().checkInWorld(player) && !getCheckManager().isOpExempt(player)) {
|
||||||
final Location from = event.getFrom();
|
final Location from = event.getFrom();
|
||||||
@@ -383,30 +399,40 @@ public class PlayerListener extends EventListener {
|
|||||||
|
|
||||||
final Distance distance = new Distance(from, to);
|
final Distance distance = new Distance(from, to);
|
||||||
final double y = distance.getYDifference();
|
final double y = distance.getYDifference();
|
||||||
getBackend().logAscension(player, from.getY(), to.getY());
|
|
||||||
|
|
||||||
final User user = getUserManager().getUser(player.getUniqueId());
|
final User user = getUserManager().getUser(player.getUniqueId());
|
||||||
user.setTo(to.getX(), to.getY(), to.getZ());
|
user.setTo(to.getX(), to.getY(), to.getZ());
|
||||||
user.getMovementManager().handle(player, from, to, distance);
|
user.getMovementManager().handle(player, from, to, distance);
|
||||||
|
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.FLIGHT) && !VersionUtil.isFlying(player)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.FLIGHT) && !VersionLib.isFlying(player)) {
|
||||||
CheckResult result = FlightCheck.runCheck(player, distance);
|
final CheckResult result = FlightCheck.runCheck(player, distance);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.FLIGHT);
|
log(result.getMessage(), player, CheckType.FLIGHT, result.getSubCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.ELYTRAFLY)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.ELYTRAFLY)) {
|
||||||
CheckResult result = ElytraCheck.runCheck(player, distance);
|
final CheckResult result = ElytraCheck.runCheck(player, distance);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
log(result.getMessage(), player, CheckType.ELYTRAFLY);
|
log(result.getMessage(), player, CheckType.ELYTRAFLY, result.getSubCheck());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (getCheckManager().willCheckQuick(player, CheckType.BOATFLY)) {
|
||||||
|
final CheckResult result = BoatFlyCheck.runCheck(player, user.getMovementManager(), to);
|
||||||
|
if (result.failed()) {
|
||||||
|
if (!silentMode()) {
|
||||||
|
player.eject();
|
||||||
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
|
}
|
||||||
|
log(result.getMessage(), player, CheckType.BOATFLY, result.getSubCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.VCLIP)
|
if (getCheckManager().willCheckQuick(player, CheckType.VCLIP)
|
||||||
&& event.getFrom().getY() > event.getTo().getY()) {
|
&& event.getFrom().getY() > event.getTo().getY()) {
|
||||||
CheckResult result = getBackend().checkVClip(player, new Distance(event.getFrom(), event.getTo()));
|
final CheckResult result = getBackend().checkVClip(player,
|
||||||
|
new Distance(event.getFrom(), event.getTo()));
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
int data = result.getData() > 3 ? 3 : result.getData();
|
int data = result.getData() > 3 ? 3 : result.getData();
|
||||||
@@ -419,104 +445,125 @@ public class PlayerListener extends EventListener {
|
|||||||
}
|
}
|
||||||
player.damage(3);
|
player.damage(3);
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.VCLIP);
|
log(result.getMessage(), player, CheckType.VCLIP, result.getSubCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.NOFALL)
|
if (getCheckManager().willCheckQuick(player, CheckType.NOFALL)
|
||||||
&& getCheckManager().willCheck(player, CheckType.FLIGHT)
|
&& getCheckManager().willCheck(player, CheckType.FLIGHT)
|
||||||
&& !Utilities.isClimbableBlock(player.getLocation().getBlock())
|
&& !Utilities.isClimbableBlock(player.getLocation().getBlock())
|
||||||
&& event.getFrom().getY() > event.getTo().getY()) {
|
&& event.getFrom().getY() > event.getTo().getY()) {
|
||||||
CheckResult result = getBackend().checkNoFall(player, y);
|
final CheckResult result = NoFallCheck.runCheck(player, y);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
// TODO better handling of this
|
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.NOFALL);
|
log(result.getMessage(), player, CheckType.NOFALL, result.getSubCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean changed = false;
|
|
||||||
if (event.getTo() != event.getFrom()) {
|
if (event.getTo() != event.getFrom()) {
|
||||||
double x = distance.getXDifference();
|
final double x = distance.getXDifference();
|
||||||
double z = distance.getZDifference();
|
final double z = distance.getZDifference();
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.SPEED)
|
if (getCheckManager().willCheckQuick(player, CheckType.SPEED)) {
|
||||||
&& getCheckManager().willCheck(player, CheckType.FLIGHT)) {
|
final CheckResult result = SpeedCheck.checkPredict(player, event.getTo());
|
||||||
if (event.getFrom().getY() < event.getTo().getY()) {
|
|
||||||
CheckResult result = SpeedCheck.checkVerticalSpeed(player, distance);
|
|
||||||
if (result.failed()) {
|
|
||||||
if (!silentMode()) {
|
|
||||||
event.setTo(user.getGoodLocation(from.clone()));
|
|
||||||
}
|
|
||||||
log(result.getMessage(), player, CheckType.SPEED);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CheckResult result = SpeedCheck.checkXZSpeed(player, x, z, event.getTo());
|
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.SPEED);
|
|
||||||
changed = true;
|
log(result.getMessage(), player, CheckType.SPEED, result.getSubCheck());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getCheckManager().willCheckQuick(player, CheckType.SPEED) && event.getFrom().getY() < event.getTo().getY()) {
|
||||||
|
final CheckResult result = SpeedCheck.checkVerticalSpeed(player, distance);
|
||||||
|
if (result.failed()) {
|
||||||
|
if (!silentMode()) {
|
||||||
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
|
}
|
||||||
|
|
||||||
|
log(result.getMessage(), player, CheckType.SPEED, result.getSubCheck());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getCheckManager().willCheckQuick(player, CheckType.SPEED)) {
|
||||||
|
final CheckResult result = SpeedCheck.checkXZSpeed(player, event.getTo());
|
||||||
|
if (result.failed()) {
|
||||||
|
if (!silentMode()) {
|
||||||
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
|
}
|
||||||
|
|
||||||
|
log(result.getMessage(), player, CheckType.SPEED, result.getSubCheck());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.WATER_WALK)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.WATER_WALK)) {
|
||||||
CheckResult result = WaterWalkCheck.runCheck(player, x, y, z);
|
final CheckResult result = WaterWalkCheck.runCheck(player, x, y, z);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
// TODO check this
|
player.teleport(player.getLocation().clone().subtract(0, 0.42f, 0));
|
||||||
player.teleport(player.getLocation().clone().subtract(0, 0.52, 0));
|
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.WATER_WALK);
|
|
||||||
changed = true;
|
log(result.getMessage(), player, CheckType.WATER_WALK, result.getSubCheck());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.SPIDER)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.SPIDER)) {
|
||||||
CheckResult result = getBackend().checkSpider(player, y);
|
final CheckResult result = getBackend().checkSpider(player, y);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.SPIDER);
|
|
||||||
changed = true;
|
log(result.getMessage(), player, CheckType.SPIDER, result.getSubCheck());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.FASTLADDER)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.FASTLADDER)) {
|
||||||
// Does not use y value created before because that value is absolute
|
// Does not use y value created before because that value is absolute
|
||||||
CheckResult result = FastLadderCheck.runCheck(player,
|
final CheckResult result = FastLadderCheck.runCheck(player,
|
||||||
event.getTo().getY() - event.getFrom().getY());
|
event.getTo().getY() - event.getFrom().getY());
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.FASTLADDER);
|
|
||||||
changed = true;
|
log(result.getMessage(), player, CheckType.FASTLADDER, result.getSubCheck());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!changed) {
|
|
||||||
user.setGoodLocation(event.getFrom());
|
if (getCheckManager().willCheckQuick(player, CheckType.STRAFE)) {
|
||||||
}
|
final CheckResult result = StrafeCheck.runCheck(player, x, z, event.getFrom(), event.getTo());
|
||||||
}
|
if (result.failed()) {
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.AIMBOT)) {
|
if (!silentMode()) {
|
||||||
CheckResult result = AimbotCheck.runCheck(player, event);
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
if (result.failed()) {
|
}
|
||||||
log(result.getMessage(), player, CheckType.AIMBOT);
|
|
||||||
|
log(result.getMessage(), player, CheckType.STRAFE, result.getSubCheck());
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.VELOCITY)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.VELOCITY)) {
|
||||||
CheckResult result = VelocityCheck.runCheck(player, distance);
|
final CheckResult result = VelocityCheck.runCheck(player, distance);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
log(result.getMessage(), player, CheckType.VELOCITY);
|
log(result.getMessage(), player, CheckType.VELOCITY, result.getSubCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
MANAGER.addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onRespawn(PlayerRespawnEvent event) {
|
public void onRespawn(final PlayerRespawnEvent event) {
|
||||||
getBackend().logTeleport(event.getPlayer());
|
getBackend().logTeleport(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -27,7 +27,6 @@ import org.bukkit.event.vehicle.VehicleEnterEvent;
|
|||||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
|
||||||
|
|
||||||
public class VehicleListener extends EventListener {
|
public class VehicleListener extends EventListener {
|
||||||
|
|
||||||
@@ -49,26 +48,15 @@ public class VehicleListener extends EventListener {
|
|||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onVehicleDestroy(VehicleDestroyEvent event) {
|
public void onVehicleDestroy(VehicleDestroyEvent event) {
|
||||||
if (VersionUtil.isBountifulUpdate()) {
|
if (!event.getVehicle().getPassengers().isEmpty()) {
|
||||||
if (event.getVehicle().getPassenger() != null) {
|
for (Entity entity : event.getVehicle().getPassengers()) {
|
||||||
Entity entity = event.getVehicle().getPassenger();
|
|
||||||
if (entity instanceof Player) {
|
if (entity instanceof Player) {
|
||||||
getBackend().logEnterExit((Player) entity);
|
getBackend().logEnterExit((Player) entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (!event.getVehicle().getPassengers().isEmpty()) {
|
|
||||||
for (Entity entity : event.getVehicle().getPassengers()) {
|
|
||||||
if (entity instanceof Player) {
|
|
||||||
getBackend().logEnterExit((Player) entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -32,17 +32,18 @@ import com.rammelkast.anticheatreloaded.config.Configuration;
|
|||||||
/**
|
/**
|
||||||
* The internal hub for all managers.
|
* The internal hub for all managers.
|
||||||
*/
|
*/
|
||||||
public class AntiCheatManager {
|
public final class AntiCheatManager {
|
||||||
private static AntiCheatReloaded plugin = null;
|
|
||||||
|
private static AntiCheatReloaded plugin;
|
||||||
private static Configuration configuration;
|
private static Configuration configuration;
|
||||||
private static UserManager userManager = null;
|
private static UserManager userManager;
|
||||||
private static CheckManager checkManager = null;
|
private static CheckManager checkManager;
|
||||||
private static LoggingManager loggingManager = null;
|
private static LoggingManager loggingManager;
|
||||||
private static Backend backend = null;
|
private static Backend backend;
|
||||||
private static Map<String, RegisteredListener[]> eventchains = new ConcurrentHashMap<String, RegisteredListener[]>();
|
private static Map<String, RegisteredListener[]> eventchains = new ConcurrentHashMap<String, RegisteredListener[]>();
|
||||||
private static Map<String, Long> eventcache = new ConcurrentHashMap<String, Long>();
|
private static Map<String, Long> eventcache = new ConcurrentHashMap<String, Long>();
|
||||||
|
|
||||||
public AntiCheatManager(AntiCheatReloaded instance, Logger logger) {
|
public AntiCheatManager(final AntiCheatReloaded instance, final Logger logger) {
|
||||||
plugin = instance;
|
plugin = instance;
|
||||||
configuration = new Configuration(plugin, this);
|
configuration = new Configuration(plugin, this);
|
||||||
loggingManager = new LoggingManager(plugin, logger, configuration);
|
loggingManager = new LoggingManager(plugin, logger, configuration);
|
||||||
@@ -133,5 +134,18 @@ public class AntiCheatManager {
|
|||||||
if (configuration.getConfig().enterprise.getValue()) {
|
if (configuration.getConfig().enterprise.getValue()) {
|
||||||
configuration.getEnterprise().database.shutdown();
|
configuration.getEnterprise().database.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eventchains.clear();
|
||||||
|
eventcache.clear();
|
||||||
|
|
||||||
|
// Nullify
|
||||||
|
plugin = null;
|
||||||
|
configuration = null;
|
||||||
|
loggingManager = null;
|
||||||
|
userManager = null;
|
||||||
|
checkManager = null;
|
||||||
|
backend = null;
|
||||||
|
eventchains = null;
|
||||||
|
eventcache = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -28,30 +28,36 @@ import java.util.UUID;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.geysermc.floodgate.api.FloodgateApi;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.util.VersionLib;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p/>
|
* The manager that AntiCheatReloaded will check with to see if it should watch
|
||||||
* The manager that AntiCheat will check with to see if it should watch certain checks and certain players.
|
* certain checks and certain players.
|
||||||
*/
|
*/
|
||||||
|
public final class CheckManager {
|
||||||
|
|
||||||
|
private final AntiCheatManager manager;
|
||||||
|
private final Configuration config;
|
||||||
|
|
||||||
|
private static final List<CheckType> checkIgnoreList = new ArrayList<CheckType>();
|
||||||
|
private static final Map<UUID, List<CheckType>> exemptList = new HashMap<UUID, List<CheckType>>();
|
||||||
|
|
||||||
public class CheckManager {
|
public CheckManager(final AntiCheatManager manager) {
|
||||||
private AntiCheatManager manager = null;
|
|
||||||
private Configuration config;
|
|
||||||
private static List<CheckType> checkIgnoreList = new ArrayList<CheckType>();
|
|
||||||
private static Map<UUID, List<CheckType>> exemptList = new HashMap<UUID, List<CheckType>>();
|
|
||||||
|
|
||||||
public CheckManager(AntiCheatManager manager) {
|
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
this.config = manager.getConfiguration();
|
this.config = manager.getConfiguration();
|
||||||
|
loadCheckIgnoreList(this.config);
|
||||||
|
}
|
||||||
|
|
||||||
for (CheckType type : CheckType.values()) {
|
public void loadCheckIgnoreList(final Configuration configuration) {
|
||||||
if (!config.getChecks().isEnabled(type)) {
|
checkIgnoreList.clear();
|
||||||
|
for (final CheckType type : CheckType.values()) {
|
||||||
|
if (!configuration.getChecks().isEnabled(type)) {
|
||||||
checkIgnoreList.add(type);
|
checkIgnoreList.add(type);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,13 +66,13 @@ public class CheckManager {
|
|||||||
+ checkIgnoreList.size() + " check(s) have been disabled");
|
+ checkIgnoreList.size() + " check(s) have been disabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turn a check on
|
* Turn a check on
|
||||||
*
|
*
|
||||||
* @param type The CheckType to enable
|
* @param type The CheckType to enable
|
||||||
*/
|
*/
|
||||||
public void activateCheck(CheckType type, String className) {
|
public void activateCheck(final CheckType type, final String className) {
|
||||||
if (!isActive(type)) {
|
if (!isActive(type)) {
|
||||||
manager.getLoggingManager().logFineInfo("The " + type.toString() + " check was activated by " + className + ".");
|
manager.getLoggingManager().logFineInfo("The " + type.toString() + " check was activated by " + className + ".");
|
||||||
checkIgnoreList.remove(type);
|
checkIgnoreList.remove(type);
|
||||||
@@ -78,7 +84,7 @@ public class CheckManager {
|
|||||||
*
|
*
|
||||||
* @param type The CheckType to disable
|
* @param type The CheckType to disable
|
||||||
*/
|
*/
|
||||||
public void deactivateCheck(CheckType type, String className) {
|
public void deactivateCheck(final CheckType type, final String className) {
|
||||||
if (isActive(type)) {
|
if (isActive(type)) {
|
||||||
manager.getLoggingManager().logFineInfo("The " + type.toString() + " check was deactivated by " + className + ".");
|
manager.getLoggingManager().logFineInfo("The " + type.toString() + " check was deactivated by " + className + ".");
|
||||||
checkIgnoreList.add(type);
|
checkIgnoreList.add(type);
|
||||||
@@ -91,7 +97,7 @@ public class CheckManager {
|
|||||||
* @param type The CheckType to check
|
* @param type The CheckType to check
|
||||||
* @return true if the check is active
|
* @return true if the check is active
|
||||||
*/
|
*/
|
||||||
public boolean isActive(CheckType type) {
|
public boolean isActive(final CheckType type) {
|
||||||
return !checkIgnoreList.contains(type);
|
return !checkIgnoreList.contains(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +107,7 @@ public class CheckManager {
|
|||||||
* @param player The player
|
* @param player The player
|
||||||
* @param type The check
|
* @param type The check
|
||||||
*/
|
*/
|
||||||
public void exemptPlayer(Player player, CheckType type, String className) {
|
public void exemptPlayer(final Player player, final CheckType type, final String className) {
|
||||||
if (!isExempt(player, type)) {
|
if (!isExempt(player, type)) {
|
||||||
if (!exemptList.containsKey(player.getUniqueId())) {
|
if (!exemptList.containsKey(player.getUniqueId())) {
|
||||||
exemptList.put(player.getUniqueId(), new ArrayList<CheckType>());
|
exemptList.put(player.getUniqueId(), new ArrayList<CheckType>());
|
||||||
@@ -117,7 +123,7 @@ public class CheckManager {
|
|||||||
* @param player The player
|
* @param player The player
|
||||||
* @param type The check
|
* @param type The check
|
||||||
*/
|
*/
|
||||||
public void unexemptPlayer(Player player, CheckType type, String className) {
|
public void unexemptPlayer(final Player player, final CheckType type, final String className) {
|
||||||
if (isExempt(player, type)) {
|
if (isExempt(player, type)) {
|
||||||
manager.getLoggingManager().logFineInfo(player.getName() + " was unexempted from the " + type.toString() + " check by " + className + ".");
|
manager.getLoggingManager().logFineInfo(player.getName() + " was unexempted from the " + type.toString() + " check by " + className + ".");
|
||||||
exemptList.get(player.getUniqueId()).remove(type);
|
exemptList.get(player.getUniqueId()).remove(type);
|
||||||
@@ -130,7 +136,12 @@ public class CheckManager {
|
|||||||
* @param player The player
|
* @param player The player
|
||||||
* @param type The check
|
* @param type The check
|
||||||
*/
|
*/
|
||||||
public boolean isExempt(Player player, CheckType type) {
|
public boolean isExempt(final Player player, final CheckType type) {
|
||||||
|
if (AntiCheatReloaded.isFloodgateEnabled()) {
|
||||||
|
if (FloodgateApi.getInstance().isFloodgatePlayer(player.getUniqueId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return exemptList.containsKey(player.getUniqueId()) ? exemptList.get(player.getUniqueId()).contains(type) : false;
|
return exemptList.containsKey(player.getUniqueId()) ? exemptList.get(player.getUniqueId()).contains(type) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +150,7 @@ public class CheckManager {
|
|||||||
*
|
*
|
||||||
* @param player The player
|
* @param player The player
|
||||||
*/
|
*/
|
||||||
public boolean isOpExempt(Player player) {
|
public boolean isOpExempt(final Player player) {
|
||||||
return (this.manager.getConfiguration().getConfig().exemptOp.getValue() && player.isOp());
|
return (this.manager.getConfiguration().getConfig().exemptOp.getValue() && player.isOp());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +160,7 @@ public class CheckManager {
|
|||||||
* @param player The player
|
* @param player The player
|
||||||
* @return true if the player's world is enabled
|
* @return true if the player's world is enabled
|
||||||
*/
|
*/
|
||||||
public boolean checkInWorld(Player player) {
|
public boolean checkInWorld(final Player player) {
|
||||||
return !config.getConfig().disabledWorlds.getValue().contains(player.getWorld().getName());
|
return !config.getConfig().disabledWorlds.getValue().contains(player.getWorld().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +171,7 @@ public class CheckManager {
|
|||||||
* @param type The check being run
|
* @param type The check being run
|
||||||
* @return true if the check should run
|
* @return true if the check should run
|
||||||
*/
|
*/
|
||||||
public boolean willCheckQuick(Player player, CheckType type) {
|
public boolean willCheckQuick(final Player player, final CheckType type) {
|
||||||
return
|
return
|
||||||
isActive(type)
|
isActive(type)
|
||||||
&& !isExempt(player, type)
|
&& !isExempt(player, type)
|
||||||
@@ -174,14 +185,15 @@ public class CheckManager {
|
|||||||
* @param type The check being run
|
* @param type The check being run
|
||||||
* @return true if the check should run
|
* @return true if the check should run
|
||||||
*/
|
*/
|
||||||
public boolean willCheck(Player player, CheckType type) {
|
public boolean willCheck(final Player player, final CheckType type) {
|
||||||
boolean check = isActive(type)
|
final boolean check = isActive(type)
|
||||||
&& checkInWorld(player)
|
&& checkInWorld(player)
|
||||||
&& !isExempt(player, type)
|
&& !isExempt(player, type)
|
||||||
&& !type.checkPermission(player)
|
&& !type.checkPermission(player)
|
||||||
&& !isOpExempt(player);
|
&& !isOpExempt(player);
|
||||||
if ((type == CheckType.FLIGHT || type == CheckType.SPEED) && VersionUtil.isFlying(player))
|
if ((type == CheckType.FLIGHT || type == CheckType.SPEED) && VersionLib.isFlying(player)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return check;
|
return check;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,10 +203,10 @@ public class CheckManager {
|
|||||||
* @param player Player to check
|
* @param player Player to check
|
||||||
* @return true if the player is a real person
|
* @return true if the player is a real person
|
||||||
*/
|
*/
|
||||||
public boolean isOnline(Player player) {
|
public boolean isOnline(final Player player) {
|
||||||
// Check if the player is on the user list, e.g. is not an NPC
|
// Check if the player is on the user list, e.g. is not an NPC
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
for (final Player iterated : Bukkit.getOnlinePlayers()) {
|
||||||
if (p.getUniqueId().equals(player.getUniqueId())) {
|
if (iterated.getUniqueId().equals(player.getUniqueId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -89,6 +89,7 @@ public class LoggingManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void logToPlayers(String message) {
|
public void logToPlayers(String message) {
|
||||||
|
if(config.getConfig().disableBroadcast.getValue()) return;
|
||||||
for(Player player : Bukkit.getOnlinePlayers()) {
|
for(Player player : Bukkit.getOnlinePlayers()) {
|
||||||
if (Permission.SYSTEM_NOTICE.get(player)) {
|
if (Permission.SYSTEM_NOTICE.get(player)) {
|
||||||
player.sendMessage(message);
|
player.sendMessage(message);
|
||||||
@@ -96,7 +97,7 @@ public class LoggingManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logToLogs(String message) { // Yo dawg
|
private void logToLogs(String message) {
|
||||||
logs.add(ChatColor.stripColor(message));
|
logs.add(ChatColor.stripColor(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -22,219 +22,226 @@ package com.rammelkast.anticheatreloaded.manage;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.bukkit.BanList.Type;
|
import org.bukkit.BanList.Type;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.api.event.PlayerPunishEvent;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||||
import com.rammelkast.anticheatreloaded.util.Group;
|
import com.rammelkast.anticheatreloaded.util.Group;
|
||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
|
||||||
public class UserManager {
|
public final class UserManager {
|
||||||
private List<User> users = new ArrayList<User>();
|
private final List<User> users = new ArrayList<User>();
|
||||||
private AntiCheatManager manager;
|
private final AntiCheatManager manager;
|
||||||
private Configuration config;
|
private final Configuration config;
|
||||||
/**
|
|
||||||
* Initialize the user manager
|
|
||||||
*
|
|
||||||
* @param manager The AntiCheat Manager
|
|
||||||
*/
|
|
||||||
public UserManager(AntiCheatManager manager) {
|
|
||||||
this.manager = manager;
|
|
||||||
this.config = manager.getConfiguration();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a user with the given UUID
|
* Initialize the user manager
|
||||||
*
|
*
|
||||||
* @param uuid UUID
|
* @param manager The AntiCheat Manager
|
||||||
* @return User with UUID
|
*/
|
||||||
*/
|
public UserManager(final AntiCheatManager manager) {
|
||||||
public User getUser(UUID uuid) {
|
this.manager = manager;
|
||||||
for (User user : users) {
|
this.config = manager.getConfiguration();
|
||||||
if (user.getUUID().equals(uuid)) {
|
}
|
||||||
return user;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Otherwise try to load them
|
|
||||||
User user = new User(uuid);
|
|
||||||
user.setIsWaitingOnLevelSync(true);
|
|
||||||
config.getLevels().loadLevelToUser(user);
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all users
|
* Get a user with the given UUID
|
||||||
*
|
*
|
||||||
* @return List of users
|
* @param uuid UUID
|
||||||
*/
|
* @return User with UUID
|
||||||
public List<User> getUsers() {
|
*/
|
||||||
return users;
|
public User getUser(final UUID uuid) {
|
||||||
}
|
return this.users.parallelStream().filter(user -> user.getUUID().equals(uuid)).findFirst()
|
||||||
|
.orElseGet(() -> new User(uuid));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a user to the list
|
* Get all users
|
||||||
*
|
*
|
||||||
* @param user User to add
|
* @return List of users
|
||||||
*/
|
*/
|
||||||
public void addUser(User user) {
|
public List<User> getUsers() {
|
||||||
users.add(user);
|
return users;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a user from the list
|
* Add a user to the list
|
||||||
*
|
*
|
||||||
* @param user User to remove
|
* @param user User to add
|
||||||
*/
|
*/
|
||||||
public void remove(User user) {
|
public void addUser(final User user) {
|
||||||
users.remove(user);
|
users.add(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save a user's level
|
* Remove a user from the list
|
||||||
*
|
*
|
||||||
* @param user User to save
|
* @param user User to remove
|
||||||
*/
|
*/
|
||||||
public void saveLevel(User user) {
|
public void removeUser(final User user) {
|
||||||
config.getLevels().saveLevelFromUser(user);
|
users.remove(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get users in group
|
* Save a user's level
|
||||||
*
|
*
|
||||||
* @param group Group to find users of
|
* @param user User to save
|
||||||
*/
|
*/
|
||||||
public List<User> getUsersInGroup(Group group) {
|
public void saveLevel(final User user) {
|
||||||
List<User> list = new ArrayList<User>();
|
config.getLevels().saveLevelFromUser(user);
|
||||||
for (User u : users) {
|
}
|
||||||
if (u.getGroup() == group) {
|
|
||||||
list.add(u);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a user's level, or 0 if the player isn't found
|
* Get users in group
|
||||||
*
|
*
|
||||||
* @param uuid UUID of the player
|
* @param group Group to find users of
|
||||||
* @return player level
|
*/
|
||||||
*/
|
public List<User> getUsersInGroup(final Group group) {
|
||||||
public int safeGetLevel(UUID uuid) {
|
return this.users.parallelStream().filter(user -> user.getGroup() == group).collect(Collectors.toList());
|
||||||
User user = getUser(uuid);
|
}
|
||||||
if (user == null) {
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
return user.getLevel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a user's level
|
* Get a user's level, or 0 if the player isn't found
|
||||||
*
|
*
|
||||||
* @param uuid UUID of the player
|
* @param uuid UUID of the player
|
||||||
* @param level Group to set
|
* @return player level
|
||||||
*/
|
*/
|
||||||
public void safeSetLevel(UUID uuid, int level) {
|
public int safeGetLevel(final UUID uuid) {
|
||||||
User user = getUser(uuid);
|
final User user = getUser(uuid);
|
||||||
if (user != null) {
|
if (user == null) {
|
||||||
user.setLevel(level);
|
return 0;
|
||||||
}
|
} else {
|
||||||
}
|
return user.getLevel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset a user
|
* Set a user's level
|
||||||
*
|
*
|
||||||
* @param uuid UUID of the user
|
* @param uuid UUID of the player
|
||||||
*/
|
* @param level Group to set
|
||||||
public void safeReset(UUID uuid) {
|
*/
|
||||||
User user = getUser(uuid);
|
public void safeSetLevel(final UUID uuid, final int level) {
|
||||||
if (user != null) {
|
final User user = getUser(uuid);
|
||||||
user.resetLevel();
|
if (user != null) {
|
||||||
}
|
user.setLevel(level);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fire an alert
|
* Reset a user
|
||||||
*
|
*
|
||||||
* @param user The user to alert
|
* @param uuid UUID of the user
|
||||||
* @param group The user's group
|
*/
|
||||||
* @param type The CheckType that triggered the alert
|
public void safeReset(final UUID uuid) {
|
||||||
*/
|
final User user = getUser(uuid);
|
||||||
public void alert(User user, Group group, CheckType type) {
|
if (user != null) {
|
||||||
execute(user, group.getActions(), type);
|
user.resetLevel();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute configuration actions for an alert
|
* Fire an alert
|
||||||
*
|
*
|
||||||
* @param user The user
|
* @param user The user to alert
|
||||||
* @param actions The list of actions to execute
|
* @param group The user's group
|
||||||
* @param type The CheckType that triggered the alert
|
* @param type The CheckType that triggered the alert
|
||||||
*/
|
*/
|
||||||
public void execute(User user, List<String> actions, CheckType type) {
|
public void alert(final User user, final Group group, final CheckType type) {
|
||||||
execute(user, actions, type, config.getLang().KICK_REASON(), config.getLang().WARNING(), config.getLang().BAN_REASON());
|
execute(user, group.getActions(), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute configuration actions for an alert
|
* Execute configuration actions for an alert
|
||||||
*
|
*
|
||||||
* @param user The user
|
* @param user The user
|
||||||
* @param actions The list of actions to execute
|
* @param actions The list of actions to execute
|
||||||
* @param type The CheckType that triggered the alert
|
* @param type The CheckType that triggered the alert
|
||||||
* @param kickReason The config's kick reason
|
*/
|
||||||
* @param warning The config's warning format
|
public void execute(final User user, final List<String> actions, final CheckType type) {
|
||||||
* @param banReason The config's ban reason
|
execute(user, actions, type, config.getLang().KICK_REASON(), config.getLang().WARNING(),
|
||||||
*/
|
config.getLang().BAN_REASON());
|
||||||
public void execute(final User user, final List<String> actions, final CheckType type, final String kickReason, final List<String> warning, final String banReason) {
|
}
|
||||||
// Execute synchronously for thread safety when called from AsyncPlayerChatEvent
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(AntiCheatReloaded.getPlugin(), new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (user.getPlayer() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final String name = user.getName();
|
|
||||||
for (String event : actions) {
|
|
||||||
event = event.replaceAll("%player%", name).replaceAll("%world%", user.getPlayer().getWorld().getName()).replaceAll("%check%", type.name());
|
|
||||||
|
|
||||||
if (event.startsWith("COMMAND[")) {
|
/**
|
||||||
for (String cmd : Utilities.getCommands(event)) {
|
* Execute configuration actions for an alert
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd);
|
*
|
||||||
}
|
* @param user The user
|
||||||
} else if (event.equalsIgnoreCase("KICK")) {
|
* @param actions The list of actions to execute
|
||||||
user.getPlayer().kickPlayer(ChatColor.translateAlternateColorCodes('&', kickReason));
|
* @param type The CheckType that triggered the alert
|
||||||
AntiCheatReloaded.getPlugin().onPlayerKicked();
|
* @param kickReason The config's kick reason
|
||||||
String msg = ChatColor.translateAlternateColorCodes('&', config.getLang().KICK_BROADCAST().replaceAll("%player%", name) + " (" + type.getName() + ")");
|
* @param warning The config's warning format
|
||||||
if (!msg.equals("")) {
|
* @param banReason The config's ban reason
|
||||||
manager.log(msg);
|
*/
|
||||||
manager.playerLog(msg);
|
public void execute(final User user, final List<String> actions, final CheckType type, final String kickReason,
|
||||||
}
|
final List<String> warning, final String banReason) {
|
||||||
} else if (event.equalsIgnoreCase("WARN")) {
|
// Execute synchronously for thread safety when called from AsyncPlayerChatEvent
|
||||||
List<String> message = warning;
|
Bukkit.getScheduler().scheduleSyncDelayedTask(AntiCheatReloaded.getPlugin(), new Runnable() {
|
||||||
for (String string : message) {
|
@Override
|
||||||
if (!string.equals("")) {
|
public void run() {
|
||||||
user.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', string));
|
if (user.getPlayer() == null) {
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
} else if (event.equalsIgnoreCase("BAN")) {
|
|
||||||
Bukkit.getBanList(Type.NAME).addBan(user.getPlayer().getName(), ChatColor.translateAlternateColorCodes('&', banReason), null, null);
|
final PlayerPunishEvent event = new PlayerPunishEvent(user, actions);
|
||||||
user.getPlayer().kickPlayer(ChatColor.translateAlternateColorCodes('&', banReason));
|
{
|
||||||
String msg = ChatColor.translateAlternateColorCodes('&', config.getLang().BAN_BROADCAST().replaceAll("%player%", name) + " (" + type.getName() + ")");
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
if (!msg.equals("")) {
|
if (event.isCancelled()) {
|
||||||
manager.log(msg);
|
return;
|
||||||
manager.playerLog(msg);
|
}
|
||||||
}
|
}
|
||||||
} else if (event.equalsIgnoreCase("RESET")) {
|
|
||||||
user.resetLevel();
|
final String name = user.getName();
|
||||||
}
|
for (String action : actions) {
|
||||||
}
|
action = action.replaceAll("%player%", name)
|
||||||
}
|
.replaceAll("%world%", user.getPlayer().getWorld().getName())
|
||||||
});
|
.replaceAll("%check%", type.name());
|
||||||
}
|
|
||||||
|
if (action.startsWith("COMMAND[")) {
|
||||||
|
for (String cmd : Utilities.getCommands(action)) {
|
||||||
|
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd);
|
||||||
|
}
|
||||||
|
} else if (action.equalsIgnoreCase("KICK")) {
|
||||||
|
user.getPlayer().kickPlayer(ChatColor.translateAlternateColorCodes('&', kickReason));
|
||||||
|
AntiCheatReloaded.getPlugin().onPlayerKicked();
|
||||||
|
String msg = ChatColor.translateAlternateColorCodes('&',
|
||||||
|
config.getLang().KICK_BROADCAST().replaceAll("%player%", name) + " (" + type.getName()
|
||||||
|
+ ")");
|
||||||
|
if (!msg.equals("")) {
|
||||||
|
manager.log(msg);
|
||||||
|
manager.playerLog(msg);
|
||||||
|
}
|
||||||
|
} else if (action.equalsIgnoreCase("WARN")) {
|
||||||
|
List<String> message = warning;
|
||||||
|
for (String string : message) {
|
||||||
|
if (!string.equals("")) {
|
||||||
|
user.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', string));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (action.equalsIgnoreCase("BAN")) {
|
||||||
|
Bukkit.getBanList(Type.NAME).addBan(user.getPlayer().getName(),
|
||||||
|
ChatColor.translateAlternateColorCodes('&', banReason), null, null);
|
||||||
|
user.getPlayer().kickPlayer(ChatColor.translateAlternateColorCodes('&', banReason));
|
||||||
|
String msg = ChatColor.translateAlternateColorCodes('&',
|
||||||
|
config.getLang().BAN_BROADCAST().replaceAll("%player%", name) + " (" + type.getName()
|
||||||
|
+ ")");
|
||||||
|
if (!msg.equals("")) {
|
||||||
|
manager.log(msg);
|
||||||
|
manager.playerLog(msg);
|
||||||
|
}
|
||||||
|
} else if (action.equalsIgnoreCase("RESET")) {
|
||||||
|
user.resetLevel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,766 +0,0 @@
|
|||||||
/*
|
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
|
||||||
*
|
|
||||||
* 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 com.rammelkast.anticheatreloaded.metrics;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Timer;
|
|
||||||
import java.util.TimerTask;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.Callable;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.zip.GZIPOutputStream;
|
|
||||||
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
|
||||||
import org.bukkit.plugin.ServicePriority;
|
|
||||||
|
|
||||||
import com.google.gson.JsonArray;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonParser;
|
|
||||||
import com.google.gson.JsonPrimitive;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* bStats collects some data for plugin authors.
|
|
||||||
* <p>
|
|
||||||
* Check out https://bStats.org/ to learn more about bStats!
|
|
||||||
*/
|
|
||||||
public class Metrics {
|
|
||||||
|
|
||||||
static {
|
|
||||||
// You can use the property to disable the check in your test environment
|
|
||||||
if (System.getProperty("bstats.relocatecheck") == null
|
|
||||||
|| !System.getProperty("bstats.relocatecheck").equals("false")) {
|
|
||||||
// Maven's Relocate is clever and changes strings, too. So we have to use this
|
|
||||||
// little "trick" ... :D
|
|
||||||
final String defaultPackage = new String(
|
|
||||||
new byte[] { 'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's', '.', 'b', 'u', 'k', 'k', 'i', 't' });
|
|
||||||
final String examplePackage = new String(
|
|
||||||
new byte[] { 'y', 'o', 'u', 'r', '.', 'p', 'a', 'c', 'k', 'a', 'g', 'e' });
|
|
||||||
// We want to make sure nobody just copy & pastes the example and use the wrong
|
|
||||||
// package names
|
|
||||||
if (Metrics.class.getPackage().getName().equals(defaultPackage)
|
|
||||||
|| Metrics.class.getPackage().getName().equals(examplePackage)) {
|
|
||||||
throw new IllegalStateException("bStats Metrics class has not been relocated correctly!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The version of this bStats class
|
|
||||||
public static final int B_STATS_VERSION = 1;
|
|
||||||
|
|
||||||
// The url to which the data is sent
|
|
||||||
private static final String URL = "https://bStats.org/submitData/bukkit";
|
|
||||||
|
|
||||||
// Is bStats enabled on this server?
|
|
||||||
private boolean enabled;
|
|
||||||
|
|
||||||
// Should failed requests be logged?
|
|
||||||
private static boolean logFailedRequests;
|
|
||||||
|
|
||||||
// Should the sent data be logged?
|
|
||||||
private static boolean logSentData;
|
|
||||||
|
|
||||||
// Should the response text be logged?
|
|
||||||
private static boolean logResponseStatusText;
|
|
||||||
|
|
||||||
// The uuid of the server
|
|
||||||
private static String serverUUID;
|
|
||||||
|
|
||||||
// The plugin
|
|
||||||
private final Plugin plugin;
|
|
||||||
|
|
||||||
// The plugin id
|
|
||||||
private final int pluginId;
|
|
||||||
|
|
||||||
// A list with all custom charts
|
|
||||||
private final List<CustomChart> charts = new ArrayList<>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class constructor.
|
|
||||||
*
|
|
||||||
* @param plugin The plugin which stats should be submitted.
|
|
||||||
* @param pluginId The id of the plugin. It can be found at
|
|
||||||
* <a href="https://bstats.org/what-is-my-plugin-id">What is my
|
|
||||||
* plugin id?</a>
|
|
||||||
*/
|
|
||||||
public Metrics(Plugin plugin, int pluginId) {
|
|
||||||
if (plugin == null) {
|
|
||||||
throw new IllegalArgumentException("Plugin cannot be null!");
|
|
||||||
}
|
|
||||||
this.plugin = plugin;
|
|
||||||
this.pluginId = pluginId;
|
|
||||||
|
|
||||||
// Get the config file
|
|
||||||
File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats");
|
|
||||||
File configFile = new File(bStatsFolder, "config.yml");
|
|
||||||
YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile);
|
|
||||||
|
|
||||||
// Check if the config file exists
|
|
||||||
if (!config.isSet("serverUuid")) {
|
|
||||||
|
|
||||||
// Add default values
|
|
||||||
config.addDefault("enabled", true);
|
|
||||||
// Every server gets it's unique random id.
|
|
||||||
config.addDefault("serverUuid", UUID.randomUUID().toString());
|
|
||||||
// Should failed request be logged?
|
|
||||||
config.addDefault("logFailedRequests", false);
|
|
||||||
// Should the sent data be logged?
|
|
||||||
config.addDefault("logSentData", false);
|
|
||||||
// Should the response text be logged?
|
|
||||||
config.addDefault("logResponseStatusText", false);
|
|
||||||
|
|
||||||
// Inform the server owners about bStats
|
|
||||||
config.options().header(
|
|
||||||
"bStats collects some data for plugin authors like how many servers are using their plugins.\n"
|
|
||||||
+ "To honor their work, you should not disable it.\n"
|
|
||||||
+ "This has nearly no effect on the server performance!\n"
|
|
||||||
+ "Check out https://bStats.org/ to learn more :)")
|
|
||||||
.copyDefaults(true);
|
|
||||||
try {
|
|
||||||
config.save(configFile);
|
|
||||||
} catch (IOException ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load the data
|
|
||||||
enabled = config.getBoolean("enabled", true);
|
|
||||||
serverUUID = config.getString("serverUuid");
|
|
||||||
logFailedRequests = config.getBoolean("logFailedRequests", false);
|
|
||||||
logSentData = config.getBoolean("logSentData", false);
|
|
||||||
logResponseStatusText = config.getBoolean("logResponseStatusText", false);
|
|
||||||
|
|
||||||
if (enabled) {
|
|
||||||
boolean found = false;
|
|
||||||
// Search for all other bStats Metrics classes to see if we are the first one
|
|
||||||
for (Class<?> service : Bukkit.getServicesManager().getKnownServices()) {
|
|
||||||
try {
|
|
||||||
service.getField("B_STATS_VERSION"); // Our identifier :)
|
|
||||||
found = true; // We aren't the first
|
|
||||||
break;
|
|
||||||
} catch (NoSuchFieldException ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Register our service
|
|
||||||
Bukkit.getServicesManager().register(Metrics.class, this, plugin, ServicePriority.Normal);
|
|
||||||
if (!found) {
|
|
||||||
// We are the first!
|
|
||||||
startSubmitting();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if bStats is enabled.
|
|
||||||
*
|
|
||||||
* @return Whether bStats is enabled or not.
|
|
||||||
*/
|
|
||||||
public boolean isEnabled() {
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a custom chart.
|
|
||||||
*
|
|
||||||
* @param chart The chart to add.
|
|
||||||
*/
|
|
||||||
public void addCustomChart(CustomChart chart) {
|
|
||||||
if (chart == null) {
|
|
||||||
throw new IllegalArgumentException("Chart cannot be null!");
|
|
||||||
}
|
|
||||||
charts.add(chart);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Starts the Scheduler which submits our data every 30 minutes.
|
|
||||||
*/
|
|
||||||
private void startSubmitting() {
|
|
||||||
final Timer timer = new Timer(true); // We use a timer cause the Bukkit scheduler is affected by server lags
|
|
||||||
timer.scheduleAtFixedRate(new TimerTask() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (!plugin.isEnabled()) { // Plugin was disabled
|
|
||||||
timer.cancel();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Nevertheless we want our code to run in the Bukkit main thread, so we have to
|
|
||||||
// use the Bukkit scheduler
|
|
||||||
// Don't be afraid! The connection to the bStats server is still async, only the
|
|
||||||
// stats collection is sync ;)
|
|
||||||
Bukkit.getScheduler().runTask(plugin, () -> submitData());
|
|
||||||
}
|
|
||||||
}, 1000 * 60 * 5, 1000 * 60 * 30);
|
|
||||||
// Submit the data every 30 minutes, first time after 5 minutes to give other
|
|
||||||
// plugins enough time to start
|
|
||||||
// WARNING: Changing the frequency has no effect but your plugin WILL be
|
|
||||||
// blocked/deleted!
|
|
||||||
// WARNING: Just don't do it!
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the plugin specific data. This method is called using Reflection.
|
|
||||||
*
|
|
||||||
* @return The plugin specific data.
|
|
||||||
*/
|
|
||||||
public JsonObject getPluginData() {
|
|
||||||
JsonObject data = new JsonObject();
|
|
||||||
|
|
||||||
String pluginName = plugin.getDescription().getName();
|
|
||||||
String pluginVersion = plugin.getDescription().getVersion();
|
|
||||||
|
|
||||||
data.addProperty("pluginName", pluginName); // Append the name of the plugin
|
|
||||||
data.addProperty("id", pluginId); // Append the id of the plugin
|
|
||||||
data.addProperty("pluginVersion", pluginVersion); // Append the version of the plugin
|
|
||||||
JsonArray customCharts = new JsonArray();
|
|
||||||
for (CustomChart customChart : charts) {
|
|
||||||
// Add the data of the custom charts
|
|
||||||
JsonObject chart = customChart.getRequestJsonObject();
|
|
||||||
if (chart == null) { // If the chart is null, we skip it
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
customCharts.add(chart);
|
|
||||||
}
|
|
||||||
data.add("customCharts", customCharts);
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the server specific data.
|
|
||||||
*
|
|
||||||
* @return The server specific data.
|
|
||||||
*/
|
|
||||||
private JsonObject getServerData() {
|
|
||||||
// Minecraft specific data
|
|
||||||
int playerAmount;
|
|
||||||
try {
|
|
||||||
// Around MC 1.8 the return type was changed to a collection from an array,
|
|
||||||
// This fixes java.lang.NoSuchMethodError:
|
|
||||||
// org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection;
|
|
||||||
Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers");
|
|
||||||
playerAmount = onlinePlayersMethod.getReturnType().equals(Collection.class)
|
|
||||||
? ((Collection<?>) onlinePlayersMethod.invoke(Bukkit.getServer())).size()
|
|
||||||
: ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length;
|
|
||||||
} catch (Exception e) {
|
|
||||||
playerAmount = Bukkit.getOnlinePlayers().size(); // Just use the new method if the Reflection failed
|
|
||||||
}
|
|
||||||
int onlineMode = Bukkit.getOnlineMode() ? 1 : 0;
|
|
||||||
String bukkitVersion = Bukkit.getVersion();
|
|
||||||
String bukkitName = Bukkit.getName();
|
|
||||||
|
|
||||||
// OS/Java specific data
|
|
||||||
String javaVersion = System.getProperty("java.version");
|
|
||||||
String osName = System.getProperty("os.name");
|
|
||||||
String osArch = System.getProperty("os.arch");
|
|
||||||
String osVersion = System.getProperty("os.version");
|
|
||||||
int coreCount = Runtime.getRuntime().availableProcessors();
|
|
||||||
|
|
||||||
JsonObject data = new JsonObject();
|
|
||||||
|
|
||||||
data.addProperty("serverUUID", serverUUID);
|
|
||||||
|
|
||||||
data.addProperty("playerAmount", playerAmount);
|
|
||||||
data.addProperty("onlineMode", onlineMode);
|
|
||||||
data.addProperty("bukkitVersion", bukkitVersion);
|
|
||||||
data.addProperty("bukkitName", bukkitName);
|
|
||||||
|
|
||||||
data.addProperty("javaVersion", javaVersion);
|
|
||||||
data.addProperty("osName", osName);
|
|
||||||
data.addProperty("osArch", osArch);
|
|
||||||
data.addProperty("osVersion", osVersion);
|
|
||||||
data.addProperty("coreCount", coreCount);
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Collects the data and sends it afterwards.
|
|
||||||
*/
|
|
||||||
private void submitData() {
|
|
||||||
final JsonObject data = getServerData();
|
|
||||||
|
|
||||||
JsonArray pluginData = new JsonArray();
|
|
||||||
// Search for all other bStats Metrics classes to get their plugin data
|
|
||||||
for (Class<?> service : Bukkit.getServicesManager().getKnownServices()) {
|
|
||||||
try {
|
|
||||||
service.getField("B_STATS_VERSION"); // Our identifier :)
|
|
||||||
|
|
||||||
for (RegisteredServiceProvider<?> provider : Bukkit.getServicesManager().getRegistrations(service)) {
|
|
||||||
try {
|
|
||||||
Object plugin = provider.getService().getMethod("getPluginData").invoke(provider.getProvider());
|
|
||||||
if (plugin instanceof JsonObject) {
|
|
||||||
pluginData.add((JsonObject) plugin);
|
|
||||||
} else { // old bstats version compatibility
|
|
||||||
try {
|
|
||||||
Class<?> jsonObjectJsonSimple = Class.forName("org.json.simple.JSONObject");
|
|
||||||
if (plugin.getClass().isAssignableFrom(jsonObjectJsonSimple)) {
|
|
||||||
Method jsonStringGetter = jsonObjectJsonSimple.getDeclaredMethod("toJSONString");
|
|
||||||
jsonStringGetter.setAccessible(true);
|
|
||||||
String jsonString = (String) jsonStringGetter.invoke(plugin);
|
|
||||||
JsonObject object = new JsonParser().parse(jsonString).getAsJsonObject();
|
|
||||||
pluginData.add(object);
|
|
||||||
}
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
// minecraft version 1.14+
|
|
||||||
if (logFailedRequests) {
|
|
||||||
this.plugin.getLogger().log(Level.SEVERE, "Encountered unexpected exception", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (NullPointerException | NoSuchMethodException | IllegalAccessException
|
|
||||||
| InvocationTargetException ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (NoSuchFieldException ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data.add("plugins", pluginData);
|
|
||||||
|
|
||||||
// Create a new thread for the connection to the bStats server
|
|
||||||
new Thread(() -> {
|
|
||||||
try {
|
|
||||||
// Send the data
|
|
||||||
sendData(plugin, data);
|
|
||||||
} catch (Exception e) {
|
|
||||||
// Something went wrong! :(
|
|
||||||
if (logFailedRequests) {
|
|
||||||
plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends the data to the bStats server.
|
|
||||||
*
|
|
||||||
* @param plugin Any plugin. It's just used to get a logger instance.
|
|
||||||
* @param data The data to send.
|
|
||||||
* @throws Exception If the request failed.
|
|
||||||
*/
|
|
||||||
private static void sendData(Plugin plugin, JsonObject data) throws Exception {
|
|
||||||
if (data == null) {
|
|
||||||
throw new IllegalArgumentException("Data cannot be null!");
|
|
||||||
}
|
|
||||||
if (Bukkit.isPrimaryThread()) {
|
|
||||||
throw new IllegalAccessException("This method must not be called from the main thread!");
|
|
||||||
}
|
|
||||||
if (logSentData) {
|
|
||||||
plugin.getLogger().info("Sending data to bStats: " + data);
|
|
||||||
}
|
|
||||||
HttpsURLConnection connection = (HttpsURLConnection) new URL(URL).openConnection();
|
|
||||||
|
|
||||||
// Compress the data to save bandwidth
|
|
||||||
byte[] compressedData = compress(data.toString());
|
|
||||||
|
|
||||||
// Add headers
|
|
||||||
connection.setRequestMethod("POST");
|
|
||||||
connection.addRequestProperty("Accept", "application/json");
|
|
||||||
connection.addRequestProperty("Connection", "close");
|
|
||||||
connection.addRequestProperty("Content-Encoding", "gzip"); // We gzip our request
|
|
||||||
connection.addRequestProperty("Content-Length", String.valueOf(compressedData.length));
|
|
||||||
connection.setRequestProperty("Content-Type", "application/json"); // We send our data in JSON format
|
|
||||||
connection.setRequestProperty("User-Agent", "MC-Server/" + B_STATS_VERSION);
|
|
||||||
|
|
||||||
// Send data
|
|
||||||
connection.setDoOutput(true);
|
|
||||||
try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) {
|
|
||||||
outputStream.write(compressedData);
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
|
|
||||||
String line;
|
|
||||||
while ((line = bufferedReader.readLine()) != null) {
|
|
||||||
builder.append(line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (logResponseStatusText) {
|
|
||||||
plugin.getLogger().info("Sent data to bStats and received response: " + builder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gzips the given String.
|
|
||||||
*
|
|
||||||
* @param str The string to gzip.
|
|
||||||
* @return The gzipped String.
|
|
||||||
* @throws IOException If the compression failed.
|
|
||||||
*/
|
|
||||||
private static byte[] compress(final String str) throws IOException {
|
|
||||||
if (str == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
|
||||||
try (GZIPOutputStream gzip = new GZIPOutputStream(outputStream)) {
|
|
||||||
gzip.write(str.getBytes(StandardCharsets.UTF_8));
|
|
||||||
}
|
|
||||||
return outputStream.toByteArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a custom chart.
|
|
||||||
*/
|
|
||||||
public static abstract class CustomChart {
|
|
||||||
|
|
||||||
// The id of the chart
|
|
||||||
final String chartId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class constructor.
|
|
||||||
*
|
|
||||||
* @param chartId The id of the chart.
|
|
||||||
*/
|
|
||||||
CustomChart(String chartId) {
|
|
||||||
if (chartId == null || chartId.isEmpty()) {
|
|
||||||
throw new IllegalArgumentException("ChartId cannot be null or empty!");
|
|
||||||
}
|
|
||||||
this.chartId = chartId;
|
|
||||||
}
|
|
||||||
|
|
||||||
private JsonObject getRequestJsonObject() {
|
|
||||||
JsonObject chart = new JsonObject();
|
|
||||||
chart.addProperty("chartId", chartId);
|
|
||||||
try {
|
|
||||||
JsonObject data = getChartData();
|
|
||||||
if (data == null) {
|
|
||||||
// If the data is null we don't send the chart.
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
chart.add("data", data);
|
|
||||||
} catch (Throwable t) {
|
|
||||||
if (logFailedRequests) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Failed to get data for custom chart with id " + chartId, t);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return chart;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract JsonObject getChartData() throws Exception;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a custom simple pie.
|
|
||||||
*/
|
|
||||||
public static class SimplePie extends CustomChart {
|
|
||||||
|
|
||||||
private final Callable<String> callable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class constructor.
|
|
||||||
*
|
|
||||||
* @param chartId The id of the chart.
|
|
||||||
* @param callable The callable which is used to request the chart data.
|
|
||||||
*/
|
|
||||||
public SimplePie(String chartId, Callable<String> callable) {
|
|
||||||
super(chartId);
|
|
||||||
this.callable = callable;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected JsonObject getChartData() throws Exception {
|
|
||||||
JsonObject data = new JsonObject();
|
|
||||||
String value = callable.call();
|
|
||||||
if (value == null || value.isEmpty()) {
|
|
||||||
// Null = skip the chart
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
data.addProperty("value", value);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a custom advanced pie.
|
|
||||||
*/
|
|
||||||
public static class AdvancedPie extends CustomChart {
|
|
||||||
|
|
||||||
private final Callable<Map<String, Integer>> callable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class constructor.
|
|
||||||
*
|
|
||||||
* @param chartId The id of the chart.
|
|
||||||
* @param callable The callable which is used to request the chart data.
|
|
||||||
*/
|
|
||||||
public AdvancedPie(String chartId, Callable<Map<String, Integer>> callable) {
|
|
||||||
super(chartId);
|
|
||||||
this.callable = callable;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected JsonObject getChartData() throws Exception {
|
|
||||||
JsonObject data = new JsonObject();
|
|
||||||
JsonObject values = new JsonObject();
|
|
||||||
Map<String, Integer> map = callable.call();
|
|
||||||
if (map == null || map.isEmpty()) {
|
|
||||||
// Null = skip the chart
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
boolean allSkipped = true;
|
|
||||||
for (Map.Entry<String, Integer> entry : map.entrySet()) {
|
|
||||||
if (entry.getValue() == 0) {
|
|
||||||
continue; // Skip this invalid
|
|
||||||
}
|
|
||||||
allSkipped = false;
|
|
||||||
values.addProperty(entry.getKey(), entry.getValue());
|
|
||||||
}
|
|
||||||
if (allSkipped) {
|
|
||||||
// Null = skip the chart
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
data.add("values", values);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a custom drilldown pie.
|
|
||||||
*/
|
|
||||||
public static class DrilldownPie extends CustomChart {
|
|
||||||
|
|
||||||
private final Callable<Map<String, Map<String, Integer>>> callable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class constructor.
|
|
||||||
*
|
|
||||||
* @param chartId The id of the chart.
|
|
||||||
* @param callable The callable which is used to request the chart data.
|
|
||||||
*/
|
|
||||||
public DrilldownPie(String chartId, Callable<Map<String, Map<String, Integer>>> callable) {
|
|
||||||
super(chartId);
|
|
||||||
this.callable = callable;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonObject getChartData() throws Exception {
|
|
||||||
JsonObject data = new JsonObject();
|
|
||||||
JsonObject values = new JsonObject();
|
|
||||||
Map<String, Map<String, Integer>> map = callable.call();
|
|
||||||
if (map == null || map.isEmpty()) {
|
|
||||||
// Null = skip the chart
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
boolean reallyAllSkipped = true;
|
|
||||||
for (Map.Entry<String, Map<String, Integer>> entryValues : map.entrySet()) {
|
|
||||||
JsonObject value = new JsonObject();
|
|
||||||
boolean allSkipped = true;
|
|
||||||
for (Map.Entry<String, Integer> valueEntry : map.get(entryValues.getKey()).entrySet()) {
|
|
||||||
value.addProperty(valueEntry.getKey(), valueEntry.getValue());
|
|
||||||
allSkipped = false;
|
|
||||||
}
|
|
||||||
if (!allSkipped) {
|
|
||||||
reallyAllSkipped = false;
|
|
||||||
values.add(entryValues.getKey(), value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (reallyAllSkipped) {
|
|
||||||
// Null = skip the chart
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
data.add("values", values);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a custom single line chart.
|
|
||||||
*/
|
|
||||||
public static class SingleLineChart extends CustomChart {
|
|
||||||
|
|
||||||
private final Callable<Integer> callable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class constructor.
|
|
||||||
*
|
|
||||||
* @param chartId The id of the chart.
|
|
||||||
* @param callable The callable which is used to request the chart data.
|
|
||||||
*/
|
|
||||||
public SingleLineChart(String chartId, Callable<Integer> callable) {
|
|
||||||
super(chartId);
|
|
||||||
this.callable = callable;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected JsonObject getChartData() throws Exception {
|
|
||||||
JsonObject data = new JsonObject();
|
|
||||||
int value = callable.call();
|
|
||||||
if (value == 0) {
|
|
||||||
// Null = skip the chart
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
data.addProperty("value", value);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a custom multi line chart.
|
|
||||||
*/
|
|
||||||
public static class MultiLineChart extends CustomChart {
|
|
||||||
|
|
||||||
private final Callable<Map<String, Integer>> callable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class constructor.
|
|
||||||
*
|
|
||||||
* @param chartId The id of the chart.
|
|
||||||
* @param callable The callable which is used to request the chart data.
|
|
||||||
*/
|
|
||||||
public MultiLineChart(String chartId, Callable<Map<String, Integer>> callable) {
|
|
||||||
super(chartId);
|
|
||||||
this.callable = callable;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected JsonObject getChartData() throws Exception {
|
|
||||||
JsonObject data = new JsonObject();
|
|
||||||
JsonObject values = new JsonObject();
|
|
||||||
Map<String, Integer> map = callable.call();
|
|
||||||
if (map == null || map.isEmpty()) {
|
|
||||||
// Null = skip the chart
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
boolean allSkipped = true;
|
|
||||||
for (Map.Entry<String, Integer> entry : map.entrySet()) {
|
|
||||||
if (entry.getValue() == 0) {
|
|
||||||
continue; // Skip this invalid
|
|
||||||
}
|
|
||||||
allSkipped = false;
|
|
||||||
values.addProperty(entry.getKey(), entry.getValue());
|
|
||||||
}
|
|
||||||
if (allSkipped) {
|
|
||||||
// Null = skip the chart
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
data.add("values", values);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a custom simple bar chart.
|
|
||||||
*/
|
|
||||||
public static class SimpleBarChart extends CustomChart {
|
|
||||||
|
|
||||||
private final Callable<Map<String, Integer>> callable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class constructor.
|
|
||||||
*
|
|
||||||
* @param chartId The id of the chart.
|
|
||||||
* @param callable The callable which is used to request the chart data.
|
|
||||||
*/
|
|
||||||
public SimpleBarChart(String chartId, Callable<Map<String, Integer>> callable) {
|
|
||||||
super(chartId);
|
|
||||||
this.callable = callable;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected JsonObject getChartData() throws Exception {
|
|
||||||
JsonObject data = new JsonObject();
|
|
||||||
JsonObject values = new JsonObject();
|
|
||||||
Map<String, Integer> map = callable.call();
|
|
||||||
if (map == null || map.isEmpty()) {
|
|
||||||
// Null = skip the chart
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
for (Map.Entry<String, Integer> entry : map.entrySet()) {
|
|
||||||
JsonArray categoryValues = new JsonArray();
|
|
||||||
categoryValues.add(new JsonPrimitive(entry.getValue()));
|
|
||||||
values.add(entry.getKey(), categoryValues);
|
|
||||||
}
|
|
||||||
data.add("values", values);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a custom advanced bar chart.
|
|
||||||
*/
|
|
||||||
public static class AdvancedBarChart extends CustomChart {
|
|
||||||
|
|
||||||
private final Callable<Map<String, int[]>> callable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class constructor.
|
|
||||||
*
|
|
||||||
* @param chartId The id of the chart.
|
|
||||||
* @param callable The callable which is used to request the chart data.
|
|
||||||
*/
|
|
||||||
public AdvancedBarChart(String chartId, Callable<Map<String, int[]>> callable) {
|
|
||||||
super(chartId);
|
|
||||||
this.callable = callable;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected JsonObject getChartData() throws Exception {
|
|
||||||
JsonObject data = new JsonObject();
|
|
||||||
JsonObject values = new JsonObject();
|
|
||||||
Map<String, int[]> map = callable.call();
|
|
||||||
if (map == null || map.isEmpty()) {
|
|
||||||
// Null = skip the chart
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
boolean allSkipped = true;
|
|
||||||
for (Map.Entry<String, int[]> entry : map.entrySet()) {
|
|
||||||
if (entry.getValue().length == 0) {
|
|
||||||
continue; // Skip this invalid
|
|
||||||
}
|
|
||||||
allSkipped = false;
|
|
||||||
JsonArray categoryValues = new JsonArray();
|
|
||||||
for (int categoryValue : entry.getValue()) {
|
|
||||||
categoryValues.add(new JsonPrimitive(categoryValue));
|
|
||||||
}
|
|
||||||
values.add(entry.getKey(), categoryValues);
|
|
||||||
}
|
|
||||||
if (allSkipped) {
|
|
||||||
// Null = skip the chart
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
data.add("values", values);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+39
-17
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,29 +16,51 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.util;
|
package com.rammelkast.anticheatreloaded.util;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
|
||||||
public enum ToolHardness {
|
/**
|
||||||
|
* Friction data library to prevent using Reflection or NMS
|
||||||
|
*/
|
||||||
|
public enum Friction {
|
||||||
|
|
||||||
// NOTHING(null, 1.5)
|
DEFAULT(0.6f),
|
||||||
WOOD(0.75D), STONE(0.40D), IRON(0.25D), DIAMOND(0.20D), SHEARS(0.55D), GOLD(0.15D);
|
ICE(0.98f),
|
||||||
|
BLUE_ICE(0.989f),
|
||||||
|
PACKED_ICE(0.98f),
|
||||||
|
SLIME_BLOCK(0.8f),
|
||||||
|
;
|
||||||
|
|
||||||
|
private final float factor;
|
||||||
|
|
||||||
double hardness;
|
Friction(final float factor) {
|
||||||
|
this.factor = factor;
|
||||||
ToolHardness(double hard) {
|
|
||||||
hardness = hard;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getToolHardness(Material tool) {
|
/**
|
||||||
for (ToolHardness e : ToolHardness.values()) {
|
* Gets the friction factor
|
||||||
if (tool.name().contains(e.name())) {
|
*
|
||||||
return e.hardness;
|
* @return the factor
|
||||||
}
|
*/
|
||||||
|
public float getFactor() {
|
||||||
|
return this.factor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the friction factor for the given block
|
||||||
|
*
|
||||||
|
* @param block The block
|
||||||
|
* @return the friction factor
|
||||||
|
*/
|
||||||
|
public static float getFactor(final Block block) {
|
||||||
|
final Material type = block.getType();
|
||||||
|
try {
|
||||||
|
return valueOf(type.name()).getFactor();
|
||||||
|
} catch (final Exception exception) {
|
||||||
|
return DEFAULT.getFactor();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1.50D;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -0,0 +1,402 @@
|
|||||||
|
/*
|
||||||
|
* ProtocolLib - Bukkit server library that allows access to the Minecraft protocol.
|
||||||
|
* Copyright (C) 2012 Kristian S. Stangeland
|
||||||
|
*
|
||||||
|
* 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 2 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||||
|
* 02111-1307 USA
|
||||||
|
*/
|
||||||
|
package com.rammelkast.anticheatreloaded.util;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
|
import com.comphenix.protocol.utility.SnapshotVersion;
|
||||||
|
import com.google.common.base.Objects;
|
||||||
|
import com.google.common.collect.ComparisonChain;
|
||||||
|
import com.google.common.collect.Ordering;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the current Minecraft version.
|
||||||
|
*
|
||||||
|
* @author Kristian
|
||||||
|
*/
|
||||||
|
public class MinecraftVersion implements Comparable<MinecraftVersion>, Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Regular expression used to parse version strings.
|
||||||
|
*/
|
||||||
|
private static final Pattern VERSION_PATTERN = Pattern.compile(".*\\(.*MC.\\s*([a-zA-z0-9\\-.]+).*");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version 1.18 - caves and cliffs part 2
|
||||||
|
*/
|
||||||
|
public static final MinecraftVersion CAVES_CLIFFS_2 = new MinecraftVersion("1.18");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version 1.17 - caves and cliffs part 1
|
||||||
|
*/
|
||||||
|
public static final MinecraftVersion CAVES_CLIFFS_1 = new MinecraftVersion("1.17");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version 1.16.2 - breaking change to the nether update
|
||||||
|
*/
|
||||||
|
public static final MinecraftVersion NETHER_UPDATE_2 = new MinecraftVersion("1.16.2");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version 1.16.0 - the nether update
|
||||||
|
*/
|
||||||
|
public static final MinecraftVersion NETHER_UPDATE = new MinecraftVersion("1.16");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version 1.15 - the bee update
|
||||||
|
*/
|
||||||
|
public static final MinecraftVersion BEE_UPDATE = new MinecraftVersion("1.15");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version 1.14 - village and pillage update.
|
||||||
|
*/
|
||||||
|
public static final MinecraftVersion VILLAGE_UPDATE = new MinecraftVersion("1.14");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version 1.13 - update aquatic.
|
||||||
|
*/
|
||||||
|
public static final MinecraftVersion AQUATIC_UPDATE = new MinecraftVersion("1.13");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version 1.12 - the world of color update.
|
||||||
|
*/
|
||||||
|
public static final MinecraftVersion COLOR_UPDATE = new MinecraftVersion("1.12");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version 1.11 - the exploration update.
|
||||||
|
*/
|
||||||
|
public static final MinecraftVersion EXPLORATION_UPDATE = new MinecraftVersion("1.11");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version 1.10 - the frostburn update.
|
||||||
|
*/
|
||||||
|
public static final MinecraftVersion FROSTBURN_UPDATE = new MinecraftVersion("1.10");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version 1.9 - the combat update.
|
||||||
|
*/
|
||||||
|
public static final MinecraftVersion COMBAT_UPDATE = new MinecraftVersion("1.9");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version 1.8 - the "bountiful" update.
|
||||||
|
*/
|
||||||
|
public static final MinecraftVersion BOUNTIFUL_UPDATE = new MinecraftVersion("1.8");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version 1.7.8 - the update that changed the skin format (and distribution - R.I.P. player disguise)
|
||||||
|
*/
|
||||||
|
public static final MinecraftVersion SKIN_UPDATE = new MinecraftVersion("1.7.8");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version 1.7.2 - the update that changed the world.
|
||||||
|
*/
|
||||||
|
public static final MinecraftVersion WORLD_UPDATE = new MinecraftVersion("1.7.2");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version 1.6.1 - the horse update.
|
||||||
|
*/
|
||||||
|
public static final MinecraftVersion HORSE_UPDATE = new MinecraftVersion("1.6.1");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version 1.5.0 - the redstone update.
|
||||||
|
*/
|
||||||
|
public static final MinecraftVersion REDSTONE_UPDATE = new MinecraftVersion("1.5.0");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version 1.4.2 - the scary update (Wither Boss).
|
||||||
|
*/
|
||||||
|
public static final MinecraftVersion SCARY_UPDATE = new MinecraftVersion("1.4.2");
|
||||||
|
|
||||||
|
private final int major;
|
||||||
|
private final int minor;
|
||||||
|
private final int build;
|
||||||
|
private Boolean atLeast;
|
||||||
|
|
||||||
|
// The development stage
|
||||||
|
private final String development;
|
||||||
|
|
||||||
|
// Snapshot?
|
||||||
|
private final SnapshotVersion snapshot;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the current Minecraft version.
|
||||||
|
* @param server - the Bukkit server that will be used to examine the MC version.
|
||||||
|
*/
|
||||||
|
public MinecraftVersion(Server server) {
|
||||||
|
this(extractVersion(server.getVersion()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a version object from the format major.minor.build, or the snapshot format.
|
||||||
|
* @param versionOnly - the version in text form.
|
||||||
|
*/
|
||||||
|
public MinecraftVersion(String versionOnly) {
|
||||||
|
this(versionOnly, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a version format from the standard release version or the snapshot verison.
|
||||||
|
* @param versionOnly - the version.
|
||||||
|
* @param parseSnapshot - TRUE to parse the snapshot, FALSE otherwise.
|
||||||
|
*/
|
||||||
|
private MinecraftVersion(String versionOnly, boolean parseSnapshot) {
|
||||||
|
String[] section = versionOnly.split("-");
|
||||||
|
SnapshotVersion snapshot = null;
|
||||||
|
int[] numbers = new int[3];
|
||||||
|
|
||||||
|
try {
|
||||||
|
numbers = parseVersion(section[0]);
|
||||||
|
|
||||||
|
} catch (NumberFormatException cause) {
|
||||||
|
// Skip snapshot parsing
|
||||||
|
if (!parseSnapshot)
|
||||||
|
throw cause;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Determine if the snapshot is newer than the current release version
|
||||||
|
snapshot = new SnapshotVersion(section[0]);
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
|
||||||
|
|
||||||
|
MinecraftVersion latest = new MinecraftVersion(ProtocolLibrary.MAXIMUM_MINECRAFT_VERSION, false);
|
||||||
|
boolean newer = snapshot.getSnapshotDate().compareTo(
|
||||||
|
format.parse(ProtocolLibrary.MINECRAFT_LAST_RELEASE_DATE)) > 0;
|
||||||
|
|
||||||
|
numbers[0] = latest.getMajor();
|
||||||
|
numbers[1] = latest.getMinor() + (newer ? 1 : -1);
|
||||||
|
numbers[2] = 0;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new IllegalStateException("Cannot parse " + section[0], e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.major = numbers[0];
|
||||||
|
this.minor = numbers[1];
|
||||||
|
this.build = numbers[2];
|
||||||
|
this.development = section.length > 1 ? section[1] : (snapshot != null ? "snapshot" : null);
|
||||||
|
this.snapshot = snapshot;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a version object directly.
|
||||||
|
* @param major - major version number.
|
||||||
|
* @param minor - minor version number.
|
||||||
|
* @param build - build version number.
|
||||||
|
*/
|
||||||
|
public MinecraftVersion(int major, int minor, int build) {
|
||||||
|
this(major, minor, build, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a version object directly.
|
||||||
|
* @param major - major version number.
|
||||||
|
* @param minor - minor version number.
|
||||||
|
* @param build - build version number.
|
||||||
|
* @param development - development stage.
|
||||||
|
*/
|
||||||
|
public MinecraftVersion(int major, int minor, int build, String development) {
|
||||||
|
this.major = major;
|
||||||
|
this.minor = minor;
|
||||||
|
this.build = build;
|
||||||
|
this.development = development;
|
||||||
|
this.snapshot = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int[] parseVersion(String version) {
|
||||||
|
String[] elements = version.split("\\.");
|
||||||
|
int[] numbers = new int[3];
|
||||||
|
|
||||||
|
// Make sure it's even a valid version
|
||||||
|
if (elements.length < 1)
|
||||||
|
throw new IllegalStateException("Corrupt MC version: " + version);
|
||||||
|
|
||||||
|
// The String 1 or 1.2 is interpreted as 1.0.0 and 1.2.0 respectively.
|
||||||
|
for (int i = 0; i < Math.min(numbers.length, elements.length); i++)
|
||||||
|
numbers[i] = Integer.parseInt(elements[i].trim());
|
||||||
|
return numbers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Major version number
|
||||||
|
* @return Current major version number.
|
||||||
|
*/
|
||||||
|
public int getMajor() {
|
||||||
|
return major;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Minor version number
|
||||||
|
* @return Current minor version number.
|
||||||
|
*/
|
||||||
|
public int getMinor() {
|
||||||
|
return minor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build version number
|
||||||
|
* @return Current build version number.
|
||||||
|
*/
|
||||||
|
public int getBuild() {
|
||||||
|
return build;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the development stage.
|
||||||
|
* @return Development stage, or NULL if this is a release.
|
||||||
|
*/
|
||||||
|
public String getDevelopmentStage() {
|
||||||
|
return development;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the snapshot version, or NULL if this is a release.
|
||||||
|
* @return The snapshot version.
|
||||||
|
*/
|
||||||
|
public SnapshotVersion getSnapshot() {
|
||||||
|
return snapshot;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if this version is a snapshot.
|
||||||
|
* @return The snapshot version.
|
||||||
|
*/
|
||||||
|
public boolean isSnapshot() {
|
||||||
|
return snapshot != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean atOrAbove() {
|
||||||
|
if (atLeast == null) {
|
||||||
|
atLeast = MinecraftVersion.atOrAbove(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return atLeast;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the version String (major.minor.build) only.
|
||||||
|
* @return A normal version string.
|
||||||
|
*/
|
||||||
|
public String getVersion() {
|
||||||
|
if (getDevelopmentStage() == null)
|
||||||
|
return String.format("%s.%s.%s", getMajor(), getMinor(), getBuild());
|
||||||
|
else
|
||||||
|
return String.format("%s.%s.%s-%s%s", getMajor(), getMinor(), getBuild(),
|
||||||
|
getDevelopmentStage(), isSnapshot() ? snapshot : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(MinecraftVersion o) {
|
||||||
|
if (o == null)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return ComparisonChain.start().
|
||||||
|
compare(getMajor(), o.getMajor()).
|
||||||
|
compare(getMinor(), o.getMinor()).
|
||||||
|
compare(getBuild(), o.getBuild()).
|
||||||
|
// No development String means it's a release
|
||||||
|
compare(getDevelopmentStage(), o.getDevelopmentStage(), Ordering.natural().nullsLast()).
|
||||||
|
compare(getSnapshot(), o.getSnapshot(), Ordering.natural().nullsFirst()).
|
||||||
|
result();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAtLeast(MinecraftVersion other) {
|
||||||
|
if (other == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return compareTo(other) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (obj == this)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (obj instanceof MinecraftVersion) {
|
||||||
|
MinecraftVersion other = (MinecraftVersion) obj;
|
||||||
|
|
||||||
|
return getMajor() == other.getMajor() &&
|
||||||
|
getMinor() == other.getMinor() &&
|
||||||
|
getBuild() == other.getBuild() &&
|
||||||
|
Objects.equal(getDevelopmentStage(), other.getDevelopmentStage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hashCode(getMajor(), getMinor(), getBuild());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
// Convert to a String that we can parse back again
|
||||||
|
return String.format("(MC: %s)", getVersion());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract the Minecraft version from CraftBukkit itself.
|
||||||
|
* @param text - the server version in text form.
|
||||||
|
* @return The underlying MC version.
|
||||||
|
* @throws IllegalStateException If we could not parse the version string.
|
||||||
|
*/
|
||||||
|
public static String extractVersion(String text) {
|
||||||
|
Matcher version = VERSION_PATTERN.matcher(text);
|
||||||
|
|
||||||
|
if (version.matches() && version.group(1) != null) {
|
||||||
|
return version.group(1);
|
||||||
|
} else {
|
||||||
|
throw new IllegalStateException("Cannot parse version String '" + text + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the given server version into a Minecraft version.
|
||||||
|
* @param serverVersion - the server version.
|
||||||
|
* @return The resulting Minecraft version.
|
||||||
|
*/
|
||||||
|
public static MinecraftVersion fromServerVersion(String serverVersion) {
|
||||||
|
return new MinecraftVersion(extractVersion(serverVersion));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static MinecraftVersion currentVersion;
|
||||||
|
|
||||||
|
public static void setCurrentVersion(MinecraftVersion version) {
|
||||||
|
currentVersion = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MinecraftVersion getCurrentVersion() {
|
||||||
|
if (currentVersion == null) {
|
||||||
|
currentVersion = fromServerVersion(Bukkit.getVersion());
|
||||||
|
}
|
||||||
|
|
||||||
|
return currentVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean atOrAbove(MinecraftVersion version) {
|
||||||
|
return getCurrentVersion().isAtLeast(version);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,8 +20,12 @@ package com.rammelkast.anticheatreloaded.util;
|
|||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
public class MovementManager {
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
|
||||||
|
public final class MovementManager {
|
||||||
|
|
||||||
// Ticks in air
|
// Ticks in air
|
||||||
public int airTicks = 0;
|
public int airTicks = 0;
|
||||||
@@ -37,20 +41,40 @@ public class MovementManager {
|
|||||||
public int iceInfluenceTicks = 0;
|
public int iceInfluenceTicks = 0;
|
||||||
// Ticks influenced by slime
|
// Ticks influenced by slime
|
||||||
public int slimeInfluenceTicks = 0;
|
public int slimeInfluenceTicks = 0;
|
||||||
|
// Ticks influenced by soil
|
||||||
|
public int soilInfluenceTicks = 0;
|
||||||
// Y motion of the movement
|
// Y motion of the movement
|
||||||
public double motionY;
|
public double motionY;
|
||||||
// Previous Y motion of the movement
|
// Previous Y motion of the movement
|
||||||
public double lastMotionY;
|
public double lastMotionY;
|
||||||
// Horizontal distance of movement
|
// Horizontal distance of movement
|
||||||
public double distanceXZ;
|
public double distanceXZ;
|
||||||
|
// Horizontal distance on x-axis of movement
|
||||||
|
public double distanceX;
|
||||||
|
// Horizontal distance on z-axis of movement
|
||||||
|
public double distanceZ;
|
||||||
// Previous horizontal distance of movement
|
// Previous horizontal distance of movement
|
||||||
public double lastDistanceXZ;
|
public double lastDistanceXZ;
|
||||||
|
// Previous horizontal distance on x-axis of movement
|
||||||
|
public double lastDistanceX;
|
||||||
|
// Previous horizontal distance on z-axis of movement
|
||||||
|
public double lastDistanceZ;
|
||||||
|
// Delta pitch
|
||||||
|
public float deltaPitch;
|
||||||
|
// Delta yaw
|
||||||
|
public float deltaYaw;
|
||||||
|
// Previous delta pitch
|
||||||
|
public float lastDeltaPitch;
|
||||||
|
// Previous delta yaw
|
||||||
|
public float lastDeltaYaw;
|
||||||
// If the player touched the ground again this tick
|
// If the player touched the ground again this tick
|
||||||
public boolean touchedGroundThisTick = false;
|
public boolean touchedGroundThisTick = false;
|
||||||
// Last recorded distance
|
// Last recorded distance
|
||||||
public Distance lastDistance = new Distance();
|
public Distance lastDistance = new Distance();
|
||||||
// Movement acceleration
|
// Movement acceleration
|
||||||
public double acceleration;
|
public double acceleration;
|
||||||
|
// Last movement acceleration
|
||||||
|
public double lastAcceleration;
|
||||||
// Is the block above solid
|
// Is the block above solid
|
||||||
public boolean topSolid;
|
public boolean topSolid;
|
||||||
// Is the block below solid
|
// Is the block below solid
|
||||||
@@ -59,6 +83,8 @@ public class MovementManager {
|
|||||||
public boolean halfMovement;
|
public boolean halfMovement;
|
||||||
// If the player is on the ground (determined clientside!)
|
// If the player is on the ground (determined clientside!)
|
||||||
public boolean onGround;
|
public boolean onGround;
|
||||||
|
// If the player was on the ground (determined clientside!)
|
||||||
|
public boolean wasOnGround;
|
||||||
// Ticks counter for last halfMovement
|
// Ticks counter for last halfMovement
|
||||||
public int halfMovementHistoryCounter = 0;
|
public int halfMovementHistoryCounter = 0;
|
||||||
// Time of last teleport
|
// Time of last teleport
|
||||||
@@ -67,81 +93,184 @@ public class MovementManager {
|
|||||||
public int elytraEffectTicks;
|
public int elytraEffectTicks;
|
||||||
// Used by Velocity check, represents the currently expected Y motion
|
// Used by Velocity check, represents the currently expected Y motion
|
||||||
public double velocityExpectedMotionY;
|
public double velocityExpectedMotionY;
|
||||||
|
// Used by Velocity check, represents the currently expected XZ motion
|
||||||
|
public double velocityExpectedMotionXZ;
|
||||||
|
// Amount of ticks a player is sneaking
|
||||||
|
public int sneakingTicks;
|
||||||
|
// Ticks counter after being near a liquid
|
||||||
|
public int nearLiquidTicks;
|
||||||
|
// Ticks of player blocking
|
||||||
|
public int blockingTicks;
|
||||||
|
// If the player has a speed effect
|
||||||
|
public boolean hasSpeedEffect = false;
|
||||||
|
// If the player had speed effect previous tick
|
||||||
|
public boolean hadSpeedEffect = false;
|
||||||
|
// Riptiding ticks
|
||||||
|
public int riptideTicks;
|
||||||
|
// Time of last update
|
||||||
|
public long lastUpdate;
|
||||||
|
// Last location
|
||||||
|
public Location lastLocation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used by prediction speed check
|
||||||
|
*/
|
||||||
|
public float friction;
|
||||||
|
public double adjusted;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public void handle(Player player, Location from, Location to, Distance distance) {
|
public void handle(final Player player, final Location from, final Location to, final Distance distance) {
|
||||||
// TODO as of now, we "trust" the client to send the right thing
|
this.wasOnGround = this.onGround;
|
||||||
// This is checked for spoofing by "GroundFlight"
|
|
||||||
// Also seems to make NoFall cheats flag for speed lmao
|
|
||||||
this.onGround = player.isOnGround();
|
this.onGround = player.isOnGround();
|
||||||
|
|
||||||
double x = distance.getXDifference();
|
this.lastLocation = from;
|
||||||
double z = distance.getZDifference();
|
|
||||||
this.lastDistanceXZ = this.distanceXZ;
|
final double x = distance.getXDifference();
|
||||||
|
final double z = distance.getZDifference();
|
||||||
|
this.lastDistanceXZ = this.distanceXZ;
|
||||||
|
this.lastDistanceX = this.distanceX;
|
||||||
|
this.lastDistanceZ = this.distanceZ;
|
||||||
this.distanceXZ = Math.sqrt(x * x + z * z);
|
this.distanceXZ = Math.sqrt(x * x + z * z);
|
||||||
|
this.distanceX = x;
|
||||||
|
this.distanceZ = z;
|
||||||
|
|
||||||
|
this.lastDeltaPitch = this.deltaPitch;
|
||||||
|
this.lastDeltaYaw = this.deltaYaw;
|
||||||
|
this.deltaPitch = Math.abs(to.getPitch() - from.getPitch());
|
||||||
|
this.deltaYaw = Math.abs(Utilities.computeAngleDifference(to.getYaw(), from.getYaw()));
|
||||||
|
|
||||||
// Account for standing on boat
|
// Account for standing on boat
|
||||||
if (Utilities.couldBeOnBoat(player, 0.25))
|
if (Utilities.couldBeOnBoat(player, 0.25, true) && !Utilities.isSubmersed(player)) {
|
||||||
this.onGround = true;
|
this.onGround = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle 1.9+ potion effects
|
||||||
|
if (MinecraftVersion.atOrAbove(MinecraftVersion.COMBAT_UPDATE)) {
|
||||||
|
for (PotionEffect effect : player.getActivePotionEffects()) {
|
||||||
|
if (!VersionLib.isLevitationEffect(effect)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
AntiCheatReloaded.getManager().getBackend().logLevitating(player, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.touchedGroundThisTick = false;
|
this.touchedGroundThisTick = false;
|
||||||
this.halfMovement = false;
|
this.halfMovement = false;
|
||||||
if (!this.onGround) {
|
if (!this.onGround) {
|
||||||
this.groundTicks = 0;
|
this.groundTicks = 0;
|
||||||
this.airTicks++;
|
this.airTicks++;
|
||||||
} else {
|
} else {
|
||||||
if (this.airTicks > 0)
|
if (this.airTicks > 0) {
|
||||||
this.touchedGroundThisTick = true;
|
this.touchedGroundThisTick = true;
|
||||||
|
}
|
||||||
this.airTicksBeforeGrounded = this.airTicks;
|
this.airTicksBeforeGrounded = this.airTicks;
|
||||||
this.airTicks = 0;
|
this.airTicks = 0;
|
||||||
this.groundTicks++;
|
this.groundTicks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utilities.couldBeOnIce(to)) {
|
if (Utilities.couldBeOnIce(to)) {
|
||||||
this.iceTicks++;
|
this.iceTicks++;
|
||||||
this.iceInfluenceTicks = 60;
|
this.iceInfluenceTicks = 60;
|
||||||
} else {
|
} else {
|
||||||
this.iceTicks = 0;
|
this.iceTicks = 0;
|
||||||
if (this.iceInfluenceTicks > 0)
|
if (this.iceInfluenceTicks > 0) {
|
||||||
this.iceInfluenceTicks--;
|
this.iceInfluenceTicks--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utilities.couldBeOnSlime(to)) {
|
if (Utilities.couldBeOnSlime(to)) {
|
||||||
this.slimeTicks++;
|
this.slimeTicks++;
|
||||||
this.slimeInfluenceTicks = 40;
|
this.slimeInfluenceTicks = 40;
|
||||||
} else {
|
} else {
|
||||||
this.slimeTicks = 0;
|
this.slimeTicks = 0;
|
||||||
if (this.slimeInfluenceTicks > 0)
|
if (this.slimeInfluenceTicks > 0) {
|
||||||
this.slimeInfluenceTicks--;
|
this.slimeInfluenceTicks--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VersionUtil.isGliding(player)) {
|
if (Utilities.couldBeOnSoil(to)) {
|
||||||
|
this.soilInfluenceTicks = 6;
|
||||||
|
} else {
|
||||||
|
if (this.soilInfluenceTicks > 0) {
|
||||||
|
this.soilInfluenceTicks--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (VersionLib.isGliding(player)) {
|
||||||
this.elytraEffectTicks = 30;
|
this.elytraEffectTicks = 30;
|
||||||
} else {
|
} else {
|
||||||
if (this.elytraEffectTicks > 0)
|
if (this.elytraEffectTicks > 0) {
|
||||||
this.elytraEffectTicks--;
|
this.elytraEffectTicks--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double lastDistanceSq = Math.sqrt(this.lastDistance.getXDifference() * this.lastDistance.getXDifference()
|
if (player.isSneaking()) {
|
||||||
|
this.sneakingTicks++;
|
||||||
|
} else {
|
||||||
|
this.sneakingTicks = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.isBlocking()) {
|
||||||
|
this.blockingTicks++;
|
||||||
|
} else {
|
||||||
|
this.blockingTicks = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Utilities.isNearWater(player)) {
|
||||||
|
this.nearLiquidTicks = 8;
|
||||||
|
} else {
|
||||||
|
if (this.nearLiquidTicks > 0) {
|
||||||
|
this.nearLiquidTicks--;
|
||||||
|
} else {
|
||||||
|
this.nearLiquidTicks = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (VersionLib.isRiptiding(player)) {
|
||||||
|
this.riptideTicks = 30;
|
||||||
|
} else {
|
||||||
|
if (this.riptideTicks > 0) {
|
||||||
|
this.riptideTicks--;
|
||||||
|
} else {
|
||||||
|
this.riptideTicks = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.hadSpeedEffect = this.hasSpeedEffect;
|
||||||
|
this.hasSpeedEffect = player.hasPotionEffect(PotionEffectType.SPEED);
|
||||||
|
|
||||||
|
final double lastDistanceSq = Math.sqrt(this.lastDistance.getXDifference() * this.lastDistance.getXDifference()
|
||||||
+ this.lastDistance.getZDifference() * this.lastDistance.getZDifference());
|
+ this.lastDistance.getZDifference() * this.lastDistance.getZDifference());
|
||||||
double currentDistanceSq = Math.sqrt(distance.getXDifference() * distance.getXDifference()
|
final double currentDistanceSq = Math.sqrt(distance.getXDifference() * distance.getXDifference()
|
||||||
+ distance.getZDifference() * distance.getZDifference());
|
+ distance.getZDifference() * distance.getZDifference());
|
||||||
|
this.lastAcceleration = this.acceleration;
|
||||||
this.acceleration = currentDistanceSq - lastDistanceSq;
|
this.acceleration = currentDistanceSq - lastDistanceSq;
|
||||||
|
|
||||||
this.lastMotionY = this.motionY;
|
this.lastMotionY = this.motionY;
|
||||||
this.motionY = to.getY() - from.getY();
|
this.motionY = to.getY() - from.getY();
|
||||||
|
|
||||||
Location top = to.clone().add(0, 2, 0);
|
final Location top = to.clone().add(0, 2, 0);
|
||||||
this.topSolid = top.getBlock().getType().isSolid();
|
this.topSolid = top.getBlock().getType().isSolid();
|
||||||
Location bottom = to.clone().add(0, -1, 0);
|
final Location bottom = to.clone().add(0, -1, 0);
|
||||||
this.bottomSolid = bottom.getBlock().getType().isSolid();
|
this.bottomSolid = bottom.getBlock().getType().isSolid();
|
||||||
|
|
||||||
if ((this.motionY > 0.464D && this.motionY <= 0.5625D) && (Utilities.couldBeOnHalfblock(to) || Utilities.isNearBed(to))) {
|
if ((this.motionY >= 0.42f && this.motionY <= 0.5625f)
|
||||||
|
&& (Utilities.couldBeOnHalfblock(to) || Utilities.isNearBed(to))) {
|
||||||
this.halfMovement = true;
|
this.halfMovement = true;
|
||||||
this.halfMovementHistoryCounter = 30;
|
this.halfMovementHistoryCounter = 30;
|
||||||
} else {
|
} else {
|
||||||
if (this.halfMovementHistoryCounter > 0)
|
if (this.halfMovementHistoryCounter > 0) {
|
||||||
this.halfMovementHistoryCounter--;
|
this.halfMovementHistoryCounter--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.lastUpdate = System.currentTimeMillis();
|
||||||
|
|
||||||
|
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
|
// Tick velocity tracker
|
||||||
|
user.getVelocityTracker().tick();
|
||||||
|
// Update "good location"
|
||||||
|
user.setGoodLocation(from);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
/*
|
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
|
||||||
*
|
|
||||||
* 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 com.rammelkast.anticheatreloaded.util;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.comphenix.protocol.PacketType;
|
|
||||||
import com.comphenix.protocol.events.ListenerPriority;
|
|
||||||
import com.comphenix.protocol.events.PacketAdapter;
|
|
||||||
import com.comphenix.protocol.events.PacketEvent;
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|
||||||
import com.rammelkast.anticheatreloaded.check.packet.BadPacketsCheck;
|
|
||||||
import com.rammelkast.anticheatreloaded.check.packet.MorePacketsCheck;
|
|
||||||
|
|
||||||
public class PacketListener {
|
|
||||||
|
|
||||||
public static void listenMovementPackets() {
|
|
||||||
AntiCheatReloaded.getProtocolManager()
|
|
||||||
.addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.LOWEST,
|
|
||||||
new PacketType[] { PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK,
|
|
||||||
PacketType.Play.Server.POSITION }) {
|
|
||||||
@Override
|
|
||||||
public void onPacketReceiving(PacketEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
|
|
||||||
// Run MorePackets check
|
|
||||||
MorePacketsCheck.runCheck(player, event);
|
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
|
||||||
// Run BadPackets check
|
|
||||||
BadPacketsCheck.runCheck(player, event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPacketSending(PacketEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
// Compensate for teleport
|
|
||||||
MorePacketsCheck.compensate(player);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void listenKeepAlivePackets() {
|
|
||||||
AntiCheatReloaded.getProtocolManager()
|
|
||||||
.addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.LOWEST,
|
|
||||||
new PacketType[] { PacketType.Play.Client.KEEP_ALIVE, PacketType.Play.Server.KEEP_ALIVE }) {
|
|
||||||
@Override
|
|
||||||
public void onPacketSending(PacketEvent event) {
|
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager()
|
|
||||||
.getUser(event.getPlayer().getUniqueId());
|
|
||||||
user.onServerPing();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPacketReceiving(PacketEvent event) {
|
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager()
|
|
||||||
.getUser(event.getPlayer().getUniqueId());
|
|
||||||
user.onClientPong();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -27,7 +27,7 @@ public enum Permission {
|
|||||||
CHECK_SNEAK, CHECK_SPEED, CHECK_VCLIP, CHECK_SPIDER, CHECK_NOFALL, CHECK_FASTBOW, CHECK_FASTEAT, CHECK_FASTHEAL,
|
CHECK_SNEAK, CHECK_SPEED, CHECK_VCLIP, CHECK_SPIDER, CHECK_NOFALL, CHECK_FASTBOW, CHECK_FASTEAT, CHECK_FASTHEAL,
|
||||||
CHECK_KILLAURA, CHECK_UNICODE, CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_FASTINVENTORY,
|
CHECK_KILLAURA, CHECK_UNICODE, CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_FASTINVENTORY,
|
||||||
CHECK_MOREPACKETS, CHECK_BADPACKETS, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_ILLEGALINTERACT, CHECK_FASTLADDER,
|
CHECK_MOREPACKETS, CHECK_BADPACKETS, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_ILLEGALINTERACT, CHECK_FASTLADDER,
|
||||||
CHECK_AIMBOT,
|
CHECK_AIMBOT, CHECK_STRAFE, CHECK_NOSLOW, CHECK_BOATFLY,
|
||||||
|
|
||||||
/* System Nodes */
|
/* System Nodes */
|
||||||
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_HELP, SYSTEM_VERSION, SYSTEM_REPORT, SYSTEM_NOTICE, SYSTEM_CHECK, SYSTEM_RELOAD,
|
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_HELP, SYSTEM_VERSION, SYSTEM_REPORT, SYSTEM_NOTICE, SYSTEM_CHECK, SYSTEM_RELOAD,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -23,7 +23,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
|
||||||
@@ -33,12 +33,16 @@ public class UpdateManager {
|
|||||||
public static final String SPIGOT_VERSION_URL = "https://api.spigotmc.org/legacy/update.php?resource="
|
public static final String SPIGOT_VERSION_URL = "https://api.spigotmc.org/legacy/update.php?resource="
|
||||||
+ RESOURCE_ID;
|
+ RESOURCE_ID;
|
||||||
|
|
||||||
private final String latestVersion;
|
private String latestVersion;
|
||||||
private final boolean isLatest;
|
private boolean isLatest;
|
||||||
private final boolean isAhead;
|
private boolean isAhead;
|
||||||
|
|
||||||
public UpdateManager() {
|
public UpdateManager() {
|
||||||
this.latestVersion = this.getOnlineData(SPIGOT_VERSION_URL);
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update() {
|
||||||
|
this.latestVersion = getOnlineData(SPIGOT_VERSION_URL);
|
||||||
if (this.latestVersion == null) {
|
if (this.latestVersion == null) {
|
||||||
this.isLatest = true;
|
this.isLatest = true;
|
||||||
this.isAhead = false;
|
this.isAhead = false;
|
||||||
@@ -55,26 +59,25 @@ public class UpdateManager {
|
|||||||
this.isAhead = splitCompare > 0;
|
this.isAhead = splitCompare > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getOnlineData(String url) {
|
private String getOnlineData(final String url) {
|
||||||
String data = null;
|
String data = null;
|
||||||
InputStream stream = null;
|
InputStream stream = null;
|
||||||
try {
|
try {
|
||||||
stream = new URL(url).openStream();
|
stream = new URL(url).openStream();
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(stream, Charset.forName("UTF-8")));
|
final BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));
|
||||||
StringBuilder builder = new StringBuilder();
|
final StringBuilder builder = new StringBuilder();
|
||||||
int readChar;
|
int readChar;
|
||||||
while ((readChar = reader.read()) != -1) {
|
while ((readChar = reader.read()) != -1) {
|
||||||
builder.append((char) readChar);
|
builder.append((char) readChar);
|
||||||
}
|
}
|
||||||
data = builder.toString();
|
data = builder.toString();
|
||||||
reader.close();
|
reader.close();
|
||||||
} catch (IOException exception) {}
|
} catch (final IOException exception) {}
|
||||||
finally {
|
finally {
|
||||||
if (stream != null) {
|
if (stream != null) {
|
||||||
try {
|
try {
|
||||||
stream.close();
|
stream.close();
|
||||||
} catch (IOException e) {
|
} catch (final IOException e) {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
@@ -98,27 +101,30 @@ public class UpdateManager {
|
|||||||
|
|
||||||
public class VersionSplit implements Comparable<VersionSplit> {
|
public class VersionSplit implements Comparable<VersionSplit> {
|
||||||
private final int major, minor, build;
|
private final int major, minor, build;
|
||||||
|
private boolean prerelease = false;
|
||||||
|
|
||||||
public VersionSplit(String version) throws Exception {
|
public VersionSplit(String version) throws Exception {
|
||||||
if (version.endsWith("-ALPHA")) {
|
if (version.endsWith("-ALPHA")) {
|
||||||
version = version.substring(0, version.length() - 6);
|
version = version.substring(0, version.length() - 6);
|
||||||
} else if (version.endsWith("-PRE")) {
|
} else if (version.endsWith("-PRE")) {
|
||||||
|
this.prerelease = true;
|
||||||
version = version.substring(0, version.length() - 4);
|
version = version.substring(0, version.length() - 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] versionSplit = version.split("\\.");
|
final String[] versionSplit = version.split("\\.");
|
||||||
if (versionSplit.length != 3) {
|
if (versionSplit.length != 3) {
|
||||||
// Illegal version
|
// Illegal version
|
||||||
throw new Exception("Version " + version + " is illegal!");
|
throw new Exception("Version " + version + " is illegal!");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int major = Integer.parseInt(versionSplit[0]);
|
final int major = Integer.parseInt(versionSplit[0]);
|
||||||
int minor = Integer.parseInt(versionSplit[1]);
|
final int minor = Integer.parseInt(versionSplit[1]);
|
||||||
int build = Integer.parseInt(versionSplit[2]);
|
final int build = Integer.parseInt(versionSplit[2]);
|
||||||
if (major <= 0) {
|
if (major <= 0) {
|
||||||
throw new Exception("Illegal version!");
|
throw new Exception("Illegal version!");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.major = major;
|
this.major = major;
|
||||||
this.minor = minor;
|
this.minor = minor;
|
||||||
this.build = build;
|
this.build = build;
|
||||||
@@ -128,11 +134,15 @@ public class UpdateManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(VersionSplit other) {
|
public int compareTo(final VersionSplit other) {
|
||||||
if (other.major == this.major) {
|
if (other.major == this.major) {
|
||||||
if (other.minor == this.minor) {
|
if (other.minor == this.minor) {
|
||||||
if (other.build == this.build) {
|
if (other.build == this.build) {
|
||||||
return 0;
|
if (!this.prerelease) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (other.build > this.build) {
|
if (other.build > this.build) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,29 +20,26 @@
|
|||||||
package com.rammelkast.anticheatreloaded.util;
|
package com.rammelkast.anticheatreloaded.util;
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.Inventory;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||||
import com.rammelkast.anticheatreloaded.util.rule.Rule;
|
import com.rammelkast.anticheatreloaded.util.rule.Rule;
|
||||||
|
|
||||||
public class User {
|
import lombok.Getter;
|
||||||
|
|
||||||
|
public final class User {
|
||||||
private final UUID uuid;
|
private final UUID uuid;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final int id;
|
private final int id;
|
||||||
private int level = 0;
|
private int level = 0;
|
||||||
private Location goodLocation;
|
private Location goodLocation;
|
||||||
private List<ItemStack> inventorySnapshot = null;
|
|
||||||
private Configuration config = AntiCheatReloaded.getManager().getConfiguration();
|
private Configuration config = AntiCheatReloaded.getManager().getConfiguration();
|
||||||
private int toX, toY, toZ;
|
private int toX, toY, toZ;
|
||||||
private String[] messages = new String[2];
|
private String[] messages = new String[2];
|
||||||
@@ -53,22 +50,30 @@ public class User {
|
|||||||
private boolean isWaitingOnLevelSync;
|
private boolean isWaitingOnLevelSync;
|
||||||
private Timestamp levelSyncTimestamp;
|
private Timestamp levelSyncTimestamp;
|
||||||
|
|
||||||
private long lastServerPing, lastClientPong;
|
|
||||||
private int ping = -1;
|
private int ping = -1;
|
||||||
private int lastPing = -1;
|
private int lastPing = -1;
|
||||||
|
|
||||||
private MovementManager movementManager;
|
@Getter
|
||||||
|
private final MovementManager movementManager;
|
||||||
|
@Getter
|
||||||
|
private final VelocityTracker velocityTracker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize an AntiCheat user
|
* Initialize an AntiCheat user
|
||||||
*
|
*
|
||||||
* @param uuid Player's UUID
|
* @param uuid Player's UUID
|
||||||
*/
|
*/
|
||||||
public User(UUID uuid) {
|
public User(final UUID uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.name = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getName() : "";
|
this.name = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getName() : "";
|
||||||
this.id = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getEntityId() : -1;
|
this.id = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getEntityId() : -1;
|
||||||
|
this.ping = getPlayer() != null && getPlayer().isOnline() ? VersionLib.getPlayerPing(getPlayer()) : -1;
|
||||||
|
|
||||||
this.movementManager = new MovementManager();
|
this.movementManager = new MovementManager();
|
||||||
|
this.velocityTracker = new VelocityTracker(this.config.getMagic().VELOCITY_TIME());
|
||||||
|
|
||||||
|
setIsWaitingOnLevelSync(true);
|
||||||
|
config.getLevels().loadLevelToUser(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -122,14 +127,15 @@ public class User {
|
|||||||
* @return group
|
* @return group
|
||||||
*/
|
*/
|
||||||
public Group getGroup() {
|
public Group getGroup() {
|
||||||
List<Group> groups = config.getGroups().getGroups();
|
final List<Group> groups = config.getGroups().getGroups();
|
||||||
for (int i = 0; i < groups.size(); i++) {
|
for (int i = 0; i < groups.size(); i++) {
|
||||||
if (i == 0 && level < groups.get(i).getLevel())
|
if (i == 0 && level < groups.get(i).getLevel()) {
|
||||||
break;
|
break;
|
||||||
else if (i == groups.size() - 1)
|
} else if (i == groups.size() - 1) {
|
||||||
return groups.get(i);
|
return groups.get(i);
|
||||||
else if (level >= groups.get(i).getLevel() && level < groups.get(i + 1).getLevel())
|
} else if (level >= groups.get(i).getLevel() && level < groups.get(i + 1).getLevel()) {
|
||||||
return groups.get(i);
|
return groups.get(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -140,7 +146,7 @@ public class User {
|
|||||||
* @param type The check failed
|
* @param type The check failed
|
||||||
* @return true if the level was increased
|
* @return true if the level was increased
|
||||||
*/
|
*/
|
||||||
public boolean increaseLevel(CheckType type) {
|
public boolean increaseLevel(final CheckType type) {
|
||||||
if (getPlayer() != null && getPlayer().isOnline()) {
|
if (getPlayer() != null && getPlayer().isOnline()) {
|
||||||
if (silentMode() && type.getUses(uuid) % 4 != 0) {
|
if (silentMode() && type.getUses(uuid) % 4 != 0) {
|
||||||
// Prevent silent mode from increasing the level way too fast
|
// Prevent silent mode from increasing the level way too fast
|
||||||
@@ -150,17 +156,17 @@ public class User {
|
|||||||
level++;
|
level++;
|
||||||
|
|
||||||
// Check levels
|
// Check levels
|
||||||
for (Group l : getLevels()) {
|
for (final Group group : getLevels()) {
|
||||||
if (l.getLevel() == level) {
|
if (group.getLevel() == level) {
|
||||||
AntiCheatReloaded.getManager().getUserManager().alert(this, l, type);
|
AntiCheatReloaded.getManager().getUserManager().alert(this, group, type);
|
||||||
if (l.getLevel() == config.getGroups().getHighestLevel()) {
|
if (group.getLevel() == config.getGroups().getHighestLevel()) {
|
||||||
level = l.getLevel() - 10;
|
level = group.getLevel() - 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute rules
|
// Execute rules
|
||||||
for (Rule rule : config.getRules().getRules()) {
|
for (final Rule rule : config.getRules().getRules()) {
|
||||||
rule.check(this, type);
|
rule.check(this, type);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -186,7 +192,7 @@ public class User {
|
|||||||
* @param level level to set
|
* @param level level to set
|
||||||
* @return true if the level was valid and set properly
|
* @return true if the level was valid and set properly
|
||||||
*/
|
*/
|
||||||
public boolean setLevel(int level) {
|
public boolean setLevel(final int level) {
|
||||||
isWaitingOnLevelSync = false;
|
isWaitingOnLevelSync = false;
|
||||||
if (level >= 0) {
|
if (level >= 0) {
|
||||||
if (level <= config.getGroups().getHighestLevel()) {
|
if (level <= config.getGroups().getHighestLevel()) {
|
||||||
@@ -206,7 +212,7 @@ public class User {
|
|||||||
*/
|
*/
|
||||||
public void resetLevel() {
|
public void resetLevel() {
|
||||||
level = 0;
|
level = 0;
|
||||||
for (CheckType type : CheckType.values()) {
|
for (final CheckType type : CheckType.values()) {
|
||||||
type.clearUse(uuid);
|
type.clearUse(uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -217,12 +223,13 @@ public class User {
|
|||||||
* @param location default value to be returned if no known good location exists
|
* @param location default value to be returned if no known good location exists
|
||||||
* @return last known valid location
|
* @return last known valid location
|
||||||
*/
|
*/
|
||||||
public Location getGoodLocation(Location location) {
|
public Location getGoodLocation(final Location location) {
|
||||||
if (goodLocation == null) {
|
if (goodLocation == null || !location.getWorld().equals(goodLocation.getWorld())
|
||||||
|
|| location.distance(goodLocation) > config.getConfig().maxSetbackDistance.getValue()) {
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
|
||||||
Location moveTo = goodLocation;
|
final Location moveTo = goodLocation;
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
moveTo.setPitch(location.getPitch());
|
moveTo.setPitch(location.getPitch());
|
||||||
moveTo.setYaw(location.getYaw());
|
moveTo.setYaw(location.getYaw());
|
||||||
@@ -236,10 +243,8 @@ public class User {
|
|||||||
* @param location location to be set
|
* @param location location to be set
|
||||||
* @return true if the location was valid and set properly
|
* @return true if the location was valid and set properly
|
||||||
*/
|
*/
|
||||||
public boolean setGoodLocation(Location location) {
|
public boolean setGoodLocation(final Location location) {
|
||||||
if (Utilities.cantStandAtExp(location)
|
if (Utilities.cantStandAtExp(location)) {
|
||||||
|| (location.getBlock().isLiquid() && !Utilities.isFullyInWater(location))
|
|
||||||
|| (!location.getBlock().getType().isSolid() && location.getBlock().getType() != Material.AIR)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,43 +252,6 @@ public class User {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Store a copy of the player's inventory, for use in resetting
|
|
||||||
*
|
|
||||||
* @param is ItemStack list to store
|
|
||||||
*/
|
|
||||||
public void setInventorySnapshot(ItemStack[] is) {
|
|
||||||
inventorySnapshot = new ArrayList<ItemStack>();
|
|
||||||
for (int i = 0; i < is.length; i++) {
|
|
||||||
if (is[i] != null) {
|
|
||||||
inventorySnapshot.add(is[i].clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the current inventory snapshot
|
|
||||||
*/
|
|
||||||
public void removeInventorySnapshot() {
|
|
||||||
inventorySnapshot = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Restore the player's inventory with the current inventory snapshot
|
|
||||||
*
|
|
||||||
* @param inventory Player's inventory
|
|
||||||
*/
|
|
||||||
public void restoreInventory(Inventory inventory) {
|
|
||||||
if (inventorySnapshot != null) {
|
|
||||||
inventory.clear();
|
|
||||||
for (ItemStack is : inventorySnapshot) {
|
|
||||||
if (is != null) {
|
|
||||||
inventory.addItem(is);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the player's to location
|
* Set the player's to location
|
||||||
*
|
*
|
||||||
@@ -433,26 +401,16 @@ public class User {
|
|||||||
return levelSyncTimestamp;
|
return levelSyncTimestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onServerPing() {
|
|
||||||
this.lastServerPing = System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClientPong() {
|
|
||||||
this.lastClientPong = System.currentTimeMillis();
|
|
||||||
this.lastPing = this.ping;
|
|
||||||
this.ping = (int) (this.lastClientPong - this.lastServerPing);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPing() {
|
public int getPing() {
|
||||||
int ping = this.ping;
|
final int ping = this.ping;
|
||||||
if (ping < 0) {
|
if (ping < 0) {
|
||||||
return VersionUtil.getPlayerPing(this.getPlayer());
|
return VersionLib.getPlayerPing(getPlayer());
|
||||||
}
|
}
|
||||||
return ping;
|
return ping;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLastPing() {
|
public int getLastPing() {
|
||||||
int lastPing = this.lastPing;
|
final int lastPing = this.lastPing;
|
||||||
if (lastPing < 0) {
|
if (lastPing < 0) {
|
||||||
return this.getPing();
|
return this.getPing();
|
||||||
}
|
}
|
||||||
@@ -460,11 +418,8 @@ public class User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLagging() {
|
public boolean isLagging() {
|
||||||
return Math.abs(this.ping - this.lastPing) > config.getMagic().LAG_DETERMINATION();
|
return Math.abs(this.ping - this.lastPing) > config.getMagic().LAG_DETERMINATION()
|
||||||
}
|
&& this.ping > config.getMagic().LAG_DETERMINATION();
|
||||||
|
|
||||||
public MovementManager getMovementManager() {
|
|
||||||
return this.movementManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,49 @@
|
|||||||
|
package com.rammelkast.anticheatreloaded.util;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public final class VelocityTracker {
|
||||||
|
|
||||||
|
private final long velocitizedTime;
|
||||||
|
private final List<VelocityWrapper> velocities = new ArrayList<>();
|
||||||
|
|
||||||
|
public void registerVelocity(final Vector vector) {
|
||||||
|
this.velocities.add(new VelocityWrapper(vector.getX(), vector.getY(), vector.getZ(),
|
||||||
|
Math.hypot(vector.getX(), vector.getZ()), Math.abs(vector.getY()), System.currentTimeMillis()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void tick() {
|
||||||
|
this.velocities
|
||||||
|
.removeIf(velocity -> (velocity.getTimestamp() + this.velocitizedTime < System.currentTimeMillis()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getHorizontal() {
|
||||||
|
return Math
|
||||||
|
.sqrt(this.velocities.parallelStream().mapToDouble(VelocityWrapper::getHorizontal).max().orElse(0.0D));
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getVertical() {
|
||||||
|
return Math
|
||||||
|
.sqrt(this.velocities.parallelStream().mapToDouble(VelocityWrapper::getVertical).max().orElse(0.0D));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVelocitized() {
|
||||||
|
return this.velocities.size() != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Getter
|
||||||
|
private class VelocityWrapper {
|
||||||
|
private final double motionX, motionY, motionZ;
|
||||||
|
private final double horizontal, vertical;
|
||||||
|
private final long timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
|
*
|
||||||
|
* 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 com.rammelkast.anticheatreloaded.util;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
|
||||||
|
public class VersionLib {
|
||||||
|
|
||||||
|
public static final MinecraftVersion CURRENT_VERSION;
|
||||||
|
private static final List<String> SUPPORTED_VERSIONS;
|
||||||
|
|
||||||
|
public static String getVersion() {
|
||||||
|
return Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isSupported() {
|
||||||
|
for (String versionId : SUPPORTED_VERSIONS) {
|
||||||
|
if (getVersion().startsWith(versionId)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isOfVersion(final String versionId) {
|
||||||
|
if (getVersion().startsWith(versionId)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isFlying(final Player player) {
|
||||||
|
return player.isFlying() || player.getGameMode() == GameMode.SPECTATOR || player.isGliding() || player.hasPotionEffect(PotionEffectType.LEVITATION)
|
||||||
|
|| AntiCheatReloaded.getManager().getBackend().justLevitated(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isSlowFalling(final Player player) {
|
||||||
|
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return player.hasPotionEffect(PotionEffectType.SLOW_FALLING);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isRiptiding(final Player player) {
|
||||||
|
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return player.isRiptiding();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isFrostWalk(final Player player) {
|
||||||
|
if (player.getInventory().getBoots() == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return player.getInventory().getBoots().containsEnchantment(Enchantment.FROST_WALKER);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isSoulSpeed(final ItemStack boots) {
|
||||||
|
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.NETHER_UPDATE)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return boots.containsEnchantment(Enchantment.SOUL_SPEED);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack getItemInHand(final Player player) {
|
||||||
|
return player.getInventory().getItemInMainHand();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getPlayerPing(final Player player) {
|
||||||
|
// May be called with offline (null) player
|
||||||
|
if (player == null) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.CAVES_CLIFFS_1)) {
|
||||||
|
try {
|
||||||
|
final Object entityPlayer = player.getClass().getMethod("getHandle").invoke(player);
|
||||||
|
final int ping = (int) entityPlayer.getClass().getField("ping").get(entityPlayer);
|
||||||
|
return ping;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return player.getPing();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Block getTargetBlock(final Player player, final int distance) {
|
||||||
|
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
|
||||||
|
return player.getTargetBlock((Set<Material>) null, distance);
|
||||||
|
}
|
||||||
|
return player.getTargetBlockExact(distance);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isGliding(final Player player) {
|
||||||
|
return player.isGliding();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isLevitationEffect(final PotionEffect effect) {
|
||||||
|
return effect.getType().equals(PotionEffectType.LEVITATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getPotionLevel(final Player player, final PotionEffectType type) {
|
||||||
|
if (player.hasPotionEffect(type)) {
|
||||||
|
return player.getPotionEffect(type).getAmplifier() + 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isSwimming(final Player player) {
|
||||||
|
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return player.isSwimming();
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
SUPPORTED_VERSIONS = Arrays.asList(new String[] { "v1_18", "v1_17", "v1_16", "v1_15", "v1_14", "v1_13", "v1_12" });
|
||||||
|
CURRENT_VERSION = MinecraftVersion.getCurrentVersion();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,137 +0,0 @@
|
|||||||
/*
|
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
|
||||||
*
|
|
||||||
* 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 com.rammelkast.anticheatreloaded.util;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|
||||||
|
|
||||||
public class VersionUtil {
|
|
||||||
|
|
||||||
private static final List<String> SUPPORTED_VERSIONS = Arrays
|
|
||||||
.asList(new String[] { "v1_16", "v1_15", "v1_14", "v1_13", "v1_8_R3" });
|
|
||||||
|
|
||||||
public static String getVersion() {
|
|
||||||
return Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isSupported() {
|
|
||||||
for (String versionId : SUPPORTED_VERSIONS) {
|
|
||||||
if (getVersion().startsWith(versionId)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isOfVersion(String versionId) {
|
|
||||||
if (getVersion().startsWith(versionId)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the if server is running Bountiful Update (1.8)
|
|
||||||
*/
|
|
||||||
public static boolean isBountifulUpdate() {
|
|
||||||
return isOfVersion("v1_8");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isFlying(Player player) {
|
|
||||||
if (isBountifulUpdate()) {
|
|
||||||
return player.isFlying();
|
|
||||||
}
|
|
||||||
return player.isFlying() || player.isGliding() || player.hasPotionEffect(PotionEffectType.LEVITATION)
|
|
||||||
|| AntiCheatReloaded.getManager().getBackend().justLevitated(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isRiptiding(Player player) {
|
|
||||||
if (isBountifulUpdate()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return player.isRiptiding();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isSlowFalling(Player player) {
|
|
||||||
if (isBountifulUpdate()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return player.hasPotionEffect(PotionEffectType.SLOW_FALLING);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isFrostWalk(Player player) {
|
|
||||||
if (player.getInventory().getBoots() == null || isBountifulUpdate()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return player.getInventory().getBoots().containsEnchantment(Enchantment.FROST_WALKER);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public static ItemStack getItemInHand(Player player) {
|
|
||||||
if (isBountifulUpdate()) {
|
|
||||||
return player.getItemInHand();
|
|
||||||
}
|
|
||||||
return player.getInventory().getItemInMainHand();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getPlayerPing(Player player) {
|
|
||||||
try {
|
|
||||||
Object entityPlayer = player.getClass().getMethod("getHandle").invoke(player);
|
|
||||||
int ping = (int) entityPlayer.getClass().getField("ping").get(entityPlayer);
|
|
||||||
return ping;
|
|
||||||
} catch (Exception e) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Block getTargetBlock(Player player, int distance) {
|
|
||||||
if (isBountifulUpdate()) {
|
|
||||||
return player.getTargetBlock((Set<Material>) null, distance);
|
|
||||||
}
|
|
||||||
return player.getTargetBlockExact(distance);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isGliding(Player player) {
|
|
||||||
if (isBountifulUpdate()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return player.isGliding();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isLevitationEffect(PotionEffect effect) {
|
|
||||||
if (isBountifulUpdate()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return effect.getType().equals(PotionEffectType.LEVITATION);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,78 +19,106 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.util.rule;
|
package com.rammelkast.anticheatreloaded.util.rule;
|
||||||
|
|
||||||
|
import java.util.SortedMap;
|
||||||
|
|
||||||
import javax.script.ScriptEngine;
|
import javax.script.ScriptEngine;
|
||||||
import javax.script.ScriptEngineManager;
|
import javax.script.ScriptEngineManager;
|
||||||
import javax.script.ScriptException;
|
import javax.script.ScriptException;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
|
|
||||||
import java.util.SortedMap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The conditional rule follows the same syntax as the traditional CS conditional operator.<br />
|
* The conditional rule follows the same syntax as the traditional CS
|
||||||
|
* conditional operator.<br />
|
||||||
* (CONDITION) ? (TRUE RESULT) : (FALSE RESULT)<br />
|
* (CONDITION) ? (TRUE RESULT) : (FALSE RESULT)<br />
|
||||||
* Where CONDITION is a statement that will be evaluated as either <b>TRUE</b> or <b>FALSE</b>
|
* Where CONDITION is a statement that will be evaluated as either <b>TRUE</b>
|
||||||
* and the results are actions to be taken for either outcome.
|
* or <b>FALSE</b> and the results are actions to be taken for either outcome.
|
||||||
* <br /><br />
|
* <br />
|
||||||
|
* <br />
|
||||||
* <p/>
|
* <p/>
|
||||||
* Should you need additional actions, the system will recursively parse the following values and handle appropriately.
|
* Should you need additional actions, the system will recursively parse the
|
||||||
|
* following values and handle appropriately. <br />
|
||||||
|
* For instance, (CONDITION) ? (TRUE RESULT) : (CONDITION) ? (TRUE RESULT) :
|
||||||
|
* (FALSE RESULT) is a valid rule <br />
|
||||||
* <br />
|
* <br />
|
||||||
* For instance, (CONDITION) ? (TRUE RESULT) : (CONDITION) ? (TRUE RESULT) : (FALSE RESULT) is a valid rule
|
|
||||||
* <br /><br />
|
|
||||||
* <p/>
|
* <p/>
|
||||||
* An example of a valid Conditional Rule:<br />
|
* An example of a valid Conditional Rule:<br />
|
||||||
* Check_SPIDER > 0 ? Player.KICK : null<br />
|
* Check_SPIDER > 0 ? Player.KICK : null<br />
|
||||||
* <i>The above statement would read 'If the spider check has been failed over zero times, kick the player. Otherwise, do nothing.'</i>
|
* <i>The above statement would read 'If the spider check has been failed over
|
||||||
|
* zero times, kick the player. Otherwise, do nothing.'</i>
|
||||||
* <p/>
|
* <p/>
|
||||||
* To see syntax for variables and functions that you may use, see {@link com.rammelkast.anticheatreloaded.util.rule.Rule}
|
* To see syntax for variables and functions that you may use, see
|
||||||
|
* {@link com.rammelkast.anticheatreloaded.util.rule.Rule}
|
||||||
*/
|
*/
|
||||||
public class ConditionalRule extends Rule {
|
public class ConditionalRule extends Rule {
|
||||||
|
|
||||||
private static ScriptEngineManager factory = new ScriptEngineManager();
|
private static final ScriptEngineManager FACTORY = new ScriptEngineManager();
|
||||||
private static ScriptEngine engine = factory.getEngineByName("js");
|
private static final ScriptEngine ENGINE;
|
||||||
|
|
||||||
private static final String TRUE_DELIMITER = "\\?";
|
private static final String TRUE_DELIMITER = "\\?";
|
||||||
private static final String FALSE_DELIMITER = ":";
|
private static final String FALSE_DELIMITER = ":";
|
||||||
private static final Type TYPE = Type.CONDITIONAL;
|
private static final Type TYPE = Type.CONDITIONAL;
|
||||||
|
|
||||||
public ConditionalRule(String string) {
|
public ConditionalRule(String string) {
|
||||||
super(string, TYPE);
|
super(string, TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean check(User user, CheckType type) {
|
public boolean check(User user, CheckType type) {
|
||||||
try {
|
// No nashorn support
|
||||||
// Load all variables
|
if (ENGINE == null) {
|
||||||
SortedMap<String, Object> map = getVariables(user, type);
|
return true;
|
||||||
for (String key : map.keySet()) {
|
}
|
||||||
engine.put(key, map.get(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean value = (Boolean) engine.eval(getString().split(TRUE_DELIMITER)[0]);
|
try {
|
||||||
// Yo dawg I heard you like conditionals...
|
// Load all variables
|
||||||
String next = value ? getString().split(TRUE_DELIMITER)[1].split(FALSE_DELIMITER)[0] : getString().split(TRUE_DELIMITER)[1].split(FALSE_DELIMITER)[1];
|
SortedMap<String, Object> map = getVariables(user, type);
|
||||||
|
for (String key : map.keySet()) {
|
||||||
|
ENGINE.put(key, map.get(key));
|
||||||
|
}
|
||||||
|
|
||||||
execute(next, user, type);
|
boolean value = (Boolean) ENGINE.eval(getString().split(TRUE_DELIMITER)[0]);
|
||||||
return value;
|
// Yo dawg I heard you like conditionals...
|
||||||
} catch (ScriptException e) {
|
String next = value ? getString().split(TRUE_DELIMITER)[1].split(FALSE_DELIMITER)[0]
|
||||||
e.printStackTrace();
|
: getString().split(TRUE_DELIMITER)[1].split(FALSE_DELIMITER)[1];
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void execute(String string, User user, CheckType type) {
|
execute(next, user, type);
|
||||||
// If we're told to do nothing
|
return value;
|
||||||
if (string.equalsIgnoreCase("null") || string.equalsIgnoreCase("none")) return;
|
} catch (ScriptException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// If this string is a new conditional statement
|
private void execute(String string, User user, CheckType type) {
|
||||||
if (TYPE.matches(string)) {
|
// If we're told to do nothing
|
||||||
new ConditionalRule(string).check(user, type);
|
if (string.equalsIgnoreCase("null") || string.equalsIgnoreCase("none"))
|
||||||
} else if (isVariableSet(string)) {
|
return;
|
||||||
setVariable(string.split("=")[0], string.split("=")[1], user);
|
|
||||||
} else if (isFunction(string)) {
|
// If this string is a new conditional statement
|
||||||
doFunction(string, type, user);
|
if (TYPE.matches(string)) {
|
||||||
}
|
new ConditionalRule(string).check(user, type);
|
||||||
}
|
} else if (isVariableSet(string)) {
|
||||||
|
setVariable(string.split("=")[0], string.split("=")[1], user);
|
||||||
|
} else if (isFunction(string)) {
|
||||||
|
doFunction(string, type, user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
// Nashorn was removed in Java 15, so we disable the rules engine until we
|
||||||
|
// change it
|
||||||
|
if (Double.parseDouble(System.getProperty("java.specification.version")) < 15) {
|
||||||
|
ENGINE = FACTORY.getEngineByName("js");
|
||||||
|
} else {
|
||||||
|
ENGINE = null;
|
||||||
|
Bukkit.getConsoleSender().sendMessage(AntiCheatReloaded.PREFIX + ChatColor.RED
|
||||||
|
+ "Java 15+ currently does not support ACR's rule engine. Rules.yml is disabled.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
* Copyright (c) 2016-2022 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+116
-66
@@ -1,4 +1,7 @@
|
|||||||
# AntiCheatReloaded checks configuration file
|
# AntiCheatReloaded checks configuration file
|
||||||
|
# Checks that have multiple modules need to be disabled on a per-module basis
|
||||||
|
# If you have a false positive and can't determine what subcheck it's from,
|
||||||
|
# enable debug-mode in config.yml and compare the results against the commented values
|
||||||
# Flight check settings
|
# Flight check settings
|
||||||
# Checks if a player moves wrongly in the air
|
# Checks if a player moves wrongly in the air
|
||||||
flight:
|
flight:
|
||||||
@@ -12,10 +15,10 @@ flight:
|
|||||||
accountForBlockPlacement: 1200
|
accountForBlockPlacement: 1200
|
||||||
# How many milliseconds to account for TPS drops
|
# How many milliseconds to account for TPS drops
|
||||||
# Increase this if you get false positives when building a tower during TPS drops
|
# Increase this if you get false positives when building a tower during TPS drops
|
||||||
accountForTpsDrops: 250
|
accountForTpsDrops: 300
|
||||||
# How many milliseconds to account for teleports
|
# How many milliseconds to account for teleports
|
||||||
# Increase this is you debug 'had too little Y dropoff' after teleports
|
# Increase this is you debug 'had too little Y dropoff' after teleports
|
||||||
accountForTeleports: 100
|
accountForTeleports: 500
|
||||||
# Checks for climbing behaviour in air
|
# Checks for climbing behaviour in air
|
||||||
# Debugs as 'tried to climb air'
|
# Debugs as 'tried to climb air'
|
||||||
airClimb:
|
airClimb:
|
||||||
@@ -23,7 +26,7 @@ flight:
|
|||||||
enabled: true
|
enabled: true
|
||||||
# How many milliseconds to account for teleports
|
# How many milliseconds to account for teleports
|
||||||
# Increase this is you debug 'tried to climb air' after teleports
|
# Increase this is you debug 'tried to climb air' after teleports
|
||||||
accountForTeleports: 50
|
accountForTeleports: 300
|
||||||
# Checks if a player is faking it's ground status to fly
|
# Checks if a player is faking it's ground status to fly
|
||||||
# Debugs as 'faked ground to fly'
|
# Debugs as 'faked ground to fly'
|
||||||
groundFlight:
|
groundFlight:
|
||||||
@@ -38,39 +41,40 @@ flight:
|
|||||||
maxOffset: 0.005
|
maxOffset: 0.005
|
||||||
# How many milliseconds to account for teleports
|
# How many milliseconds to account for teleports
|
||||||
# Increase this is you debug 'ignored gravity' after teleports
|
# Increase this is you debug 'ignored gravity' after teleports
|
||||||
accountForTeleports: 100
|
accountForTeleports: 300
|
||||||
# Amount of illegal moves before flagging
|
# Amount of illegal moves before flagging
|
||||||
vlBeforeFlag: 5
|
vlBeforeFlag: 5
|
||||||
|
|
||||||
# ElytraFly check settings
|
# ElytraFly check settings
|
||||||
# Checks for illegal upward elytra movement
|
# Checks for illegal upward elytra movement
|
||||||
elytrafly:
|
elytrafly:
|
||||||
# Should this check be enabled?
|
# Should this check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
# Speed check settings
|
# Speed check settings
|
||||||
# Checks if a player moves too fast
|
# Checks if a player moves too fast
|
||||||
speed:
|
speed:
|
||||||
|
# Checks movement speed through prediction
|
||||||
|
# Debugs as 'moved unexpectedly'
|
||||||
|
predict:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
# Checks movement speed in the air
|
# Checks movement speed in the air
|
||||||
# Debugs as 'moved too fast in air'
|
# Debugs as 'moved too fast in air'
|
||||||
airSpeed:
|
airSpeed:
|
||||||
# Should this part of the check be enabled?
|
# Should this part of the check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
# Base unadjusted air speed limit
|
# Base unadjusted air speed limit
|
||||||
baseLimit: 0.03125
|
baseLimit: 0.0315
|
||||||
# Prediction multiplier for custom walk speeds
|
# Prediction multiplier for custom walk speeds
|
||||||
walkSpeedMultiplier: 1.4
|
walkSpeedMultiplier: 1.4
|
||||||
|
|
||||||
# Checks movement acceleration in the air
|
# Checks movement acceleration in the air
|
||||||
# Debugs as 'exceeded acceleration limits'
|
# Debugs as 'exceeded acceleration limits'
|
||||||
airAcceleration:
|
airAcceleration:
|
||||||
# Should this part of the check be enabled?
|
# Should this part of the check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
# Base unadjusted air acceleration limit
|
# Base unadjusted air acceleration limit
|
||||||
baseLimit: 0.3725
|
baseLimit: 0.375
|
||||||
# Limit multiplier for custom walk speeds
|
# Limit multiplier for custom walk speeds
|
||||||
walkSpeedMultiplier: 1.4
|
walkSpeedMultiplier: 1.4
|
||||||
|
|
||||||
# Checks movement acceleration in the air
|
# Checks movement acceleration in the air
|
||||||
# Debugs as 'had unexpected jumping behaviour'
|
# Debugs as 'had unexpected jumping behaviour'
|
||||||
jumpBehaviour:
|
jumpBehaviour:
|
||||||
@@ -78,7 +82,6 @@ speed:
|
|||||||
enabled: true
|
enabled: true
|
||||||
# Minimum movement distance needed to flag
|
# Minimum movement distance needed to flag
|
||||||
minimumDistXZ: 0.42
|
minimumDistXZ: 0.42
|
||||||
|
|
||||||
# Checks movement speed on the ground
|
# Checks movement speed on the ground
|
||||||
# Debugs as 'moved too fast on ground'
|
# Debugs as 'moved too fast on ground'
|
||||||
groundSpeed:
|
groundSpeed:
|
||||||
@@ -86,7 +89,6 @@ speed:
|
|||||||
enabled: true
|
enabled: true
|
||||||
# Initial speed limit value
|
# Initial speed limit value
|
||||||
initialLimit: 0.34
|
initialLimit: 0.34
|
||||||
|
|
||||||
# Checks movement acceleration in the air
|
# Checks movement acceleration in the air
|
||||||
# Debugs as 'exceeded vertical speed limit'
|
# Debugs as 'exceeded vertical speed limit'
|
||||||
verticalSpeed:
|
verticalSpeed:
|
||||||
@@ -94,12 +96,20 @@ speed:
|
|||||||
enabled: true
|
enabled: true
|
||||||
# Extra compensation when moving off a ladder up a slab
|
# Extra compensation when moving off a ladder up a slab
|
||||||
climbableCompensation: 0.04
|
climbableCompensation: 0.04
|
||||||
|
# Strafe check settings
|
||||||
|
# Checks if a player switches movement angle in air
|
||||||
|
strafe:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# How many milliseconds to account for teleports
|
||||||
|
accountForTeleports: 300
|
||||||
|
# Maximum angle change when moving in air
|
||||||
|
maxAngleChange: 0.58
|
||||||
|
# Minimum movement distance for the strafe check to be active
|
||||||
|
minActivationDistance: 0.05
|
||||||
# WaterWalk check settings
|
# WaterWalk check settings
|
||||||
# Checks if a player is walking on water
|
# Checks if a player is walking on water
|
||||||
waterwalk:
|
waterwalk:
|
||||||
# Should this check be enabled?
|
|
||||||
enabled: true
|
|
||||||
# Checks for vanilla water walking/jumping
|
# Checks for vanilla water walking/jumping
|
||||||
# Debugs as 'tried to walk on water'
|
# Debugs as 'tried to walk on water'
|
||||||
walk:
|
walk:
|
||||||
@@ -109,21 +119,20 @@ waterwalk:
|
|||||||
# This combats false positives, while giving hackers not much leniency
|
# This combats false positives, while giving hackers not much leniency
|
||||||
minimumDistXZ: 0.092
|
minimumDistXZ: 0.092
|
||||||
# Checks for small hops on top of water
|
# Checks for small hops on top of water
|
||||||
# Debugs as 'tried to lunge on water'
|
# Debugs as 'tried to hop on water'
|
||||||
hop:
|
hop:
|
||||||
# Should this part of the check be enabled?
|
# Should this part of the check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
# Maximum lunge Y motion to flag
|
# Maximum lunge Y motion to flag
|
||||||
maxMotionY: 0.10
|
maxMotionY: 0.1
|
||||||
# Checks for small lunges in water
|
# Checks for small lunges in water
|
||||||
# Debugs as 'tried to walk on water'
|
# Debugs as 'tried to lunge in water'
|
||||||
lunge:
|
lunge:
|
||||||
# Should this part of the check be enabled?
|
# Should this part of the check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
# Minimum xz distance before flagging
|
# Minimum xz distance before flagging
|
||||||
# This combats false positives, while giving hackers not much leniency
|
# This combats false positives, while giving hackers not much leniency
|
||||||
minimumDistXZ: 0.0642
|
minimumDistXZ: 0.098
|
||||||
|
|
||||||
# FastLadder check settings
|
# FastLadder check settings
|
||||||
# Checks if a player moves too fast on a ladder
|
# Checks if a player moves too fast on a ladder
|
||||||
fastladder:
|
fastladder:
|
||||||
@@ -135,7 +144,13 @@ fastladder:
|
|||||||
speedDownMax: 0.15
|
speedDownMax: 0.15
|
||||||
# Amount of illegal ladder moves before flagging
|
# Amount of illegal ladder moves before flagging
|
||||||
vlBeforeFlag: 3
|
vlBeforeFlag: 3
|
||||||
|
# BoatFly check settings
|
||||||
|
# Checks if the player is flying in a boat
|
||||||
|
boatfly:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Amount of in-boat airborne moments before flagging
|
||||||
|
vlBeforeFlag: 2
|
||||||
# KillAura check settings
|
# KillAura check settings
|
||||||
# Checks if the player uses a form of kill aura
|
# Checks if the player uses a form of kill aura
|
||||||
killaura:
|
killaura:
|
||||||
@@ -147,9 +162,9 @@ killaura:
|
|||||||
# Maximum base reach distances
|
# Maximum base reach distances
|
||||||
baseMaxValue:
|
baseMaxValue:
|
||||||
# Maximum base reach value
|
# Maximum base reach value
|
||||||
normal: 3.6
|
normal: 3.55
|
||||||
# Maximum base reach value when a player has velocity
|
# Maximum base reach value when a player has velocity
|
||||||
velocitized: 4.0
|
velocitized: 4.05
|
||||||
# Settings for lag compensation
|
# Settings for lag compensation
|
||||||
lagCompensation:
|
lagCompensation:
|
||||||
# Basic extra allowed reach when a player is lagging
|
# Basic extra allowed reach when a player is lagging
|
||||||
@@ -157,44 +172,75 @@ killaura:
|
|||||||
# Extra allowed reach distance per millisecond of ping
|
# Extra allowed reach distance per millisecond of ping
|
||||||
pingCompensation: 0.0025
|
pingCompensation: 0.0025
|
||||||
# The multiplier of extra compensation for velocity
|
# The multiplier of extra compensation for velocity
|
||||||
velocityMultiplier: 1.2
|
velocityMultiplier: 1.3
|
||||||
|
|
||||||
# Checks if the target it within a players viewing angle
|
# Checks if the target it within a players viewing angle
|
||||||
# Debugs as 'tried to attack from an illegal angle'
|
# Debugs as 'tried to attack from an illegal angle'
|
||||||
angle:
|
angle:
|
||||||
# Should this part of the check be enabled?
|
# Should this part of the check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
# Maximum difference in angle from the players view
|
# Maximum difference in angle from the players view
|
||||||
maxDifference: 50
|
maxDifference: 60
|
||||||
# Amount of illegally angled hits before flagging
|
# Amount of illegally angled hits before flagging
|
||||||
vlBeforeFlag: 3
|
vlBeforeFlag: 3
|
||||||
|
# Checks if the player has a suspicious packet order
|
||||||
|
# Debugs as 'suspicious packet order'
|
||||||
|
packetOrder:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Minimum server TPS needed for the packet order subcheck to be active
|
||||||
|
minimumTps: 17.5
|
||||||
|
# Minimum elapsed time in milliseconds between a movement packet and a combat packet
|
||||||
|
minElapsedTime: 5
|
||||||
|
# Amount of suspicious combat packet situations before flagging
|
||||||
|
vlBeforeFlag: 3
|
||||||
|
# Checks player pitch behaviour during combat
|
||||||
|
# Debugs as 'had suspicious aim behaviour'
|
||||||
|
variance:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# How many samples should be taken (increase in case of false positives)
|
||||||
|
samples: 8
|
||||||
|
# Checks player pitch and yaw behaviour during combat
|
||||||
|
# Debugs as 'repeated aim pattern'
|
||||||
|
repeatedAim:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Checks if the player is hitting through objects
|
||||||
|
# Debugs as 'hit through object'
|
||||||
|
throughWalls:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Minimum server TPS needed for the packet order subcheck to be active
|
||||||
|
minimumTps: 17.5
|
||||||
|
# Should this check be disabled for lagging players? (this can be spoofed!)
|
||||||
|
disableForLagging: true
|
||||||
|
# Amount to expand hitbox by
|
||||||
|
expand: 0.3
|
||||||
|
# Amount of illegal hits before flagging
|
||||||
|
vlBeforeFlag: 4
|
||||||
# Aimbot check settings
|
# Aimbot check settings
|
||||||
# Checks if the player is sending aimbot-like movements
|
# Checks if the player is sending aimbot-like movements
|
||||||
aimbot:
|
aimbot:
|
||||||
# Should this check be enabled?
|
# Should this check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
# Minimum yaw difference when repeated
|
# Maximum pitch acceleration for check to consider aim illegal
|
||||||
minYaw: 30
|
minAcceleration: 5.5
|
||||||
# Maximum yaw difference when repeated
|
# Maximum mod value for check to consider aim illegal
|
||||||
maxYaw: 355
|
maxMod: 8.0E-4
|
||||||
|
|
||||||
# Criticals check settings
|
# Criticals check settings
|
||||||
# Checks if the player tries to do a crit without needed conditions
|
# Checks if the player tries to do a crit without needed conditions
|
||||||
criticals:
|
criticals:
|
||||||
# Should this check be enabled?
|
# Should this check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
# Velocity check settings
|
# Velocity check settings
|
||||||
# Checks if the player ignores knockback
|
# Checks if the player ignores knockback
|
||||||
velocity:
|
velocity:
|
||||||
# Should this check be enabled?
|
# Should this check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
# Minimum percentage of the given knockback a player has to meet
|
# Minimum percentage of the given knockback a player has to meet
|
||||||
minimumPercentage: 98
|
minimumPercentage: 75
|
||||||
# Amount of low-velocity moments before flagging
|
# Amount of low-velocity moments before flagging
|
||||||
vlBeforeFlag: 2
|
vlBeforeFlag: 2
|
||||||
|
|
||||||
# FastPlace check settings
|
# FastPlace check settings
|
||||||
# Checks if the player places blocks too fast
|
# Checks if the player places blocks too fast
|
||||||
fastplace:
|
fastplace:
|
||||||
@@ -203,12 +249,11 @@ fastplace:
|
|||||||
# Minimum time in milliseconds between block places
|
# Minimum time in milliseconds between block places
|
||||||
minimumTime: 50
|
minimumTime: 50
|
||||||
# Amount of fastplace-moments before flagging a survival player
|
# Amount of fastplace-moments before flagging a survival player
|
||||||
vlBeforeFlagSurvival: 2
|
vlBeforeFlagSurvival: 3
|
||||||
# Amount of fastplace-moments before flagging a creative player
|
# Amount of fastplace-moments before flagging a creative player
|
||||||
vlBeforeFlagCreative: 3
|
vlBeforeFlagCreative: 4
|
||||||
# Amount of time in milliseconds to prevent a player from placing blocks after flagging
|
# Amount of time in milliseconds to prevent a player from placing blocks after flagging
|
||||||
blockPlacementTime: 1000
|
blockPlacementTime: 1000
|
||||||
|
|
||||||
# IllegalInteract check settings
|
# IllegalInteract check settings
|
||||||
# Checks if the player is using, placing or breaking blocks from illegal angles
|
# Checks if the player is using, placing or breaking blocks from illegal angles
|
||||||
illegalinteract:
|
illegalinteract:
|
||||||
@@ -237,7 +282,6 @@ illegalinteract:
|
|||||||
pingCompensation: 0.0045
|
pingCompensation: 0.0045
|
||||||
# The multiplier of extra compensation for velocity
|
# The multiplier of extra compensation for velocity
|
||||||
velocityMultiplier: 1.5
|
velocityMultiplier: 1.5
|
||||||
|
|
||||||
# BadPackets check settings
|
# BadPackets check settings
|
||||||
# Checks for illegal packets
|
# Checks for illegal packets
|
||||||
badpackets:
|
badpackets:
|
||||||
@@ -247,46 +291,55 @@ badpackets:
|
|||||||
minimumTps: 17.5
|
minimumTps: 17.5
|
||||||
# Maximum distance a player can move between packets
|
# Maximum distance a player can move between packets
|
||||||
maxDistance: 25.0
|
maxDistance: 25.0
|
||||||
|
# The amount of milliseconds to compensate for a teleport (50ms = 1 tick)
|
||||||
|
teleportCompensation: 500
|
||||||
# MorePackets check settings
|
# MorePackets check settings
|
||||||
# Checks for an extra amount of packets and modified game timers
|
# Checks for an extra amount of packets and modified game timers
|
||||||
morepackets:
|
morepackets:
|
||||||
# Should this check be enabled?
|
# Should this check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
# Minimum server TPS needed for MorePackets to be active
|
# Minimum server TPS needed for MorePackets to be active
|
||||||
minimumTps: 17.5
|
minimumTps: 18.5
|
||||||
# Maximum amount of lag compensation a player can acquire (50ms = 1 tick)
|
# Maximum amount of lag compensation a player can acquire (50ms = 1 tick)
|
||||||
minimumClamp: 500
|
minimumClamp: 1250
|
||||||
# The amount of milliseconds offset between packets before flagging (50ms = 1 tick)
|
# The amount of milliseconds offset between packets before flagging (50ms = 1 tick)
|
||||||
triggerBalance: 100
|
triggerBalance: 250
|
||||||
# The amount of milliseconds to compensate for a teleport (50ms = 1 tick)
|
# The amount of milliseconds to compensate for a teleport (50ms = 1 tick)
|
||||||
teleportCompensation: 150
|
teleportCompensation: 500
|
||||||
# Should MorePackets be disabled for 'lagging' players?
|
# Should this check be disabled for 'lagging' players?
|
||||||
# This can easily be spoofed by clients!
|
# This can easily be spoofed by clients!
|
||||||
disableForLagging: false
|
disableForLagging: false
|
||||||
# Maximum ping value before MorePackets stops checking a player (-1 to disable)
|
# Maximum ping value before MorePackets stops checking a player (-1 to disable)
|
||||||
# This can easily be spoofed by clients!
|
# This can easily be spoofed by clients!
|
||||||
maxPing: -1
|
maxPing: -1
|
||||||
|
|
||||||
# Sneak check settings
|
# Sneak check settings
|
||||||
# Checks if the player toggles sneak too fast
|
# Checks if the player toggles sneak too fast
|
||||||
sneak:
|
sneak:
|
||||||
# Should this check be enabled?
|
# Should this check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
# Should MorePackets be disabled for 'lagging' players?
|
# Should this check be disabled for 'lagging' players?
|
||||||
# This can easily be spoofed by clients!
|
# This can easily be spoofed by clients!
|
||||||
disableForLagging: false
|
disableForLagging: false
|
||||||
# Minimum server TPS needed for sneak
|
# Minimum server TPS needed for sneak
|
||||||
minimumTps: 12
|
minimumTps: 15
|
||||||
# Minimum time in milliseconds between sneak toggles
|
# Minimum time in milliseconds between sneak toggles
|
||||||
minToggleTime: 75
|
minToggleTime: 75
|
||||||
|
# NoSlow check settings
|
||||||
|
# Checks if the player moves too fast while blocking
|
||||||
|
noslow:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Minimum time difference in milliseconds between toggling use item state
|
||||||
|
minimumDifference: 75
|
||||||
|
# Minimum movement distance needed to flag
|
||||||
|
minimumDistXZ: 0.15
|
||||||
|
# Amount of no slowdown moments before flagging
|
||||||
|
vlBeforeFlag: 3
|
||||||
# Spider check settings
|
# Spider check settings
|
||||||
# Checks if the player tries to climb a non-climbable block
|
# Checks if the player tries to climb a non-climbable block
|
||||||
spider:
|
spider:
|
||||||
# Should this check be enabled?
|
# Should this check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
# NoFall check settings
|
# NoFall check settings
|
||||||
# Checks if the player tries to ignore fall damage
|
# Checks if the player tries to ignore fall damage
|
||||||
nofall:
|
nofall:
|
||||||
@@ -294,7 +347,6 @@ nofall:
|
|||||||
enabled: true
|
enabled: true
|
||||||
# Amount of moves with a modified fall distance before flagging
|
# Amount of moves with a modified fall distance before flagging
|
||||||
vlBeforeFlag: 6
|
vlBeforeFlag: 6
|
||||||
|
|
||||||
# Sprint check settings
|
# Sprint check settings
|
||||||
# Checks if the player tries to sprint without the needed conditions
|
# Checks if the player tries to sprint without the needed conditions
|
||||||
sprint:
|
sprint:
|
||||||
@@ -302,7 +354,6 @@ sprint:
|
|||||||
enabled: true
|
enabled: true
|
||||||
# Minimum food level needed to sprint
|
# Minimum food level needed to sprint
|
||||||
sprintFoodMin: 6
|
sprintFoodMin: 6
|
||||||
|
|
||||||
# FastBow check settings
|
# FastBow check settings
|
||||||
# Checks if the player fires a bow too fast
|
# Checks if the player fires a bow too fast
|
||||||
fastbow:
|
fastbow:
|
||||||
@@ -310,7 +361,6 @@ fastbow:
|
|||||||
enabled: true
|
enabled: true
|
||||||
# Maximum percent error between predicted bow force and actual bow force
|
# Maximum percent error between predicted bow force and actual bow force
|
||||||
bowError: 0.25
|
bowError: 0.25
|
||||||
|
|
||||||
# FastEat check settings
|
# FastEat check settings
|
||||||
# Checks if the player consumes food too fast
|
# Checks if the player consumes food too fast
|
||||||
fasteat:
|
fasteat:
|
||||||
@@ -318,7 +368,6 @@ fasteat:
|
|||||||
enabled: true
|
enabled: true
|
||||||
# Minimum time in milliseconds it takes to consume food
|
# Minimum time in milliseconds it takes to consume food
|
||||||
eatTimeMin: 1000
|
eatTimeMin: 1000
|
||||||
|
|
||||||
# FastHeal check settings
|
# FastHeal check settings
|
||||||
# Checks if the player regains health too fast
|
# Checks if the player regains health too fast
|
||||||
fastheal:
|
fastheal:
|
||||||
@@ -330,10 +379,10 @@ fastheal:
|
|||||||
# This can easily be spoofed by clients!
|
# This can easily be spoofed by clients!
|
||||||
disableForLagging: false
|
disableForLagging: false
|
||||||
# The minimum time it takes to regenerate health in milliseconds
|
# The minimum time it takes to regenerate health in milliseconds
|
||||||
minHealTime: 495
|
# Vanilla is 500, but enforcing this will cause too many false positives
|
||||||
|
minHealTime: 475
|
||||||
# Amount of milliseconds a player can heal faster per millisecond of ping
|
# Amount of milliseconds a player can heal faster per millisecond of ping
|
||||||
pingCompensation: 0.15
|
pingCompensation: 0.25
|
||||||
|
|
||||||
# FastProjectile check settings
|
# FastProjectile check settings
|
||||||
# Checks if the player fires a projectile too fast
|
# Checks if the player fires a projectile too fast
|
||||||
fastprojectile:
|
fastprojectile:
|
||||||
@@ -343,7 +392,13 @@ fastprojectile:
|
|||||||
projectilesToWait: 10
|
projectilesToWait: 10
|
||||||
# The minimum time in milliseconds it should have taken for the player fire 'projectilesToWait' projectiles
|
# The minimum time in milliseconds it should have taken for the player fire 'projectilesToWait' projectiles
|
||||||
minimumTime: 1500
|
minimumTime: 1500
|
||||||
|
# FastBreak check settings
|
||||||
|
# Checks if the player breaks too many blocks in too little time
|
||||||
|
fastbreak:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Minimum server TPS needed for FastBreak to be active
|
||||||
|
minimumTps: 15.0
|
||||||
# ItemSpam check settings
|
# ItemSpam check settings
|
||||||
# Checks if the player drops items too fast
|
# Checks if the player drops items too fast
|
||||||
itemspam:
|
itemspam:
|
||||||
@@ -352,8 +407,7 @@ itemspam:
|
|||||||
# The number of item drops we should wait before checking if the player has used item spam
|
# The number of item drops we should wait before checking if the player has used item spam
|
||||||
dropsToWait: 10
|
dropsToWait: 10
|
||||||
# The minimum time in milliseconds it should have taken for the player to drop items 'dropsToWait' times
|
# The minimum time in milliseconds it should have taken for the player to drop items 'dropsToWait' times
|
||||||
minimumTime: 800
|
minimumTime: 300
|
||||||
|
|
||||||
# FastInventory check settings
|
# FastInventory check settings
|
||||||
# Checks if the player moves items in the inventory too fast
|
# Checks if the player moves items in the inventory too fast
|
||||||
fastinventory:
|
fastinventory:
|
||||||
@@ -363,19 +417,16 @@ fastinventory:
|
|||||||
clicksToWait: 10
|
clicksToWait: 10
|
||||||
# The minimum time in milliseconds it should have taken for the player to click 'clicksToWait' times
|
# The minimum time in milliseconds it should have taken for the player to click 'clicksToWait' times
|
||||||
minimumTime: 50
|
minimumTime: 50
|
||||||
|
|
||||||
# vClip check settings
|
# vClip check settings
|
||||||
# Checks if the player is clipping
|
# Checks if the player is clipping
|
||||||
vclip:
|
vclip:
|
||||||
# Should this check be enabled?
|
# Should this check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
# ChatUnicode check settings
|
# ChatUnicode check settings
|
||||||
# Checks for illegal unicode characters in the chat
|
# Checks for illegal unicode characters in the chat
|
||||||
chatunicode:
|
chatunicode:
|
||||||
# Should this check be enabled?
|
# Should this check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
# ChatSpam check settings
|
# ChatSpam check settings
|
||||||
# Checks for a spam of chat messages
|
# Checks for a spam of chat messages
|
||||||
chatspam:
|
chatspam:
|
||||||
@@ -389,17 +440,16 @@ chatspam:
|
|||||||
levelActionOne: 5
|
levelActionOne: 5
|
||||||
# Number of chat spam violations before action two (see config.yml) is executed
|
# Number of chat spam violations before action two (see config.yml) is executed
|
||||||
levelActionTwo: 10
|
levelActionTwo: 10
|
||||||
|
|
||||||
# CommandSpam check settings
|
# CommandSpam check settings
|
||||||
# Checks for a spam of commands
|
# Checks for a spam of commands
|
||||||
commandspam:
|
commandspam:
|
||||||
# Should this check be enabled?
|
# Should this check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
# Minimum time between commands
|
# Minimum time between commands
|
||||||
timeMin: 400
|
timeMin: 250
|
||||||
# Time in milliseconds after which repeating a command is ignored
|
# Time in milliseconds after which repeating a command is ignored
|
||||||
repeatIgnore: 500
|
repeatIgnore: 500
|
||||||
# Number of command spam violations before action one (see config.yml) is executed
|
# Number of command spam violations before action one (see config.yml) is executed
|
||||||
levelActionOne: 5
|
levelActionOne: 5
|
||||||
# Number of command spam violations before action two (see config.yml) is executed
|
# Number of command spam violations before action two (see config.yml) is executed
|
||||||
levelActionTwo: 10
|
levelActionTwo: 10
|
||||||
@@ -24,6 +24,8 @@ system:
|
|||||||
# If silent mode is on, players will not be stopped when they try to hack, and AntiCheatReloaded will do everything possible to keep them unaware of their rising hack level.
|
# If silent mode is on, players will not be stopped when they try to hack, and AntiCheatReloaded will do everything possible to keep them unaware of their rising hack level.
|
||||||
# However, alerts will still be sent to console and to admins online, and events will still take place.
|
# However, alerts will still be sent to console and to admins online, and events will still take place.
|
||||||
silent-mode: false
|
silent-mode: false
|
||||||
|
# Disable broadcasts about why a player was kicked
|
||||||
|
disable-broadcast: false
|
||||||
# Should ops be exempt from all checks?
|
# Should ops be exempt from all checks?
|
||||||
exempt-op: false
|
exempt-op: false
|
||||||
# Should AntiCheatReloaded track plugins in its own registered events?
|
# Should AntiCheatReloaded track plugins in its own registered events?
|
||||||
@@ -35,10 +37,14 @@ system:
|
|||||||
# Do NOT enable this in a production environment!
|
# Do NOT enable this in a production environment!
|
||||||
debug-mode: false
|
debug-mode: false
|
||||||
# To prevent spamming, staff and the console will only be notified every x violations
|
# To prevent spamming, staff and the console will only be notified every x violations
|
||||||
# Minimum value is 1, default is 10
|
# Minimum value is 1, default is 8
|
||||||
# Example with 5: notifications after 5 vl, 10vl, 15vl, etc.
|
# Example with 5: notifications after 5 vl, 10vl, 15vl, etc.
|
||||||
notify-every-vl: 10
|
notify-every-vl: 8
|
||||||
# Use /AntiCheatReloaded checks for a list of valid checks
|
# Maximum distance a player can be set back
|
||||||
|
# If the last known valid location is further away than this,
|
||||||
|
# the player will be rubberbanded at their current location
|
||||||
|
# Minimum value is 5, default is 50
|
||||||
|
max-setback-distance: 50
|
||||||
disable-in:
|
disable-in:
|
||||||
- example-world
|
- example-world
|
||||||
- example-world-2
|
- example-world-2
|
||||||
@@ -3,6 +3,6 @@
|
|||||||
# To disable warnings or kicking, change WARN and/or KICK to NONE
|
# To disable warnings or kicking, change WARN and/or KICK to NONE
|
||||||
groups:
|
groups:
|
||||||
- 'Low : 50 : GREEN : NONE'
|
- 'Low : 50 : GREEN : NONE'
|
||||||
- 'Medium : 100 : YELLOW : WARN'
|
- 'Medium : 60 : YELLOW : WARN'
|
||||||
- 'High : 175 : RED : KICK'
|
- 'High : 75 : RED : KICK'
|
||||||
- 'Custom : -1 : GREEN : COMMAND[ban %player%;]'
|
- 'Custom : -1 : GREEN : COMMAND[ban %player%;]'
|
||||||
+28
-10
@@ -1,17 +1,35 @@
|
|||||||
# AntiCheatReloaded language file
|
# AntiCheatReloaded language file
|
||||||
|
# The alert message when a player enters a higher group
|
||||||
ALERT:
|
ALERT:
|
||||||
- '&c%player% has just entered the %group% hack group.'
|
- '&6&lACR &8> &7%player% has just entered the %group% hack group.'
|
||||||
- '&c%player%''s last failed check was: %check%.'
|
- '&6&lACR &8> &7%player%''s last failed check was: %check%.'
|
||||||
- '&cType ''/acr report %player%'' for more information.'
|
- '&6&lACR &8> &7Type ''/acr report %player%'' for more information.'
|
||||||
|
# The warning a player receives when reaching a certain level
|
||||||
|
# Only sent when enabled in groups.yml
|
||||||
WARNING:
|
WARNING:
|
||||||
- '&6&lACR &8>&7 You have been flagged for using cheats.'
|
- '&6&lACR &8>&7 You have been flagged for using cheats.'
|
||||||
- '&6&lACR &8>&7 If you continue to cheat, action will be taken.'
|
- '&6&lACR &8>&7 If you continue to cheat, action will be taken.'
|
||||||
BAN_REASON: '&6&lACR &8> &7Banned by AntiCheatReloaded'
|
# Ban message
|
||||||
|
BAN_REASON: '&6&lACR &8> &7Banned for unfair advantage'
|
||||||
|
# Message to broadcast when banned
|
||||||
|
# Only sent when enabled in config.yml
|
||||||
BAN_BROADCAST: '&6&lACR &8> &7%player% was banned for cheating'
|
BAN_BROADCAST: '&6&lACR &8> &7%player% was banned for cheating'
|
||||||
KICK_REASON: '&6&lACR &8> &7Kicked for cheating'
|
# Kick message
|
||||||
|
KICK_REASON: '&6&lACR &8> &7Kicked for unfair advantage'
|
||||||
|
# Message to broadcast when kicked
|
||||||
|
# Only sent when enabled in config.yml
|
||||||
KICK_BROADCAST: '&6&lACR &8> &7%player% was kicked for cheating'
|
KICK_BROADCAST: '&6&lACR &8> &7%player% was kicked for cheating'
|
||||||
SPAM_WARNING: '&cStop spamming the server or you will be kicked!'
|
# The warning message to send when a player is spamming
|
||||||
SPAM_KICK_REASON: '&cKicked for spamming'
|
SPAM_WARNING: '&6&lACR &8> &7Stop spamming the server or you will be kicked!'
|
||||||
SPAM_KICK_BROADCAST: '&c%player% was kicked for spamming'
|
# Kick reason when spamming
|
||||||
SPAM_BAN_REASON: '&cBanned for spamming'
|
SPAM_KICK_REASON: '&6&lACR &8> &7Kicked for spamming'
|
||||||
SPAM_BAN_BROADCAST: '&c%player% was banned for spamming'
|
# Message to broadcast when kicked for spamming
|
||||||
|
# Only sent when enabled in config.yml
|
||||||
|
SPAM_KICK_BROADCAST: '&6&lACR &8> &7%player% was kicked for spamming'
|
||||||
|
# Ban reason when spamming
|
||||||
|
SPAM_BAN_REASON: '&6&lACR &8> &7Banned for spamming'
|
||||||
|
# Message to broadcast when banned for spamming
|
||||||
|
# Only sent when enabled in config.yml
|
||||||
|
SPAM_BAN_BROADCAST: '&c%player% was banned for spamming'
|
||||||
|
# The prefix for staff and debug alerts
|
||||||
|
ALERT_PREFIX: "&6&lACR &8> &7"
|
||||||
@@ -1,36 +1,15 @@
|
|||||||
# Time to exempt a player from moving because of entering/exiting a vehicle
|
# Time to exempt a player from moving because of entering/exiting a vehicle
|
||||||
# Increase in case of false positives
|
# Increase in case of false positives
|
||||||
ENTERED_EXITED_TIME: 1000
|
ENTERED_EXITED_TIME: 2500
|
||||||
# Time to exempt a player from moving because of teleporting
|
# Time to exempt a player from moving because of teleporting
|
||||||
# Increase in case of false positives
|
# Increase in case of false positives
|
||||||
TELEPORT_TIME: 1000
|
TELEPORT_TIME: 1500
|
||||||
# Time to exempt a player from moving because of exiting fly mode
|
|
||||||
# Changing this value is almost never required
|
|
||||||
EXIT_FLY_TIME: 2000
|
|
||||||
# Time to exempt a player from moving because of joining the server
|
# Time to exempt a player from moving because of joining the server
|
||||||
# If your server is slow when a player joins, increasing this value is important
|
# If your server is slow when a player joins, increasing this value is important
|
||||||
# Shouldn't be lower than 1500 or higher than 5000
|
# Shouldn't be lower than 1500 or higher than 5000
|
||||||
JOIN_TIME: 2000
|
JOIN_TIME: 2000
|
||||||
# Time to exempt a player from moving because of taking damage
|
|
||||||
# Can be decreased very slightly to increase detection
|
|
||||||
# Increasing in case of false positives is almost never necessary and is not advised
|
|
||||||
DAMAGE_TIME: 3000
|
|
||||||
# Time to exempt a player from moving because of taking damage with knockback effects
|
|
||||||
# Can be decreased very slightly to increase detection
|
|
||||||
# Increase in case of false positives, but shouldn't be necessary
|
|
||||||
KNOCKBACK_DAMAGE_TIME: 4000
|
|
||||||
# Time to exempt a player from moving because of taking damage from an explosion
|
|
||||||
# Can be decreased very slightly to increase detection
|
|
||||||
# Increasing in case of false positives is almost never necessary and is not advised
|
|
||||||
EXPLOSION_DAMAGE_TIME: 5000
|
|
||||||
# Amount of seconds to extend a players velocitized state after receiving velocity again
|
|
||||||
VELOCITY_EXTENSION: 2
|
|
||||||
# Time a player is considered to have a change in velocity
|
# Time a player is considered to have a change in velocity
|
||||||
VELOCITY_TIME: 2000
|
VELOCITY_TIME: 1500
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
VELOCITY_PREVENT: 5000
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
VELOCITY_MAXTIMES: 2
|
|
||||||
# Minimum travel distance for move to be considered a teleport and subsequently be ignored
|
# Minimum travel distance for move to be considered a teleport and subsequently be ignored
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||||
TELEPORT_MIN: 400
|
TELEPORT_MIN: 400
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
name: AntiCheatReloaded
|
name: AntiCheatReloaded
|
||||||
author: Rammelkast
|
author: Rammelkast
|
||||||
description: AntiCheatReloaded helps easily identify and block malicious users on your server.
|
description: AntiCheatReloaded helps easily identify and block malicious players on your server.
|
||||||
main: com.rammelkast.anticheatreloaded.AntiCheatReloaded
|
main: com.rammelkast.anticheatreloaded.AntiCheatReloaded
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
depend: [ProtocolLib]
|
depend: [ProtocolLib]
|
||||||
|
softdepend: [Floodgate, floodgate]
|
||||||
startup: postworld
|
startup: postworld
|
||||||
version: ${project.build.version}
|
version: ${project.build.version}
|
||||||
commands:
|
commands:
|
||||||
@@ -127,6 +128,15 @@ permissions:
|
|||||||
anticheat.check.aimbot:
|
anticheat.check.aimbot:
|
||||||
description: Allow players to use aimbot
|
description: Allow players to use aimbot
|
||||||
default: false
|
default: false
|
||||||
|
anticheat.check.strafe:
|
||||||
|
description: Allow players to use strafe hacks
|
||||||
|
default: false
|
||||||
|
anticheat.check.noslow:
|
||||||
|
description: Allow players to use NoSlow hacks
|
||||||
|
default: false
|
||||||
|
anticheat.check.boatfly:
|
||||||
|
description: Allow players to use boat fly hacks
|
||||||
|
default: false
|
||||||
anticheat.check.exempt:
|
anticheat.check.exempt:
|
||||||
description: Total exemption from checks
|
description: Total exemption from checks
|
||||||
default: false
|
default: false
|
||||||
@@ -157,4 +167,7 @@ permissions:
|
|||||||
anticheat.check.unicode: true
|
anticheat.check.unicode: true
|
||||||
anticheat.check.illegalinteract: true
|
anticheat.check.illegalinteract: true
|
||||||
anticheat.check.fastladder: true
|
anticheat.check.fastladder: true
|
||||||
anticheat.check.aimbot: true
|
anticheat.check.aimbot: true
|
||||||
|
anticheat.check.strafe: true
|
||||||
|
anticheat.check.noslow: true
|
||||||
|
anticheat.check.boatfly: true
|
||||||
Reference in new issue
Block a user