Compare commits

..
39 Commits
Author SHA1 Message Date
RayzsYT 53b1949bd8 Add multiple triggers per stack 2024-11-03 04:31:28 +01:00
RayzsYT cca27ebc8c Enabled Folia support 2024-11-03 03:39:45 +01:00
RayzsYT 670f2003fc Added multiple customizable response messages 2024-11-03 03:36:00 +01:00
RayzsYT b65e4a0271 Removed unused variable 2024-11-03 03:17:05 +01:00
RayzsYT d3eae2512a Changed plugin description 2024-11-03 03:16:13 +01:00
RayzsYT 2d32d09c1b Changed plugin description 2024-11-03 03:16:00 +01:00
RayzsYT 95f2436459 Imports cleanup 2024-11-03 03:14:53 +01:00
RayzsYT fbf4a553ce Remove debug messages 2024-11-03 03:09:17 +01:00
RayzsYT 032fb229cf Add Debug Messages 2024-10-24 22:59:01 +02:00
RayzsYT 4e4bcdf2b1 Removed debug message 2024-10-20 03:33:00 +02:00
RayzsYT b31653c30f Improved Subcommand functions 2024-10-20 03:30:56 +02:00
RayzsYT 2abfa75987 Improved Subcommand functions 2024-10-20 02:48:04 +02:00
RayzsYT 6c0188e38f Improved Subcommand functions & added %online_players% placeholder 2024-10-20 00:14:29 +02:00
RayzsYT 8091ebbea4 Updated PAT API version 2024-10-19 21:06:25 +02:00
RayzsYT 92c84ff2ea Add ServerPlayersChange event 2024-10-19 21:06:07 +02:00
RayzsYT 2408bf2267 Add PlayerNames methods 2024-10-19 21:05:51 +02:00
RayzsYT fe1e7338cf Added getPlayerNames method 2024-10-19 19:37:43 +02:00
RayzsYT efeb5c5d2e Improve 2024-09-29 17:17:39 +02:00
RayzsYT 85ea7d8672 Change 2024-09-29 15:37:51 +02:00
RayzsYT ca2f139542 Add Method 2024-09-29 14:45:59 +02:00
RayzsYT c1744cd4c9 Shorten Code 2024-09-29 02:03:28 +02:00
RayzsYT 1ba61f2cf9 Improve 2024-09-29 02:01:44 +02:00
RayzsYT c3c5dcf473 Merge remote-tracking branch 'origin/addons' into addons 2024-09-04 18:25:03 +02:00
RayzsYT 268ccd5938 Experimental 2024-09-04 18:24:38 +02:00
Alihan 81f58966b0 Delete subarguments/target/classes/de/rayzs/pat/addon directory 2024-08-23 13:53:48 +02:00
RayzsYT 739527af74 Improve Check 2024-08-23 13:25:58 +02:00
RayzsYT 918da7f49e Minor Improvements 2024-08-23 04:23:41 +02:00
RayzsYT 3b786a71fd Minor Improvements 2024-08-23 03:50:14 +02:00
RayzsYT 3ca164e320 Minor Change 2024-08-23 03:44:11 +02:00
RayzsYT d417ee4132 Minor Improvement 2024-08-23 03:34:20 +02:00
RayzsYT d30c40a7c3 Improve Code Structure 2024-08-23 03:18:06 +02:00
RayzsYT 596476c7a8 Sort Code 2024-08-23 03:08:13 +02:00
RayzsYT d236baae0d Improve 2024-08-23 02:12:01 +02:00
RayzsYT 812146a669 Improve 2024-08-23 01:54:21 +02:00
RayzsYT 314c5237a1 Init 2024-08-23 01:06:20 +02:00
Alihan bc8b03a8bc Delete subarguments/target directory 2024-08-22 21:04:25 +02:00
Alihan 1500c5e93c init 2024-08-22 20:52:33 +02:00
Alihan 08685ff098 Delete pom.xml 2024-08-22 20:48:10 +02:00
Alihan 057e3826e8 Delete src/main directory 2024-08-22 20:47:32 +02:00
257 changed files with 585 additions and 24894 deletions

No files matched your search

-42
View File
@@ -1,42 +0,0 @@
# Compiled class file
*.class
bin/
target/
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# eclipse
.settings
.classpath
.project
# intellij
.idea/
# other
*.iml
run/
# Gradle
.gradle/
build/
!gradle/wrapper/gradle-wrapper.jar
+17 -335
View File
@@ -1,339 +1,21 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
MIT License
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Copyright (c) 2024 Alihan
Preamble
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
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
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the 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 a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE 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.
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
convey 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 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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision 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, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This 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.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+6 -562
View File
@@ -1,564 +1,8 @@
# **A**BOUT
ProAntiTab is an advanced **plugin hider** with **many features** and a very simple to understand system. It prevents your server from **plugin spoofers** used by hack clients, manipulates the **tab-completion**, blocks unwanted **suggestions** and much more!
#####
# ProAntiTab
# **I**N ACTION
![https://www.rayzs.de/proantitab/assets/beforeafter5.png](https://www.rayzs.de/proantitab/assets/beforeafter5.png)
### About
ProAntiTab is a Spigot/Bungeecord Minecraft plugin that helps you to hide unwanted commands from your players.
######
# **C**USTOM SERVER BRAND (F3)
Create your own animated custom server brand on your Spigot, Bungeecord and Velocity server!
*![https://www.rayzs.de/proantitab/assets/csbr.gif](https://www.rayzs.de/proantitab/assets/csbr.gif)![https://www.rayzs.de/proantitab/assets/edc.gif](https://www.rayzs.de/proantitab/assets/edc.gif)*
<details>
<summary>open config.yml section</summary>
```yaml
# This feature allows you to customize your server-brand you see when you press F3.
# Normally there stands something like 'Purpur', or 'Spigot'.
# With this feature you are able to change and even animate it! ^^
custom-server-brand:
enabled: false
# Determines the speed in that the animation goes
repeat-delay: 3
# This here is the list of the animation
# Possible placeholders:
# %player% - name of the player
# %displayname% - displayname of the player
# %world% - name of world where the player is
# and the other placeholders from PlaceholderAPI
brands:
- '&f&lP&froAntiTab |'
- '&fP&lr&foAntiTab /'
- '&fPr&lo&fAntiTab -'
- '&fPro&lA&fntiTab |'
- '&fProA&ln&ftiTab \'
- '&fProAn&lt&fiTab |'
- '&fProAnt&li&fTab /'
- '&fProAnti&lT&fab -'
- '&fProAnti&lT&fab \'
- '&fProAntiT&la&fb |'
- '&fProAntiTa&lb&f /'
- '&fProAntiTab -'
- '&fProAntiTab \'
```
</details>
######
# **U**SE BLACKLIST AS WHITELIST
You have way too many commands to block? Don't worry.
There's a section in the config.yml located pretty much high that allows you to turn the blacklist into a whitelist instead. This will block every command on your server except for those that are listed.
<details>
<summary>section in config.yml</summary>
```yaml
# This is a very necessary feature if you have way too many commands to block and instead decide
# to whitelist specific commands.
# Enabling this will disable ALL commands except for those that are in the (group-)list.
turn-blacklist-to-whitelist: false
```
</details>
######
# **A**NTI PLUGIN SPOOFING
##### ProAntiTab is able to detect and block plugin spoofing attempts used by hack clients.
*![https://www.rayzs.de/proantitab/assets/noplspoof.png](https://www.rayzs.de/proantitab/assets/noplspoof.png)*
######
# **B**LOCK SUB ARGUMENTS
We all know the problem when players should be able to use some of the commands but should not see literally EVERY sub-argument in a command. Well, then just blend them out? ProAntiTab can do this for you and it's very easy to setup as well! (See some examples below)
![https://www.rayzs.de/proantitab/assets/subargs.png](https://www.rayzs.de/proantitab/assets/subargs.png)
<details>
<summary>example</summary>
```yaml
# Let's say you just want to allow "/help Minecraft" only and not "/help apple".
# It will also automatically allow everything after "/help Minecraft ..."
- help Minecraft
# [CMD] = Allow the execution of the command
# [TAB] = Allow the tab-completion of the command
- "[CMD]cmi tpa" # Only executable. Not tab-completable
- tpa # Executable & Tab-Completable
# %hidden_online_players% = Online players (Removed from tab-completion)
# %online_players% = Online players
# %hidden_players% = Registered players (Removed from tab-completion)
# %players% = Registered players
# %numbers% = Numbers, such as 1000 or 1.000
# _- = Block everything after
- "tpa %online_players%"
- "sell %numbers%"
# Using the operator _- at the end cancels every argument afterwards and blocks it.
# This will allow the player to use "/help Minecraft" but not "/help Minecraft xyz"
- help Minecraft _-
```
</details>
######
# **B**LOCK COLLON COMMANDS
It's annyoing after some time to block all commands including collons like essentials:spawn. With this option you can disable them entirely for good! Only people with the proantitab.namespace permission can see these commands again.
![https://www.rayzs.de/proantitab/assets/namespace.png](https://www.rayzs.de/proantitab/assets/namespace.png)
<details>
<summary>open config.yml section</summary>
```yaml
#>> HTP (Overwritten)
# Here you can disable all namespace commands.
# Namespace commands are commands like plugin:command (e.g: essentials:warp)
# You can bypass this restriction with the proantitab.namespace permission.
block-namespace-commands:
enabled: false
```
</details>
######
# **C**USTOM PLUGINS LIST
Just blocking the /plugins command is pretty boring. This feature here allows you to make it more interesting by displaying for example fake plugins.
![https://www.rayzs.de/proantitab/assets/fakeplugins2.PNG](https://www.rayzs.de/proantitab/assets/fakeplugins2.PNG)
<details>
<summary>open config.yml section</summary>
```yaml
#>> HTP (Overwritten)
# Here you can customize your own fake '/plugins' command.
custom-plugins:
enabled: true
commands:
- pl
- plugins
- bukkit:pl
- bukkit:plugins
message:
- '&fPlugins (0):'
```
</details>
######
# **C**USTOM VERSION COMMAND
Who wouldn't like to pretend to own a custom server-jar? Have fun customizing your very own /version command to your personal liking.
![https://www.rayzs.de/proantitab/assets/custom-version.png](https://www.rayzs.de/proantitab/assets/custom-version.png)
<details>
<summary>open config.yml section</summary>
```yaml
#>> HTP (Overwritten)
# Here you can customize your own fake '/version' command.
custom-version:
enabled: true
commands:
- version
- ver
- icanhasbukkit
- bukkit:ver
- bukkit:version
message:
- '&fThis server is running CraftBukkit version git-NasaSpigot-294 (MC: X)'
```
</details>
######
# **C**USTOM UNKNOWN COMMAND MESSAGE
The Bukkit/Spigot version of ProAntiTab gives your the possibility to create your own unknown-command message to align it with the blocked-command message for example.
![https://www.rayzs.de/proantitab/assets/customunknowncommand.PNG](https://www.rayzs.de/proantitab/assets/customunknowncommand.PNG)
<details>
<summary>open config.yml section</summary>
```yaml
# Now there we come to the good stuff! ^^
# If ProAntiTab is loaded on a Spigot server, you will see this option right here.
# With that you can also customize your own "Unknown Command"-message.
custom-unknown-command:
enabled: true
message:
- '&cThis command does not exist!'
```
</details>
######
# **C**USTOM PROTOCOL PING
Do you know the red text message at the players count when you ping a server with the wrong version? Exactly this holds the information of what kind of server your proxy server is running at. This feature hides the version of the proxy with a custom made one. It's enabled by default but doesn't show the text. The text can be seen when someone pings the server with the wrong version or uses a resolver. This picture shows you what someone with the wrong version would see, unless the "always-show" is enabled. If this option is enabled, this text will always appear.
![https://www.rayzs.de/proantitab/assets/custom-protol-ping.png](https://www.rayzs.de/proantitab/assets/custom-protol-ping.png) <details>
<summary>open config.yml section</summary>
```yaml
# Change the protocol for the version name when the server is being pinged
# (!) Warning: It's required to use Paper or Purpur to use this feature!
# (!) Supported server versions: 1.12.2 - latest
custom-protocol-ping:
enabled: false
# Normally it would only display when someone pings the server with the wrong version.
# Enabling this will always display the protocol and replace it with the normal player count.
always-show: false
# This number here determines the outcome for the %online_extended% placeholder.
# It's the current amount of players increased by this number.
# For example: 5/20 becomes 6/20
extend-online-count: 1
# true: Use new calculated online-count (%online_extended%) as max-players count.
# false: Use the default max-players count.
use-as-maxplayers: false
# Enabling this option hides the list of players on your server,
# when you hover over the player count.
hide-players: true
# The displayed protocol message
# Available placeholders:
# %online% - current online player count
# %online_extended% - manipulated online player count
# %max% - max player count
protocol: '&f&lProAntiTab &7(&a%online%&7/&c%max%&7)'
```
</details>
######
# **C**USTOM RESPONSE ACTIONS
For some, it's important to determine how the response message should be or what should happen. You can customize that factor to your personal liking and use different actions to have full control over your blocked commands.
![https://www.rayzs.de/proantitab/assets/custom-response-title-smaller-2.png](https://www.rayzs.de/proantitab/assets/custom-response-title-smaller-2.png)
![https://www.rayzs.de/proantitab/assets/custom-response-down-smaller-3.png](https://www.rayzs.de/proantitab/assets/custom-response-down-smaller-3.png)
<details>
<summary>Bukkit/Spigot examples</summary>
```yaml
# ____ ___ __ _ ______ __
# / __ \_________ / | ____ / /_(_)_ __/___ _/ /_
# / /_/ / ___/ __ \/ /| | / __ \/ __/ / / / / __ `/ __ \
# / ____/ / / /_/ / ___ |/ / / / /_/ / / / / /_/ / /_/ /
# /_/ /_/ \____/_/ |_/_/ /_/\__/_/ /_/ \__,_/_.___/
# custom-responses.yml
#
# Here you can configure a few of the blocked commands a bit further.
# But what exactly is this here? Every command that would normally respond with the typical "command is blocked" message, can be configured in here!
# And how does it work? It's simple. You just provide the a trigger of the command that would be normally blocked.
# Commands that would normally work won't send the messages you have set here.
# This way PAT can offer you full control over certain commands and their normal responses.
# What are these action section at each block?
# This is an additional feature to make your responses much more alive.
# Example actions that can be used are the following:
# Execute console command:
# Syntax: console::command
# Example: console::say %player% is an evil player
# Execute player command:
# Syntax: execute::command
# Example: execute::help
# Send actionbar:
# Syntax: actionbar::text
# Example: actionbar::&cThis is not cool %player%!
# Send title:
# Syntax: title::title::subtitle::5::20::5
# Example: title::&aTest title::&cHello %player%!
# Play sound:
# Syntax: sound::soundName::volume::pitch
# Example: sound::ENTITY_ENDER_DRAGON_GROWL::1.0::1.0
# Give potion effect:
# Syntax: effect::potionEffect::duration::amplifier
# Example: effect::BLINDNESS::45::1
# Here are a few examples:
# Example with kits.
# In here we only trigger the given message, if the player would type "/kit ...".
# If this command would work through sub-arguments, then the player would only able to execute the command with the
# listed sub-arguments assigned to it. Everything else will result with the set message in there.
# --
#example-with-kits:
# triggers:
# - "kit *"
# message:
# - "&cThis kit does not exist!"
# actions:
# - "actionbar::&cSorry %player%, but this kit does not exist!"
# Here another example with an auctionhouse plugin.
# In here we only trigger the given message, if the player would type "/ah plugin".
# Normally it would print out the "command is blocked" message, because PAT would have blocked it in our case.
# Therefore, we can also assign a custom response message to it.
# ---
#example-with-auctionhouse:
# triggers:
# - "ah plugin"
# message:
# - "&cThis sub-command does not exist. Please type: &e/ah help"
# actions:
# - "console::say That's not nice %player%!"
# - "effect::BLINDNESS::45::1"
# - "sound::ENTITY_ENDER_DRAGON_GROWL::1.0::1.0"
# - "title::&cHey!::&cYou can't do that %player%!::5::20::5"
# - "actionbar::&cNop, sorry %player%"
```
</details>
<details>
<summary>Proxy examples</summary>
```yaml
# ____ ___ __ _ ______ __
# / __ \_________ / | ____ / /_(_)_ __/___ _/ /_
# / /_/ / ___/ __ \/ /| | / __ \/ __/ / / / / __ `/ __ \
# / ____/ / / /_/ / ___ |/ / / / /_/ / / / / /_/ / /_/ /
# /_/ /_/ \____/_/ |_/_/ /_/\__/_/ /_/ \__,_/_.___/
# custom-responses.yml
#
# Here you can configure a few of the blocked commands a bit further.
# But what exactly is this here? Every command that would normally respond with the typical "command is blocked" message, can be configured in here!
# And how does it work? It's simple. You just provide the a trigger of the command that would be normally blocked.
# Commands that would normally work won't send the messages you have set here.
# This way PAT can offer you full control over certain commands and their normal responses.
# What are these action section at each block?
# This is an additional feature to make your responses much more alive.
# Example actions that can be used are the following:
# Execute console command:
# Syntax: console::command
# Example: console::send %player% fallback
# Execute player command:
# Syntax: execute::command
# Example: execute::help
# Send actionbar:
# Syntax: actionbar::text
# Example: actionbar::&cThis is not cool %player%!
# Send title:
# Syntax: title::title::subtitle::5::20::5
# Example: title::&aTest title::&cHello %player%!
# Here are a few examples:
# Example with kits.
# In here we only trigger the given message, if the player would type "/kit ...".
# If this command would work through sub-arguments, then the player would only able to execute the command with the
# listed sub-arguments assigned to it. Everything else will result with the set message in there.
# --
#example-with-kits:
# triggers:
# - "kit *"
# message:
# - "&cThis kit does not exist!"
# actions:
# - "actionbar::&cSorry %player%, but this kit does not exist!"
# Here another example with an auctionhouse plugin.
# In here we only trigger the given message, if the player would type "/ah plugin".
# Normally it would print out the "command is blocked" message, because PAT would have blocked it in our case.
# Therefore, we can also assign a custom response message to it.
# ---
#example-with-auctionhouse:
# triggers:
# - "ah plugin"
# message:
# - "&cThis sub-command does not exist. Please type: &e/ah help"
# actions:
# - "console::say That's not nice %player%!"
# - "title::Hey!::You can't do that %player%!::30::3000::30"
# - "actionbar::Nop, sorry %player%"
```
</details>
#####
# **N**EGATE COMMANDS
It's not a must to write each and every possible sub-argument by hand. The same goes for commands in general.
You can negate them with the help of the negation operator (``!``).
*![https://www.rayzs.de/proantitab/assets/neg.png](https://www.rayzs.de/proantitab/assets/neg.png)*
<details>
<summary>example</summary>
```yaml
# Allows /gamemode and all of its sub-arguments
# except "/gamemode creative"
- "gamemode"
- "!gamemode creative"
- '!gamemode toggle'
```
```yaml
# Allows all commands, except /anvil
- "*"
- "!anvil"
```
</details>
#####
# **A**UTO-ADD ALL PLUGIN COMMANDS
Sometimes it's so annoying to add all commands from a certain plugin by hand. That's why ProAntiTab offers the possebility to simply add all commands from a certain plugin with a simple shortcut.
You can simply add ``plugin=<plugin-name>`` to add all commands from a plugin automatically.
**Only works for standalone Spigot (+Forks) servers**
<details>
<summary>example</summary>
```yaml
# Allows all Essentials commands except /anvil.
# /gamemode is limited to only two sub-arguments
- "plugin=essentials"
- "!anvil"
- "gamemode creative"
- "gamemode survival"
```
</details>
######
# **B**LOCK ON SPECIFIC SERVERS
If you use ProAntiTab on a network, you can pretty easily manage on what servers what commands should exist. Everything can be handled via the proxy and does not require additional maintenance on the backend servers.
For this, just follow the official [setup](https://github.com/RayzsYT/ProAntiTab/wiki/How-to-setup#proxy--spigot-eg-bungeecord--spigot) and [how-to](https://github.com/RayzsYT/ProAntiTab/wiki/How-to#introduction) guide, which can be both found on the [Github wiki](https://github.com/RayzsYT/ProAntiTab/wiki).
######
# **G**ROUP SYSYTEM
The PAT group system allows you to allow certain commands only for a certain group of people. PAT group commands are mainly for **whitelisting** commands, can merge with other groups, and so on.
They can also be used to blacklist commands by negating the commands inside there. But for this to work, the option `allow-group-overruling` inside the `config.yml` needs to be enabled.
How to use the PAT group system in general can be seen on the [Github wiki](https://github.com/RayzsYT/ProAntiTab/wiki/How-to#use-the-group-system).
######
# **P**LACEHOLDERAPI & PAPIPROXYBRIDGE SUPPORT
Customization and uniqueness is an important factor for many server owners. That's why PAT offers you the possebility to edit and use many of its placeholders with the widely spreaded plugin [PlaceholderAPI](https://www.spigotmc.org/resources/6245/). Accessing those placeholders on the proxy isn't a problem either. With the support of the addtional plugin [PAPIProxyBridge](https://www.spigotmc.org/resources/108415/), PAT's placeholders are even accessable on your proxy server.
<details>
<summary>Available placeholders</summary>
```yaml
# Some general Placeholders to work with:
# %pat_general_user% = Get the name of the user who receives this message.
# %pat_general_version_current% = Get current version name of PAT.
# %pat_general_version_newest% = Get newest version name of PAT.
# Placeholders of some of the messages in the config.yml:
# %pat_message_unknowncommand% = Get the "unknown command"-message from the config.yml of PAT. [cancel-blocked-command]
# %pat_message_blocked% = Get the "command blocked"-message from the config.yml of PAT. [custom-unknown-command]
# Placeholders to list all commands:
# %pat_list_size_commands% = Get the amount of all listed commands.
# %pat_list_commands% = Get all listed commands.
# %pat_list_sorted_commands% = Get all listed commands in alphabetic order. (A-Z)
# %pat_list_reversed_groups% = Get all listed commands in reversed alphabetic order. (Z-A)
# Placeholders to list all commands of a group: (replace 'xxx' with the group-name)
# %pat_list_size_commands_group_xxx% = Get the amount of all commands of a group.
# %pat_list_commands_group_xxx% = Get all commands of a group.
# %pat_list_sorted_commands_group_xxx% = Get all commands of a group in alphabetic order. (A-Z)
# %pat_list_reversed_commands_group_xxx% = Get all commands of a group in reversed alphabetic order. (Z-A)
# Placeholders to list all groups:
# %pat_list_size_groups% = Get the amount of all available groups.
# %pat_list_groups% = Get all groups.
# %pat_list_sorted_groups% = Get all groups in alphabetic order. (A-Z)
# %pat_list_reversed_groups% = Get all groups in reversed alphabetic order. (Z-A)
```
</details>
###
# **M**INIMESSAGE SUPPORT
## ![https://www.rayzs.de/proantitab/assets/possibilites.png](https://www.rayzs.de/proantitab/assets/possibilites.png)
##### You want to design your messages more unique? We got you covered! *(works on 1.17 server and above)*
*([Click here to see the documentation for the format](https://docs.advntr.dev/minimessage/format.html#)*)
Look at those few examples to see what kind of possibilities awaits you:
<details>
<summary>example 1</summary>
```yaml
cancel-blocked-commands:
enabled: true
message: '<hover:show_text:"&cBlocked command: &4&o%command%">&cThis command is &4&lBLOCKED&c!'
```
![https://www.rayzs.de/proantitab/assets/example1.png](https://www.rayzs.de/proantitab/assets/example1.png)
</details>
<details>
<summary>example 2</summary>
```yaml
cancel-blocked-commands:
enabled: true
message: '&cThis command is blocked! <click:suggest_command:/help>&7Click here to get a view of all available commands instead.'
```
![https://www.rayzs.de/proantitab/assets/example2.png](https://www.rayzs.de/proantitab/assets/example2.png)
</details>
######
# **H**OW TO SETUP?
Despite of the fact that ProAntiTab is pretty easy to use, the setup is slidely different for each server engine.
It normally is already enough to simply load ProAntiTab on the certain server you wanna use it, but in order to use ProAntiTab with all its features, its recommended to follow the [official setup guide on the Github wiki](https://github.com/RayzsYT/ProAntiTab/wiki/How-to-setup).
**Please feel free to join the [Discord](https://www.rayzs.de/discord) server to request for help if the instruction is unclear or too complicated. ^^**
#
# **H**OW TO ALLOW COMMANDS?
[Please check out the wiki to get an idea on how PAT works and can be used.](https://github.com/RayzsYT/ProAntiTab/wiki/How-to)
If you want to bypass all blocked commands, simply give yourself the following permission: **proantitab.bypass**
Following permission is required to execute all listed commands within a certain group: **proantitab.group.<command>**
######
# **C**OMMANDS & PERMISSIONS
All commands and their permissions are listed on the [documentation](https://www.spigotmc.org/resources/113172/field?field=documentation) page at the very buttom.
######
# **C**ONFIGURATION FILE
<details>
<summary>Bukkit/Spigot</summary>
[config.yml](https://github.com/RayzsYT/ProAntiTab/blob/v2.0.1/src/main/resources/files/bukkit-config.yml)
<br>
[storage.yml](https://github.com/RayzsYT/ProAntiTab/blob/v2.0.1/src/main/resources/files/bukkit-storage.yml)
</details>
<details>
<summary>Proxy (Bungeecord/Velocity)</summary>
[config.yml](https://github.com/RayzsYT/ProAntiTab/blob/v2.0.1/src/main/resources/files/proxy-config.yml)
<br>
[storage.yml](https://github.com/RayzsYT/ProAntiTab/blob/v2.0.1/src/main/resources/files/proxy-storage.yml)
</details>
######
## **bStats**
[![https://bstats.org/signatures/bukkit/ProAntiTab%20-%20Spigot.svg](https://bstats.org/signatures/bukkit/ProAntiTab%20-%20Spigot.svg)](https://bstats.org/plugin/bukkit/proantitab%20-%20spigot/20089)
[![https://bstats.org/signatures/bungeecord/ProAntiTab%20-%20Bungeecord.svg](https://bstats.org/signatures/bungeecord/ProAntiTab%20-%20Bungeecord.svg)](https://bstats.org/plugin/bungeecord/proantitab%20-%20bungeecord/20090)
[![https://bstats.org/signatures/velocity/ProAntiTab%20-%20Velocity.svg](https://bstats.org/signatures/velocity/ProAntiTab%20-%20Velocity.svg)](https://bstats.org/plugin/velocity/proantitab%20-%20velocity/21638)
<center>
[![https://www.rayzs.de/rayzsshield/assets/support.png](https://www.rayzs.de/rayzsshield/assets/support.png)](https://www.rayzs.de/discord)
### Support versions
Spigot (+ Forks): 1.8x - 1.20x (latest)
Bungeecord (+ Forks) | Waterfall recommended
+10 -327
View File
@@ -4,335 +4,18 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.rayzs.pat</groupId>
<artifactId>ProAntiTab</artifactId>
<version>2.3.4</version>
<groupId>de.rayzs.controlplayer</groupId>
<artifactId>ProAntiTab-Addons</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>subarguments</module>
</modules>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>bungeecord-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>placeholderapi</id>
<url>https://repo.helpch.at/releases/</url>
</repository>
<repository>
<id>velocity</id>
<url>https://repo.velocitypowered.com/snapshots/</url>
</repository>
<repository>
<id>minecraft-libraries</id>
<name>Minecraft Libraries</name>
<url>https://libraries.minecraft.net/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
<repository>
<id>viaversion-repo</id>
<url>https://repo.viaversion.com</url>
</repository>
<repository>
<id>william278-velocity</id>
<name>William278</name>
<url>https://repo.william278.net/velocity</url>
</repository>
<repository>
<id>william278-papiproxybridge</id>
<name>William278</name>
<url>https://repo.william278.net/papiproxybridge</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>dev.folia</groupId>
<artifactId>folia-api</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.2.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.21-R0.5-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-protocol</artifactId>
<version>1.16-R0.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>4.0.43</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.ElgarL</groupId>
<artifactId>groupmanager</artifactId>
<version>3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>brigadier</artifactId>
<version>1.1.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>datafixerupper</artifactId>
<version>6.0.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>logging</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-resolver-provider</artifactId>
<version>3.8.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-connector-basic</artifactId>
<version>1.7.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-transport-http</artifactId>
<version>1.7.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.18.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.github.waterfallmc</groupId>
<artifactId>waterfall-api</artifactId>
<version>1.20-R0.3-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.william278</groupId>
<artifactId>papiproxybridge</artifactId>
<version>1.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.velocitypowered</groupId>
<artifactId>velocity-api</artifactId>
<version>3.5.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.velocitypowered</groupId>
<artifactId>velocity-proxy</artifactId>
<version>3.5.0-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>com.velocitypowered</groupId>
<artifactId>velocity-proxy-log4j2-plugin</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-guice</artifactId>
<version>2.1.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spongepowered</groupId>
<artifactId>configurate-hocon</artifactId>
<version>4.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-minimessage</artifactId>
<version>4.26.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
<version>4.26.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-api</artifactId>
<version>4.4.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bungeecord</artifactId>
<version>4.4.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId>
<version>4.4.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.12.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.luckperms</groupId>
<artifactId>api</artifactId>
<version>5.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.viaversion</groupId>
<artifactId>viaversion-api</artifactId>
<version>5.7.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>IgnoreThisJar</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>*.txt</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<finalName>ProAntiTab</finalName>
<shadedArtifactAttached>false</shadedArtifactAttached>
<shadedClassifierName>shaded</shadedClassifierName>
<artifactSet>
<excludes/>
</artifactSet>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -1,26 +0,0 @@
package de.rayzs.pat.api.event;
import de.rayzs.pat.utils.sender.CommandSender;
public abstract class PATEvent<T> {
private final CommandSender player;
private boolean cancelled = false;
public PATEvent(CommandSender player) {
this.player = player;
}
public abstract void handle(T t);
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
public CommandSender getPlayer() {
return player;
}
public boolean isCancelled() {
return cancelled;
}
}
@@ -1,192 +0,0 @@
package de.rayzs.pat.api.event;
import de.rayzs.pat.api.event.events.*;
import de.rayzs.pat.utils.CommunicationPackets;
import de.rayzs.pat.utils.sender.CommandSender;
import java.util.*;
public class PATEventHandler {
private static List<PATEvent> EVENTS = new ArrayList<>();
public static ExecuteCommandEvent callExecuteCommandEvents(CommandSender player, String command, boolean blocked, boolean notify) {
ExecuteCommandEvent event = EmptyEvent.createEmptyExecuteCommandEvent(player, command, blocked, notify);
for (PATEvent patEvent : EVENTS) {
if (patEvent instanceof ExecuteCommandEvent executeCommandEvent) {
executeCommandEvent.handle(event);
}
}
return event;
}
public static FilteredSuggestionEvent callFilteredSuggestionEvents(CommandSender player, List<String> suggestions) {
FilteredSuggestionEvent event = EmptyEvent.createEmptyFilteredSuggestionEvent(player, suggestions);
for (PATEvent patEvent : EVENTS) {
if (patEvent instanceof FilteredSuggestionEvent filteredSuggestionEvent) {
filteredSuggestionEvent.handle(event);
}
}
return event;
}
public static FilteredTabCompletionEvent callFilteredTabCompletionEvents(CommandSender player, String cursor, List<String> completion) {
FilteredTabCompletionEvent event = EmptyEvent.createEmptyFilteredTabCompletion(player, cursor, completion);
for (PATEvent patEvent : EVENTS) {
if (patEvent instanceof FilteredTabCompletionEvent filteredTabCompletionEvent) {
filteredTabCompletionEvent.handle(event);
}
}
return event;
}
public static ServerPlayersChangeEvent callServerPlayersChangeEvents(CommandSender player, ServerPlayersChangeEvent.Type type) {
ServerPlayersChangeEvent event = EmptyEvent.createEmptyServerPlayersChangeEvent(player, type);
for (PATEvent patEvent : EVENTS) {
if (patEvent instanceof ServerPlayersChangeEvent serverPlayersChangeEvent) {
serverPlayersChangeEvent.handle(event);
}
}
return event;
}
public static UpdatePluginEvent callUpdatePluginEvents() {
UpdatePluginEvent event = EmptyEvent.createEmptyUpdatePluginEvent();
for (PATEvent patEvent : EVENTS) {
if (patEvent instanceof UpdatePluginEvent updatePluginEvent) {
updatePluginEvent.handle(event);
}
}
return event;
}
public static UpdatePlayerCommandsEvent callUpdatePlayerCommandsEvents(CommandSender player, List<String> commands, boolean serverBased) {
UpdatePlayerCommandsEvent event = EmptyEvent.createEmptyUpdatePlayerCommandsEvent(player, commands, serverBased);
for (PATEvent patEvent : EVENTS) {
if (patEvent instanceof UpdatePlayerCommandsEvent updatePlayerCommandsEvent) {
updatePlayerCommandsEvent.handle(event);
}
}
return event;
}
public static SentSyncEvent callSentSyncEvents(CommunicationPackets.Proxy2Backend.DataSyncPacket dataSyncPacket, String serverName) {
SentSyncEvent event = EmptyEvent.createEmptySentSyncEvent(dataSyncPacket, serverName);
for (PATEvent patEvent : EVENTS) {
if (patEvent instanceof SentSyncEvent sentSyncEvent) {
sentSyncEvent.handle(event);
}
}
return event;
}
public static ReceiveSyncEvent callReceiveSyncEvents(CommunicationPackets.Proxy2Backend.DataSyncPacket dataSyncPacket) {
ReceiveSyncEvent event = EmptyEvent.createEmptyReceiveSyncEvent(dataSyncPacket);
for (PATEvent patEvent : EVENTS) {
if (patEvent instanceof ReceiveSyncEvent receiveSyncEvent) {
receiveSyncEvent.handle(event);
}
}
return event;
}
public static void register(PATEvent event) {
EVENTS.add(event);
}
public static void unregister(PATEvent event) {
EVENTS.remove(event);
}
public static class EmptyEvent {
public static ServerPlayersChangeEvent createEmptyServerPlayersChangeEvent(CommandSender player, ServerPlayersChangeEvent.Type type) {
return new ServerPlayersChangeEvent(player, type) {
@Override
public void handle(ServerPlayersChangeEvent event) {
}
};
}
public static SentSyncEvent createEmptySentSyncEvent(CommunicationPackets.Proxy2Backend.DataSyncPacket dataSyncPacket, String serverName) {
return new SentSyncEvent(null, dataSyncPacket, serverName) {
@Override
public void handle(SentSyncEvent event) {
}
};
}
public static ReceiveSyncEvent createEmptyReceiveSyncEvent(CommunicationPackets.Proxy2Backend.DataSyncPacket dataSyncPacket) {
return new ReceiveSyncEvent(null, dataSyncPacket) {
@Override
public void handle(ReceiveSyncEvent event) {
}
};
}
public static UpdatePlayerCommandsEvent createEmptyUpdatePlayerCommandsEvent(CommandSender player, List<String> commands, boolean serverBased) {
return new UpdatePlayerCommandsEvent(player, commands, serverBased) {
@Override
public void handle(UpdatePlayerCommandsEvent event) {
}
};
}
public static UpdatePluginEvent createEmptyUpdatePluginEvent() {
return new UpdatePluginEvent(null) {
@Override
public void handle(UpdatePluginEvent event) {
}
};
}
public static ExecuteCommandEvent createEmptyExecuteCommandEvent(CommandSender player, String command, boolean blocked, boolean notify) {
return new ExecuteCommandEvent(player, command, blocked, notify) {
@Override
public void handle(ExecuteCommandEvent event) {
}
};
}
public static FilteredSuggestionEvent createEmptyFilteredSuggestionEvent(CommandSender player, List<String> suggestions) {
return new FilteredSuggestionEvent(player, suggestions) {
@Override
public void handle(FilteredSuggestionEvent event) {
}
};
}
public static FilteredTabCompletionEvent createEmptyFilteredTabCompletion(CommandSender player, String cursor, List<String> completion) {
return new FilteredTabCompletionEvent(player, cursor, completion) {
@Override
public void handle(FilteredTabCompletionEvent event) {
}
};
}
}
}
@@ -1,46 +0,0 @@
package de.rayzs.pat.api.event.events;
import de.rayzs.pat.api.event.PATEvent;
import de.rayzs.pat.utils.sender.CommandSender;
public abstract class ExecuteCommandEvent extends PATEvent<ExecuteCommandEvent> {
private final String command;
private boolean blocked, notify;
public ExecuteCommandEvent() {
super(null);
this.blocked = false;
this.notify = false;
this.command = null;
}
public ExecuteCommandEvent(CommandSender player, String command, boolean blocked, boolean notify) {
super(player);
this.blocked = blocked;
this.command = command;
this.notify = notify;
}
public void setDoesNotify(boolean notify) {
this.notify = notify;
}
public String getCommand() {
return command;
}
public boolean isBlocked() {
return blocked;
}
public boolean doesNotify() {
return notify;
}
public void setBlocked(boolean blocked) {
this.blocked = blocked;
}
}
@@ -1,30 +0,0 @@
package de.rayzs.pat.api.event.events;
import de.rayzs.pat.api.event.PATEvent;
import de.rayzs.pat.utils.sender.CommandSender;
import java.util.*;
public abstract class FilteredSuggestionEvent extends PATEvent<FilteredSuggestionEvent> {
private List<String> suggestions;
public FilteredSuggestionEvent() {
super(null);
this.suggestions = null;
}
public FilteredSuggestionEvent(CommandSender player, List<String> suggestions) {
super(player);
this.suggestions = suggestions;
}
public List<String> getSuggestions() {
return suggestions;
}
public void setSuggestions(List<String> suggestions) {
this.suggestions = suggestions;
}
}
@@ -1,40 +0,0 @@
package de.rayzs.pat.api.event.events;
import de.rayzs.pat.api.event.PATEvent;
import de.rayzs.pat.utils.sender.CommandSender;
import java.util.*;
public abstract class FilteredTabCompletionEvent extends PATEvent<FilteredTabCompletionEvent> {
private String cursor;
private List<String> completion;
public FilteredTabCompletionEvent() {
super(null);
this.cursor = null;
this.completion = null;
}
public FilteredTabCompletionEvent(CommandSender player, String cursor, List<String> completion) {
super(player);
this.cursor = cursor;
this.completion = completion;
}
public abstract void handle(FilteredTabCompletionEvent event);
public String getCursor() {
return cursor;
}
public List<String> getCompletion() {
return completion;
}
public void setCompletion(List<String> completion) {
this.completion = completion;
}
}
@@ -1,25 +0,0 @@
package de.rayzs.pat.api.event.events;
import de.rayzs.pat.utils.CommunicationPackets;
import de.rayzs.pat.api.event.PATEvent;
import de.rayzs.pat.utils.sender.CommandSender;
public abstract class ReceiveSyncEvent extends PATEvent<ReceiveSyncEvent> {
private final CommunicationPackets.Proxy2Backend.DataSyncPacket dataSyncPacket;
public ReceiveSyncEvent() {
super(null);
this.dataSyncPacket = null;
}
public ReceiveSyncEvent(CommandSender player, CommunicationPackets.Proxy2Backend.DataSyncPacket dataSyncPacket) {
super(player);
this.dataSyncPacket = dataSyncPacket;
}
public CommunicationPackets.Proxy2Backend.DataSyncPacket getDataSyncPacket() {
return dataSyncPacket;
}
}
@@ -1,33 +0,0 @@
package de.rayzs.pat.api.event.events;
import de.rayzs.pat.utils.CommunicationPackets;
import de.rayzs.pat.api.event.PATEvent;
import de.rayzs.pat.utils.sender.CommandSender;
public abstract class SentSyncEvent extends PATEvent<SentSyncEvent> {
private final CommunicationPackets.Proxy2Backend.DataSyncPacket dataSyncPacket;
private final String serverName;
public SentSyncEvent() {
super(null);
this.dataSyncPacket = null;
this.serverName = null;
}
public SentSyncEvent(CommandSender player, CommunicationPackets.Proxy2Backend.DataSyncPacket dataSyncPacket, String serverName) {
super(player);
this.dataSyncPacket = dataSyncPacket;
this.serverName = serverName;
}
public String getServerName() {
return serverName;
}
public CommunicationPackets.Proxy2Backend.DataSyncPacket getDataSyncPacket() {
return dataSyncPacket;
}
}
@@ -1,22 +0,0 @@
package de.rayzs.pat.api.event.events;
import de.rayzs.pat.api.event.PATEvent;
import de.rayzs.pat.utils.sender.CommandSender;
public abstract class ServerPlayersChangeEvent extends PATEvent<ServerPlayersChangeEvent> {
private final Type type;
public ServerPlayersChangeEvent(CommandSender player, Type type) {
super(player);
this.type = type;
}
public ServerPlayersChangeEvent() {
super(null);
this.type = Type.UNKNOWN;
}
public enum Type { JOINED, LEFT, UNKNOWN }
}
@@ -1,31 +0,0 @@
package de.rayzs.pat.api.event.events;
import de.rayzs.pat.api.event.PATEvent;
import de.rayzs.pat.utils.sender.CommandSender;
import java.util.List;
public abstract class UpdatePlayerCommandsEvent extends PATEvent<UpdatePlayerCommandsEvent> {
private List<String> commands;
private boolean serverBased;
public UpdatePlayerCommandsEvent() {
super(null);;
}
public UpdatePlayerCommandsEvent(CommandSender player, List<String> commands, boolean serverBased) {
super(player);
this.commands = commands;
this.serverBased = serverBased;
}
public List<String> getCommands() {
return commands;
}
public boolean isServerBased() {
return serverBased;
}
}
@@ -1,15 +0,0 @@
package de.rayzs.pat.api.event.events;
import de.rayzs.pat.api.event.PATEvent;
import de.rayzs.pat.utils.sender.CommandSender;
public abstract class UpdatePluginEvent extends PATEvent<UpdatePluginEvent> {
public UpdatePluginEvent() {
super(null);;
}
public UpdatePluginEvent(CommandSender player) {
super(player);
}
}
@@ -1,813 +0,0 @@
package de.rayzs.pat.api.storage;
import java.util.*;
import java.util.concurrent.TimeUnit;
import de.rayzs.pat.plugin.system.serverbrand.CustomServerBrand;
import de.rayzs.pat.plugin.system.communication.BackendUpdater;
import de.rayzs.pat.plugin.system.communication.Communicator;
import de.rayzs.pat.plugin.packetanalyzer.proxy.BungeePacketAnalyzer;
import de.rayzs.pat.api.storage.config.messages.*;
import de.rayzs.pat.api.storage.config.settings.*;
import de.rayzs.pat.plugin.logger.Logger;
import de.rayzs.pat.plugin.system.subargument.SubArgument;
import de.rayzs.pat.utils.configuration.updater.ConfigUpdater;
import de.rayzs.pat.utils.group.Group;
import de.rayzs.pat.utils.permission.PermissionPlugin;
import de.rayzs.pat.utils.response.ResponseHandler;
import de.rayzs.pat.utils.sender.CommandSender;
import org.bukkit.entity.Player;
import de.rayzs.pat.api.event.PATEventHandler;
import de.rayzs.pat.api.storage.blacklist.BlacklistCreator;
import de.rayzs.pat.api.storage.blacklist.impl.GeneralBlacklist;
import de.rayzs.pat.api.storage.blacklist.impl.GeneralIgnoredServers;
import de.rayzs.pat.api.storage.placeholders.commands.general.ListCommandsPlaceholder;
import de.rayzs.pat.api.storage.placeholders.commands.general.ListReversedCommandsPlaceholder;
import de.rayzs.pat.api.storage.placeholders.commands.general.ListSizeCommandsPlaceholder;
import de.rayzs.pat.api.storage.placeholders.commands.general.ListSortedCommandsPlaceholder;
import de.rayzs.pat.api.storage.placeholders.commands.group.ListGroupCommandsPlaceholder;
import de.rayzs.pat.api.storage.placeholders.commands.group.ListGroupReversedCommandsPlaceholder;
import de.rayzs.pat.api.storage.placeholders.commands.group.ListGroupSizeCommandsPlaceholder;
import de.rayzs.pat.api.storage.placeholders.commands.group.ListGroupSortedCommandsPlaceholder;
import de.rayzs.pat.api.storage.placeholders.general.GeneralCurrentVersionPlaceholder;
import de.rayzs.pat.api.storage.placeholders.general.GeneralNewestVersionPlaceholder;
import de.rayzs.pat.api.storage.placeholders.general.GeneralPrefixPlaceholder;
import de.rayzs.pat.api.storage.placeholders.general.GeneralUserPlaceholder;
import de.rayzs.pat.api.storage.placeholders.groups.ListGroupsPlaceholder;
import de.rayzs.pat.api.storage.placeholders.groups.ListGroupsReversedPlaceholder;
import de.rayzs.pat.api.storage.placeholders.groups.ListGroupsSortedPlaceholder;
import de.rayzs.pat.api.storage.placeholders.groups.ListSizeGroupsPlaceholder;
import de.rayzs.pat.api.storage.placeholders.messages.BlockedBaseCommandPlaceholder;
import de.rayzs.pat.api.storage.placeholders.messages.BlockedSubCommandPlaceholder;
import de.rayzs.pat.api.storage.placeholders.messages.UnknownCommandPlaceholder;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.api.storage.storages.DisabledServersStorage;
import de.rayzs.pat.api.storage.storages.IgnoredServersStorage;
import de.rayzs.pat.api.storage.storages.PlaceholderStorage;
import de.rayzs.pat.plugin.PluginLoader;
import de.rayzs.pat.utils.ExpireCache;
import de.rayzs.pat.utils.Reflection;
import de.rayzs.pat.utils.configuration.ConfigurationBuilder;
import de.rayzs.pat.utils.configuration.Configurator;
import de.rayzs.pat.utils.group.GroupManager;
import de.rayzs.pat.utils.message.replacer.PlaceholderReplacer;
import de.rayzs.pat.utils.permission.PermissionUtil;
public class Storage {
private static PluginLoader LOADER;
public static final List<UUID> NOTIFY_PLAYERS = new ArrayList<>();
public static String TOKEN = "", CENSORED_TOKEN = "", SERVER_NAME = null, CURRENT_VERSION = "", NEWER_VERSION = "";
public static boolean OUTDATED = false, SEND_CONSOLE_NOTIFICATION = true;
public static boolean USE_PLACEHOLDERAPI = false, USE_PAPIPROXYBRIDGE = false, USE_VIAVERSION = false;
private final static ExpireCache<UUID, String> TEMP_PLAYER_SERVER_CACHE = new ExpireCache<>(1, TimeUnit.SECONDS);
private static PermissionPlugin PERMISSION_PLUGIN = PermissionPlugin.NONE;
public static void initialize(PluginLoader loader, String currentVersion) {
LOADER = loader;
CURRENT_VERSION = currentVersion;
}
public static void setPermissionPlugin(PermissionPlugin permissionPlugin) {
if (PERMISSION_PLUGIN == PermissionPlugin.LUCKPERMS) {
return;
}
PERMISSION_PLUGIN = permissionPlugin;
}
public static void broadcastPermissionsPluginNotice() {
if (Storage.getPermissionPlugin() != PermissionPlugin.NONE) {
return;
}
Logger.warning("No known permissions plugin found, so some features may be disabled.");
Logger.warning("Read more about it here: https://rayzs.de/products/proantitab/nkppf");
}
public static PermissionPlugin getPermissionPlugin() {
return PERMISSION_PLUGIN;
}
public static void loadAll(boolean loadBlacklist) {
loadConfig();
loadToken();
if (TOKEN != null && !TOKEN.isEmpty()) {
int tokenLength = TOKEN.length(), cutIndex = Math.max(1, tokenLength - 2);
CENSORED_TOKEN = TOKEN.charAt(0) + "*".repeat(cutIndex) + TOKEN.substring(cutIndex);
Logger.info("Token found! (" + CENSORED_TOKEN + ")");
}
if (loadBlacklist) Blacklist.loadAll();
PATEventHandler.callUpdatePluginEvents();
}
public static void loadToken() {
Files.TOKEN.reload();
boolean invalidEnv = false;
if (Reflection.isProxyServer()) {
boolean loadFromEnv = (Boolean) Files.TOKEN.getOrSet("load-from-env.enabled", false);
String envVariable = (String) Files.TOKEN.getOrSet("load-from-env.name", "PAT_TOKEN");
if (loadFromEnv) {
Logger.info("Looking up token from environment variable: " + envVariable);
TOKEN = System.getenv(envVariable);
if (TOKEN != null) {
return;
} else invalidEnv = true;
}
TOKEN = (String) Files.TOKEN.getOrSet("token", UUID.randomUUID().toString());
if (invalidEnv)
Logger.warning("Environment variable not found! Using default Token from the token.yml instead.");
return;
}
if (!ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED) {
return;
}
boolean loadFromEnv = ConfigSections.Settings.HANDLE_THROUGH_PROXY.LOAD_FROM_ENV;
String envVariable = ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENV_NAME;
if (loadFromEnv) {
TOKEN = System.getenv(envVariable);
if (TOKEN != null) {
return;
} else invalidEnv = true;
}
TOKEN = ConfigSections.Settings.HANDLE_THROUGH_PROXY.TOKEN;
if (invalidEnv)
Logger.warning("Environment variable not found! Using default Token from the config.yml instead.");
}
public static void loadConfig() {
ConfigSections.Settings.initialize();
ConfigSections.Messages.initialize();
ConfigSections.SECTIONS.forEach(ConfigStorage::load);
if (USE_PLACEHOLDERAPI)
ConfigSections.PLACEHOLDERS.forEach(PlaceholderStorage::load);
}
public static void reload() {
boolean proxy = Reflection.isProxyServer();
boolean backend = Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED && !proxy;
ConfigUpdater.initialize();
Storage.loadAll(Reflection.isProxyServer() || !backend);
CustomServerBrand.get().refreshTask();
GroupManager.clearAllGroups();
GroupManager.initialize();
if (!proxy) {
Communicator.get().reload();
BackendUpdater.get().restart();
}
if (!backend) {
Storage.handleChange();
}
if (proxy) {
Communicator.Proxy2Backend.sendDataSync();
}
Storage.Files.CUSTOM_RESPONSES.reload();
ResponseHandler.update();
ConfigUpdater.broadcastMissingParts();
Storage.getLoader().handleReload();
}
public static void handleChange() {
handleChange(null);
}
public static void handleChange(String server) {
if (Reflection.isProxyServer()) {
if (server != null) {
Storage.Blacklist.clearServerBlacklists(server);
Storage.Blacklist.loadCachedServerBlacklists(server);
final List<String> associatedServers = getServers()
.stream()
.filter(s -> !s.equals(server) && isServer(server, s))
.toList();
associatedServers.forEach(s -> {
Storage.Blacklist.clearServerBlacklists(s);
Storage.Blacklist.loadCachedServerBlacklists(s);
});
associatedServers.forEach(serverName -> {
final List<UUID> playerIds = Storage.getLoader().getPlayerIdsByServer(serverName);
final List<String> commands = Blacklist.Collector.collectAllServerCommands(serverName);
playerIds.forEach(playerId -> {
final CommandSender sender = CommandSender.from(playerId);
final List<String> playerCommands = new ArrayList<>(commands);
final List<String> groupCommands = Blacklist.Collector.collectAllPlayerGroupCommands(sender, serverName);
playerCommands.addAll(groupCommands);
SubArgument.get().getUpdateArgumentsHandler().updatePlayerArguments(sender, playerCommands, commands, groupCommands);
PATEventHandler.callUpdatePlayerCommandsEvents(sender, playerCommands, true);
});
});
} else {
Storage.Blacklist.Experimental.forceCacheReset();
final List<UUID> playerIds = Storage.getLoader().getPlayerIds();
playerIds.forEach(playerId -> {
final CommandSender sender = CommandSender.from(playerId);
final List<String> serverCommands = Storage.Blacklist.Collector.collectAllServerCommands(sender.getServerName());
final List<String> playerCommands = new ArrayList<>(serverCommands);
final List<String> groupCommands = Storage.Blacklist.Collector.collectAllPlayerGroupCommands(sender, sender.getServerName());
playerCommands.addAll(groupCommands);
SubArgument.get().getUpdateArgumentsHandler().updatePlayerArguments(sender, playerCommands, serverCommands, groupCommands);
PATEventHandler.callUpdatePlayerCommandsEvents(sender, playerCommands, false);
});
}
GroupManager.clearServerGroupBlacklists();
Storage.getLoader().resetCommandsCache();
if (!Reflection.isVelocityServer()) {
BungeePacketAnalyzer.sendCommandsPacket();
}
Communicator.Proxy2Backend.sendUpdateCommand();
return;
}
getLoader().handleReload();
PermissionUtil.reloadPermissions();
Storage.getLoader().resetCommandsCache();
Storage.getLoader().updateCommands();
}
public static void tempCachePlayerToServer(UUID playerId, String server) {
TEMP_PLAYER_SERVER_CACHE.put(playerId, server);
}
public static String getTempCachedPlayerToServer(UUID playerId, String server) {
return TEMP_PLAYER_SERVER_CACHE.get(playerId);
}
public static String getCachedPlayerServername(UUID playerId) {
return TEMP_PLAYER_SERVER_CACHE.get(playerId);
}
public static PluginLoader getLoader() {
return LOADER;
}
public static List<String> getServers() {
return getServers(false);
}
public static List<String> getServers(boolean includingServerSpecifics) {
List<String> servers = LOADER.getServerNames();
if(includingServerSpecifics) {
servers.addAll(Blacklist.getBlacklists().stream().map(Map.Entry::getKey).toList());
}
return servers;
}
public static boolean isServer(String targetServers, List<String> servers) {
for (String originServer : servers)
if(isServer(originServer, targetServers))
return true;
return false;
}
public static boolean isServer(String originServer, String targetServer) {
originServer = originServer.toLowerCase();
targetServer = targetServer.toLowerCase();
if (originServer.endsWith("*")) {
originServer = originServer.substring(0, originServer.length() - 2);
return targetServer.startsWith(originServer);
}
return originServer.equalsIgnoreCase(targetServer);
}
public static class Files {
public static final ConfigurationBuilder
CONFIGURATION = Configurator.get("config"),
STORAGE = Configurator.get("storage"),
PLACEHOLDERS = Configurator.get("placeholders"),
CUSTOM_RESPONSES = Configurator.get("custom-responses"),
TOKEN = Configurator.get("token");
public static void initialize() {}
}
public static class ConfigSections {
public static List<ConfigStorage> SECTIONS = new ArrayList<>();
public static List<PlaceholderStorage> PLACEHOLDERS = new ArrayList<>();
public static class Settings {
public static final AllowGroupOverrulingSection ALLOW_GROUP_OVERRULING = new AllowGroupOverrulingSection();
public static final AutoLowercaseCommandsSection AUTO_LOWERCASE_COMMANDS = new AutoLowercaseCommandsSection();
public static final BlockNamespaceCommandsSection BLOCK_NAMESPACE_COMMANDS = new BlockNamespaceCommandsSection();
public static final HandleThroughProxySection HANDLE_THROUGH_PROXY = new HandleThroughProxySection();
public static final InjectionFailedSection INJECTION_FAILED = new InjectionFailedSection();
public static final PatchExploitSection PATCH_EXPLOITS = new PatchExploitSection();
public static final CustomBrandSection CUSTOM_BRAND = new CustomBrandSection();
public static final CancelCommandSection CANCEL_COMMAND = new CancelCommandSection();
public static final CustomPluginsSection CUSTOM_PLUGIN = new CustomPluginsSection();
public static final CustomVersionSection CUSTOM_VERSION = new CustomVersionSection();
public static final DisableSyncSection DISABLE_SYNC = new DisableSyncSection();
public static final ForwardConsoleNotificationAlertsSection FORWARD_CONSOLE_NOTIFICATIONS = new ForwardConsoleNotificationAlertsSection();
public static final CustomProtocolPingSection CUSTOM_PROTOCOL_PING = new CustomProtocolPingSection();
public static final CustomUnknownCommandSection CUSTOM_UNKNOWN_COMMAND = new CustomUnknownCommandSection();
public static final TurnBlacklistToWhitelistSection TURN_BLACKLIST_TO_WHITELIST = new TurnBlacklistToWhitelistSection();
public static final BaseCommandCaseSensitiveSection BASE_COMMAND_CASE_SENSITIVE = new BaseCommandCaseSensitiveSection();
public static final UpdateGroupsPerWorldSection UPDATE_GROUPS_PER_WORLD = new UpdateGroupsPerWorldSection();
public static final UpdateGroupsPerServerSection UPDATE_GROUPS_PER_SERVER = new UpdateGroupsPerServerSection();
public static UpdateSection UPDATE = new UpdateSection();
public static void initialize() {}
}
public static class Messages {
public static PrefixSection PREFIX = new PrefixSection();
public static BlacklistSection BLACKLIST = new BlacklistSection();
public static CommandFailedSection COMMAND_FAILED = new CommandFailedSection();
public static ConvertSection CONVERT = new ConvertSection();
public static ExtractSection EXTRACT = new ExtractSection();
public static GroupSection GROUP = new GroupSection();
public static HelpSection HELP = new HelpSection();
public static InfoSection INFO = new InfoSection();
public static NoPermissionSection NO_PERMISSION = new NoPermissionSection();
public static NotificationSection NOTIFICATION = new NotificationSection();
public static PermsCheckSection PERMS_CHECK = new PermsCheckSection();
public static PostDebugSection POST_DEBUG = new PostDebugSection();
public static OnlyForProxySection NO_PROXY = new OnlyForProxySection();
public static ReloadSection RELOAD = new ReloadSection();
public static ServerListSection SERV_LIST = new ServerListSection();
public static StatsSection STATS = new StatsSection();
public static UpdatePermissionsSection UPDATE_PERMISSIONS = new UpdatePermissionsSection();
public static void initialize() {}
}
public static class Placeholders {
public static GeneralPrefixPlaceholder PREFIX = new GeneralPrefixPlaceholder();
public static GeneralUserPlaceholder USER = new GeneralUserPlaceholder();
public static GeneralCurrentVersionPlaceholder CURRENT_VERSION = new GeneralCurrentVersionPlaceholder();
public static GeneralNewestVersionPlaceholder NEWEST_VERSION = new GeneralNewestVersionPlaceholder();
public static BlockedBaseCommandPlaceholder BLOCKED_BASE_COMMAND = new BlockedBaseCommandPlaceholder();
public static BlockedSubCommandPlaceholder BLOCKED_SUB_COMMAND = new BlockedSubCommandPlaceholder();
public static UnknownCommandPlaceholder UNKNOWN_COMMAND = new UnknownCommandPlaceholder();
public static ListGroupsPlaceholder LIST_GROUP = new ListGroupsPlaceholder();
public static ListGroupsReversedPlaceholder LIST_GROUP_REVERSED = new ListGroupsReversedPlaceholder();
public static ListGroupsSortedPlaceholder LIST_GROUP_SORTED = new ListGroupsSortedPlaceholder();
public static ListSizeGroupsPlaceholder LIST_SIZE_GROUPS = new ListSizeGroupsPlaceholder();
public static ListGroupCommandsPlaceholder LIST_GROUP_COMMANDS = new ListGroupCommandsPlaceholder();
public static ListGroupReversedCommandsPlaceholder LIST_GROUP_REVERSED_COMMANDS = new ListGroupReversedCommandsPlaceholder();
public static ListGroupSortedCommandsPlaceholder LIST_GROUP_SORTED_COMMANDS = new ListGroupSortedCommandsPlaceholder();
public static ListGroupSizeCommandsPlaceholder LIST_GROUP_SIZE_GROUP = new ListGroupSizeCommandsPlaceholder();
public static ListCommandsPlaceholder LIST_COMMANDS = new ListCommandsPlaceholder();
public static ListReversedCommandsPlaceholder LIST_REVERSED_COMMANDS = new ListReversedCommandsPlaceholder();
public static ListSortedCommandsPlaceholder LIST_SORTED_COMMANDS = new ListSortedCommandsPlaceholder();
public static ListSizeCommandsPlaceholder LIST_SIZE_COMMANDS = new ListSizeCommandsPlaceholder();
public static void initialize() {}
public static String findAndReplace(Player player, String request) {
String result = null, param = "";
if(USE_PLACEHOLDERAPI) {
for (PlaceholderStorage storage : PLACEHOLDERS) {
if (!storage.getRequest().startsWith(request)) continue;
if (storage.getRequest().endsWith("group_") && request.contains("group_"))
param = request.split("group_")[1];
result = storage.onRequest(player, param);
if (result == null) continue;
else result = result.replace("\\n", "\n");
break;
}
// Second time because of nested placeholders
if (result != null && result.contains("%")) {
result = PlaceholderReplacer.replace(player, result);
}
}
return result;
}
}
}
public static class Blacklist {
public static class Collector {
/**
* Collects all commands from the global section and
* that certain server.
*
* @param serverName Target server name.
* @return List of collected commands.
*/
public static List<String> collectAllServerCommands(String serverName) {
List<String> commands = new ArrayList<>(Storage.Blacklist.getBlacklist().getCommands());
if (!Reflection.isProxyServer())
return commands;
if (serverName == null)
return commands;
List<GeneralBlacklist> blacklists = Storage.Blacklist.getServerBlacklists(serverName);
for (GeneralBlacklist blacklist : blacklists)
commands.addAll(blacklist.getCommands());
return commands;
}
/**
* Get a list of all available commands for a player
* based on the PAT groups the player is in.
*
* @param sender Target player.
* @param serverName Target server name.
* @return List of collected commands.
*/
public static List<String> collectAllPlayerGroupCommands(CommandSender sender, String serverName) {
final List<String> commands = new ArrayList<>();
final List<Group> groups = GroupManager.getPlayerGroups(sender);
if (serverName == null) {
groups.forEach(group -> commands.addAll(group.getCommands()));
return commands;
}
groups.forEach(group -> {
commands.addAll(group.getCommands());
group.getBlacklistServerNames(serverName).forEach(s -> {
commands.addAll(group.getCommands(s));
});
});
return commands;
}
}
private static class Experimental {
public static void forceCacheReset() {
for (Object o : CACHED_SERVER_BLACKLIST.getCache().asMap().keySet()) {
String s = (String) o;
clearServerBlacklists(s);
loadCachedServerBlacklists(s);
}
}
}
public enum BlockType {
CHAT("[CMD]"),
TAB("[TAB]"),
NEGATE("!"),
BOTH("");
private final String text;
BlockType(String text) {
this.text = text;
}
@Override
public String toString() {
return this.text;
}
}
private static final BlockType[] BLOCK_TYPES = BlockType.values();
private static final GeneralBlacklist BLACKLIST = BlacklistCreator.createGeneralBlacklist();
private static final IgnoredServersStorage IGNORED_SERVERS = new GeneralIgnoredServers();
private static final DisabledServersStorage DISABLED_SERVERS = new DisabledServersStorage();
// General server-specific list (e.g: server-*)
private static final HashMap<String, GeneralBlacklist> SERVER_BLACKLISTS = new HashMap<>();
// Temporary list for all servers (e.g: server-1)
private static final ExpireCache<String, List<GeneralBlacklist>> CACHED_SERVER_BLACKLIST = new ExpireCache<>(1, TimeUnit.HOURS);
private static void loadAll() {
CACHED_SERVER_BLACKLIST.clear();
SERVER_BLACKLISTS.clear();
BLACKLIST.load();
if(!Reflection.isProxyServer())
return;
IGNORED_SERVERS.load();
DISABLED_SERVERS.load();
BLACKLIST.getConfig().getKeys("global.servers", true).forEach(key -> {
GeneralBlacklist blacklist = BlacklistCreator.createGeneralBlacklist(key);
blacklist.load();
SERVER_BLACKLISTS.put(key, blacklist);
});
getServers().forEach(Blacklist::loadCachedServerBlacklists);
}
private static void loadCachedServerBlacklists(String server) {
List<GeneralBlacklist> blacklists = SERVER_BLACKLISTS.entrySet().stream()
.filter(entry ->
isServer(entry.getKey(), server)
).map(Map.Entry::getValue).toList();
CACHED_SERVER_BLACKLIST.put(server, blacklists);
}
public static GeneralBlacklist getServerBlacklist(String server) {
GeneralBlacklist blacklist = SERVER_BLACKLISTS.get(server);
if(blacklist != null) {
return blacklist;
}
blacklist = BlacklistCreator.createGeneralBlacklist(server);
blacklist.load();
SERVER_BLACKLISTS.put(server, blacklist);
return blacklist;
}
public static Set<Map.Entry<String, GeneralBlacklist>> getBlacklists() {
return SERVER_BLACKLISTS.entrySet();
}
public static GeneralBlacklist getBlacklist() {
return BLACKLIST;
}
public static List<GeneralBlacklist> getServerBlacklists(String server) {
if (!CACHED_SERVER_BLACKLIST.contains(server)) {
loadCachedServerBlacklists(server);
}
return CACHED_SERVER_BLACKLIST.get(server);
}
public static void clearServerBlacklists(String server) {
CACHED_SERVER_BLACKLIST.remove(server);
}
public static boolean isDisabledServer(String server) {
return DISABLED_SERVERS.isListed(server);
}
public static boolean isIgnoredServer(String server) {
return IGNORED_SERVERS.isListed(server);
}
public static boolean canPlayerAccess(CommandSender sender, List<Group> groups, String command, BlockType type) {
return canPlayerAccess(sender, groups, command, type, null);
}
public static boolean canPlayerAccessChat(CommandSender sender, List<Group> groups, String command) {
return canPlayerAccess(sender, groups, command, BlockType.CHAT, null);
}
public static boolean canPlayerAccessChat(CommandSender sender, List<Group> groups, String command, String server) {
return canPlayerAccess(sender, groups, command, BlockType.CHAT, server);
}
public static boolean canPlayerAccessTab(CommandSender sender, List<Group> groups, String command) {
return canPlayerAccess(sender, groups, command, BlockType.TAB, null);
}
public static boolean canPlayerAccessTab(CommandSender sender, List<Group> groups, String command, String server) {
return canPlayerAccess(sender, groups, command, BlockType.TAB, server);
}
public static boolean canPlayerAccess(CommandSender sender, List<Group> groups, String command, BlockType type, String server) {
final boolean allowGroupOverruling = ConfigSections.Settings.ALLOW_GROUP_OVERRULING.ENABLED;
final boolean blocked = isBlocked(command, type, server);
if (allowGroupOverruling) {
GroupManager.AccessResult groupResult = GroupManager.canAccessCommand(groups, command, type, server);
if (groupResult == GroupManager.AccessResult.NEGATED) {
return false;
}
if (!blocked) {
return true;
}
if (Storage.getPermissionPlugin() != PermissionPlugin.NONE) {
if (PermissionUtil.hasBypassPermission(sender, command)) {
return true;
}
}
return groupResult.asBoolean();
}
if (!blocked) {
return true;
}
if (Storage.getPermissionPlugin() != PermissionPlugin.NONE) {
if (PermissionUtil.hasBypassPermission(sender, command)) {
return true;
}
}
return GroupManager.canAccessCommand(groups, command, type, server).asBoolean();
}
public static boolean isBlockedChat(String command) {
return isBlocked(command, BlockType.CHAT, null);
}
public static boolean isBlockedTab(String command) {
return isBlocked(command, BlockType.TAB, null);
}
public static boolean isBlockedChat(String command, String server) {
return isBlocked(command, BlockType.CHAT, server);
}
public static boolean isBlockedTab(String command, String server) {
return isBlocked(command, BlockType.TAB, server);
}
public static boolean isBlocked(String command, BlockType type) {
return isBlocked(command, type, null);
}
public static boolean isBlocked(String command, BlockType type, String server) {
BlockType negation = BlockType.NEGATE;
String negatedCommand = negation + command;
boolean all = isListed("*", type, server),
listed = isListed(command, type, server),
negatedListed = isListed(negatedCommand, type, server),
turn = ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED;
if (all) {
// Only listens to negated commands
if (negatedListed) {
return turn;
}
return !turn;
}
return turn != listed;
}
private static boolean isListed(String unmodifiedCommand, BlockType type, String server) {
if (server != null && isDisabledServer(server)) {
return false;
}
boolean listed = false;
String command = type.toString() + unmodifiedCommand;
if (server == null || !isIgnoredServer(server)) {
listed = BLACKLIST.isListed(command, false);
}
if (server == null) {
if (!listed && type != BlockType.BOTH) {
return isListed(unmodifiedCommand, BlockType.BOTH, null);
}
return listed;
}
List<GeneralBlacklist> blacklists = new ArrayList<>(getServerBlacklists(server));
if (blacklists.isEmpty())
blacklists.add(BLACKLIST);
for (GeneralBlacklist blacklist : blacklists) {
if (listed) {
break;
}
listed = blacklist.isListed(command, false);
}
if (!listed && type != BlockType.BOTH) {
return isListed(unmodifiedCommand, BlockType.BOTH, server);
}
return listed;
}
public static class BlockTypeFetcher {
public static boolean isNegated(String command) {
if (command.isEmpty()) {
return false;
}
boolean negated = command.charAt(0) == '!';
if (!negated && command.length() > 5)
negated = command.charAt(5) == '!';
return negated;
}
public static BlockType getType(String command) {
for (BlockType blockType : BLOCK_TYPES) {
if (!command.startsWith(blockType.toString()))
continue;
return blockType;
}
return null;
}
public static String modify(String command) {
BlockType type = getType(command);
return modify(command, type);
}
public static String modify(String command, BlockType type) {
if (type == null || type == BlockType.BOTH || command.length() <= type.toString().length() || !command.startsWith(type.toString()))
return command;
return command.substring(type.toString().length());
}
// Remove all BlockType elements from String
public static String cleanse(String command) {
BlockType type = getType(command);
if (type == null || type == BlockType.BOTH) {
return command;
}
return modify(command, type);
}
}
}
}
@@ -1,39 +0,0 @@
package de.rayzs.pat.api.storage;
import de.rayzs.pat.utils.configuration.*;
import java.io.Serializable;
public abstract class StorageTemplate implements Serializable {
private final String navigatePath;
private final ConfigurationBuilder configuration;
public StorageTemplate(ConfigurationBuilder configuration, String navigatePath) {
this.navigatePath = navigatePath;
this.configuration = configuration;
this.load();
}
public StorageTemplate setIfEmpty(String target, Object obj) {
configuration.getOrSet(target, obj);
return this;
}
public StorageTemplate set(String target, Object obj) {
configuration.setAndSave(target, obj);
return this;
}
public Object get(String target, Object obj) {
configuration.getOrSet(target, obj);
return this;
}
public ConfigurationBuilder getConfig() {
return configuration;
}
public String getNavigatePath() { return navigatePath; }
public abstract void save();
public abstract void load();
}
@@ -1,36 +0,0 @@
package de.rayzs.pat.api.storage.blacklist;
import de.rayzs.pat.api.storage.blacklist.impl.*;
import de.rayzs.pat.api.storage.Storage;
public class BlacklistCreator {
public static GeneralBlacklist createGeneralBlacklist() {
return new GeneralBlacklist("commands");
}
public static GeneralBlacklist createGeneralBlacklist(String server) {
return new GeneralBlacklist("servers." + server + ".commands");
}
public static GroupBlacklist createGroupBlacklist(String group) {
return new GroupBlacklist(group, "commands");
}
public static GroupBlacklist createGroupBlacklist(String group, String server, boolean ignoreExist) {
if (!exist(group, server) && !ignoreExist)
return null;
return new GroupBlacklist(group, "servers." + server + ".commands");
}
public static boolean exist(String server) {
Object obj = Storage.Blacklist.getBlacklist().getConfig().get("global.servers." + server);
return obj != null;
}
public static boolean exist(String group, String server) {
Object obj = Storage.Blacklist.getBlacklist().getConfig().get("groups." + group + ".servers." + server);
return obj != null;
}
}
@@ -1,60 +0,0 @@
package de.rayzs.pat.api.storage.blacklist.impl;
import de.rayzs.pat.api.storage.storages.BlacklistStorage;
import de.rayzs.pat.api.storage.StorageTemplate;
import java.util.List;
public class GeneralBlacklist extends BlacklistStorage {
public GeneralBlacklist(String navigatePath) { super("global." + navigatePath); }
@Override
public List<String> getCommands() {
return super.getCommands();
}
@Override
public BlacklistStorage add(String command) {
return super.add(command);
}
@Override
public BlacklistStorage remove(String command) {
return super.remove(command);
}
@Override
public BlacklistStorage clear() {
return super.clear();
}
@Override
public StorageTemplate setIfEmpty(String target, Object obj) {
return super.setIfEmpty(target, obj);
}
@Override
public StorageTemplate set(String target, Object obj) {
return super.set(target, obj);
}
@Override
public void setList(List<String> commands) {
super.setList(commands);
}
@Override
public Object get(String target, Object obj) {
return super.get(target, obj);
}
@Override
public void save() {
super.save();
}
@Override
public void load() {
super.load();
}
}
@@ -1,40 +0,0 @@
package de.rayzs.pat.api.storage.blacklist.impl;
import de.rayzs.pat.api.storage.storages.IgnoredServersStorage;
public class GeneralIgnoredServers extends IgnoredServersStorage {
public GeneralIgnoredServers() {
super("global.ignored-servers");
}
@Override
public IgnoredServersStorage add(String server) {
return super.add(server);
}
@Override
public IgnoredServersStorage remove(String server) {
return super.remove(server);
}
@Override
public boolean isListed(String server) {
return super.isListed(server);
}
@Override
public boolean isListEmpty() {
return super.isListEmpty();
}
@Override
public void load() {
super.load();
}
@Override
public void save() {
super.save();
}
}
@@ -1,58 +0,0 @@
package de.rayzs.pat.api.storage.blacklist.impl;
import de.rayzs.pat.api.storage.storages.BlacklistStorage;
import de.rayzs.pat.api.storage.StorageTemplate;
import java.util.List;
public class GroupBlacklist extends BlacklistStorage {
public GroupBlacklist(String group, String navigatePath) { super("groups." + group + "." + navigatePath); }
@Override
public List<String> getCommands() {
return super.getCommands();
}
@Override
public BlacklistStorage add(String command) {
return super.add(command);
}
@Override
public BlacklistStorage remove(String command) { return super.remove(command); }
@Override
public BlacklistStorage clear() {
return super.clear();
}
@Override
public StorageTemplate setIfEmpty(String target, Object obj) {
return super.setIfEmpty(target, obj);
}
@Override
public StorageTemplate set(String target, Object obj) {
return super.set(target, obj);
}
@Override
public void setList(List<String> commands) {
super.setList(commands);
}
@Override
public Object get(String target, Object obj) {
return super.get(target, obj);
}
@Override
public void save() {
super.save();
}
@Override
public void load() {
super.load();
}
}
@@ -1,51 +0,0 @@
package de.rayzs.pat.api.storage.config.messages;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.Reflection;
public class BlacklistSection extends ConfigStorage {
public String CLEAR, CLEAR_CONFIRM, CLEAR_SERVER, CLEAR_SERVER_CONFIRM, CLEAR_SERVER_NOT_FOUND;
public String LIST_MESSAGE, LIST_SPLITTER, LIST_SERVER_MESSAGE, LIST_SERVER_SPLITTER;
public String ADD_SUCCESS, ADD_FAILED;
public String REMOVE_SUCCESS, REMOVE_FAILED;
public String ADD_SERVER_SUCCESS, ADD_SERVER_FAILED;
public String REMOVE_SERVER_SUCCESS, REMOVE_SERVER_FAILED;
public BlacklistSection() {
super("blacklist");
}
@Override
public void load() {
super.load();
CLEAR = new ConfigSectionHelper<String>(this, "clear", "&aList has been cleared!").getOrSet();
CLEAR_CONFIRM = new ConfigSectionHelper<String>(this, "clear-confirmation", "&4Warning! &7This command will &cclear the entire list&7! &7Repeat the &esame command &7to confirm this action.").getOrSet();
LIST_MESSAGE = new ConfigSectionHelper<String>(this, "list.message", "&7Listed commands (&f%size%&7)&8: &f%commands%").getOrSet();
LIST_SPLITTER = new ConfigSectionHelper<String>(this, "list.splitter", "&7, &f").getOrSet();
ADD_SUCCESS = new ConfigSectionHelper<String>(this, "add.success", "&aSuccessfully added %command% into the list!").getOrSet();
ADD_FAILED = new ConfigSectionHelper<String>(this, "add.failed", "&c%command% is already in the list!").getOrSet();
REMOVE_SUCCESS = new ConfigSectionHelper<String>(this, "remove.success", "&aSuccessfully removed %command% from the list!").getOrSet();
REMOVE_FAILED = new ConfigSectionHelper<String>(this, "remove.failed", "&c%command% is not listed!").getOrSet();
if(!Reflection.isProxyServer()) return;
CLEAR_SERVER = new ConfigSectionHelper<String>(this, "clear-server", "&aList has been cleared!").getOrSet();
CLEAR_SERVER_CONFIRM = new ConfigSectionHelper<String>(this, "clear-confirmation-server", "&4Warning! &7This command will &cclear the entire list of this server&7! &7Repeat the &esame command &7to confirm this action.").getOrSet();
CLEAR_SERVER_NOT_FOUND = new ConfigSectionHelper<String>(this, "clear-server-not-found", "&cThe server %server% does not have any commands!").getOrSet();
LIST_SERVER_MESSAGE = new ConfigSectionHelper<String>(this, "list.message-server", "&7Listed commands of %server% (&f%size%&7)&8: &f%commands%").getOrSet();
LIST_SERVER_SPLITTER = new ConfigSectionHelper<String>(this, "list.splitter-server", "&7, &f").getOrSet();
ADD_SERVER_SUCCESS = new ConfigSectionHelper<String>(this, "add.success-server", "&aSuccessfully added %command% into the list of %server%!").getOrSet();
ADD_SERVER_FAILED = new ConfigSectionHelper<String>(this, "add.failed-server", "&c%command% is already in the list of %server%!").getOrSet();
REMOVE_SERVER_SUCCESS = new ConfigSectionHelper<String>(this, "remove.success-server", "&aSuccessfully removed %command% from the list of %server%!").getOrSet();
REMOVE_SERVER_FAILED = new ConfigSectionHelper<String>(this, "remove.failed-server", "&c%command% is not the list of %server%!").getOrSet();
}
}
@@ -1,19 +0,0 @@
package de.rayzs.pat.api.storage.config.messages;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
public class CommandFailedSection extends ConfigStorage {
public String MESSAGE;
public CommandFailedSection() {
super("command-failed");
}
@Override
public void load() {
super.load();
MESSAGE = new ConfigSectionHelper<String>(this, null, "&cFailed to execute this command! Use \"/pat\" to see all available commands.").getOrSet();
}
}
@@ -1,25 +0,0 @@
package de.rayzs.pat.api.storage.config.messages;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.utils.configuration.helper.MultipleMessagesHelper;
public class ConvertSection extends ConfigStorage {
public MultipleMessagesHelper MESSAGE;
public ConvertSection() {
super("convert");
}
public String INVALID_CONVERTER, SUCCESS;
@Override
public void load() {
super.load();
INVALID_CONVERTER = new ConfigSectionHelper<String>(this, "converter-not-found", "&cConverter or necessary files could not be found!").getOrSet();
SUCCESS = new ConfigSectionHelper<String>(this, "success", "&aSuccessfully converted &e%converter% &ainto the PAT storage.yml!").getOrSet();
}
}
@@ -1,31 +0,0 @@
package de.rayzs.pat.api.storage.config.messages;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.Reflection;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.utils.configuration.helper.MultipleMessagesHelper;
public class ExtractSection extends ConfigStorage {
public MultipleMessagesHelper MESSAGE;
public ExtractSection() {
super("extract");
}
public String USAGE, PLUGIN_NOT_FOUND, SUCCESS;
@Override
public void load() {
super.load();
if (Reflection.isProxyServer()) {
return;
}
USAGE = new ConfigSectionHelper<String>(this, "usage", "&7Usage: &f/pat extract (plugin) <option> &7or &f(group) <option>").getOrSet();
PLUGIN_NOT_FOUND = new ConfigSectionHelper<String>(this, "plugin-not-found", "&cPlugin %plugin% not found!").getOrSet();
SUCCESS = new ConfigSectionHelper<String>(this, "success", "&aSuccessfully extracted &e%amount% &anew commands from %plugin%!").getOrSet();
}
}
@@ -1,82 +0,0 @@
package de.rayzs.pat.api.storage.config.messages;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.Reflection;
public class GroupSection extends ConfigStorage {
public String CREATE, ALREADY_EXIST, DOES_NOT_EXIST, DELETE, DELETE_CONFIRM, CREATE_SERVER, ALREADY_SERVER_EXIST, DOES_NOT_EXIST_SERVER, DELETE_SERVER, DELETE_SERVER_CONFIRM;
public String CLEAR, CLEAR_CONFIRM, CLEAR_SERVER, CLEAR_SERVER_CONFIRM;
public String PRIORITY_SUCCESS, PRIORITY_FAILED;
public String LIST_MESSAGE, LIST_SPLITTER, LIST_SERVER_MESSAGE, LIST_SERVER_SPLITTER;
public String LIST_GROUP_MESSAGE, LIST_GROUP_SPLITTER, LIST_GROUP_SERVER_MESSAGE, LIST_GROUP_SERVER_SPLITTER;
public String LIST_PRIORITY_MESSAGE, LIST_PRIORITY_SPLITTER, LIST_PRIORITY_GROUPS;
public String ADD_SUCCESS, ADD_FAILED;
public String REMOVE_SUCCESS, REMOVE_FAILED;
public String ADD_SERVER_SUCCESS, ADD_SERVER_FAILED;
public String REMOVE_SERVER_SUCCESS, REMOVE_SERVER_FAILED;
public GroupSection() {
super("group");
}
@Override
public void load() {
super.load();
CREATE = new ConfigSectionHelper<String>(this, "create", "&aGroup %group% has been created!").getOrSet();
ALREADY_EXIST = new ConfigSectionHelper<String>(this, "already-exist", "&cGroup %group% already exist!").getOrSet();
DOES_NOT_EXIST = new ConfigSectionHelper<String>(this, "does-not-exist", "&cGroup %group% does not exist!").getOrSet();
DELETE = new ConfigSectionHelper<String>(this, "delete", "&cGroup %group% has been deleted!").getOrSet();
DELETE_CONFIRM = new ConfigSectionHelper<String>(this, "delete-confirmation", "&4Warning! &7This command will &cdelete the group with the whole list&7 of this group! &7Repeat the &esame command &7to confirm this action.").getOrSet();
CLEAR = new ConfigSectionHelper<String>(this, "clear", "&aList of group %group% has been cleared!").getOrSet();
CLEAR_CONFIRM = new ConfigSectionHelper<String>(this, "clear-confirmation", "&4Warning! &7This command will &cclear the entire list&7 of this group! &7Repeat the &esame command &7to confirm this action.").getOrSet();
PRIORITY_SUCCESS = new ConfigSectionHelper<String>(this, "priority.success", "&aSuccessfully set the priority of group &e%group% &ato &e%priority%&a!").getOrSet();
PRIORITY_FAILED = new ConfigSectionHelper<String>(this, "priority.failed", "&cInvalid priority! Please choose a number which is greater than 0.").getOrSet();
LIST_MESSAGE = new ConfigSectionHelper<String>(this, "list.message", "&7Listed commands of group %group% (&f%size%&7)&8: &f%commands%").getOrSet();
LIST_SPLITTER = new ConfigSectionHelper<String>(this, "list.splitter", "&7, &f").getOrSet();
LIST_PRIORITY_MESSAGE = new ConfigSectionHelper<String>(this, "list-priorities.message", "&7List of all group priorities (&f%size%&7)&8: &f%groups%").getOrSet();
LIST_PRIORITY_SPLITTER = new ConfigSectionHelper<String>(this, "list-priorities.splitter", "\\n").getOrSet();
LIST_PRIORITY_GROUPS = new ConfigSectionHelper<String>(this, "list-priorities.group", "&8- &e%priority%&8: &e%group%").getOrSet();
LIST_GROUP_MESSAGE = new ConfigSectionHelper<String>(this, "list-groups.message", "&7All groups (&f%size%&7)&8: &f%groups%").getOrSet();
LIST_GROUP_SPLITTER = new ConfigSectionHelper<String>(this, "list-groups.splitter", "&7, &f").getOrSet();
ADD_SUCCESS = new ConfigSectionHelper<String>(this, "add.success", "&aSuccessfully added %command% into the list of group %group%!").getOrSet();
ADD_FAILED = new ConfigSectionHelper<String>(this, "add.failed", "&c%command% is already in the list of group %group%!").getOrSet();
REMOVE_SUCCESS = new ConfigSectionHelper<String>(this, "remove.success", "&aSuccessfully removed %command% from the list of group %group%!").getOrSet();
REMOVE_FAILED = new ConfigSectionHelper<String>(this, "remove.failed", "&c%command% is not listed in the group %group%!").getOrSet();
if(!Reflection.isProxyServer()) return;
CREATE_SERVER = new ConfigSectionHelper<String>(this, "create-server", "&aGroup %group% for %server% has been created!").getOrSet();
ALREADY_SERVER_EXIST = new ConfigSectionHelper<String>(this, "already-exist-server", "&cGroup %group% for %server% already exist!").getOrSet();
DOES_NOT_EXIST_SERVER = new ConfigSectionHelper<String>(this, "does-not-exist-server", "&cGroup %group% of %server% does not exist!").getOrSet();
DELETE_SERVER = new ConfigSectionHelper<String>(this, "delete-server", "&cGroup %group% of %server% has been deleted!").getOrSet();
DELETE_SERVER_CONFIRM = new ConfigSectionHelper<String>(this, "delete-confirmation-server", "&4Warning! &7This command will &cdelete the group of the server %server% with the whole list&7 of this group! &7Repeat the &esame command &7to confirm this action.").getOrSet();
CLEAR_SERVER = new ConfigSectionHelper<String>(this, "clear-server", "&aList of group %group% from %server% has been cleared!").getOrSet();
CLEAR_SERVER_CONFIRM = new ConfigSectionHelper<String>(this, "clear-confirmation-server", "&4Warning! &7This command will &cclear the entire list&7 of this group for %server%! &7Repeat the &esame command &7to confirm this action.").getOrSet();
LIST_SERVER_MESSAGE = new ConfigSectionHelper<String>(this, "list.message-server", "&7Listed commands of group %group% from %server% (&f%size%&7)&8: &f%commands%").getOrSet();
LIST_SERVER_SPLITTER = new ConfigSectionHelper<String>(this, "list.splitter-server", "&7, &f").getOrSet();
LIST_GROUP_SERVER_MESSAGE = new ConfigSectionHelper<String>(this, "list-groups.message-server", "&7All groups from %server% (&f%size%&7)&8: &f%groups%").getOrSet();
LIST_GROUP_SERVER_SPLITTER = new ConfigSectionHelper<String>(this, "list-groups.splitter-server", "&7, &f").getOrSet();
ADD_SERVER_SUCCESS = new ConfigSectionHelper<String>(this, "add.success-server", "&aSuccessfully added %command% into the list of group %group% for %server%!").getOrSet();
ADD_SERVER_FAILED = new ConfigSectionHelper<String>(this, "add.failed-server", "&c%command% is already in the list of group %group% of %server%!").getOrSet();
REMOVE_SERVER_SUCCESS = new ConfigSectionHelper<String>(this, "remove.success-server", "&aSuccessfully removed %command% from the list of group %group% from %server%!").getOrSet();
REMOVE_SERVER_FAILED = new ConfigSectionHelper<String>(this, "remove.failed-server", "&c%command% is not listed in the group %group% of %server%!").getOrSet();
}
}
@@ -1,65 +0,0 @@
package de.rayzs.pat.api.storage.config.messages;
import de.rayzs.pat.utils.configuration.helper.MultipleMessagesHelper;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.Reflection;
import java.util.Arrays;
public class HelpSection extends ConfigStorage {
public MultipleMessagesHelper MESSAGE;
public HelpSection() {
super("help");
}
@Override
public void load() {
super.load();
MESSAGE = new MultipleMessagesHelper(this, null, Reflection.isProxyServer() ?
Arrays.asList(
"&7Available commands are: &f/%label%&7..."
, "&7Format: &8<optional> (required)"
, "&f reload &7to reload the plugin"
, "&f notify &7to get alerted"
, "&f info &7to get a few information"
, "&f postdebug &7to post the PAT logs"
, "&f update <player> &7to update player(s) permissions"
, "&f perms <player> &7to check a player's permissions"
, "&f extract (plugin) &7to extract all plugin commands"
, "&f convert (plugin) &7converts into a PAT storage.yml"
, "&f creategroup (group) &7Create a group"
, "&f deletegroup (group) &7Delete a group"
, "&f setpriority (group) (priority) &7to set the priority"
, "&f list &8(optional: group) &7to see all listed commands"
, "&f listgroups &7List all groups"
, "&f listpriorities &7to list all group priorities"
, "&f add/rem (command) &8<group> &7to manage the list"
, "&f clear &8<group> &7to clear the list")
:
Arrays.asList(
"&7Available commands are: &f/%label%&7..."
, "&7Format: &8<optional> (required)"
, "&f reload &7to reload the plugin"
, "&f notify &7to get alerted"
, "&f info &7to get a few information"
, "&f postdebug &7to post the PAT logs"
, "&f update <player> &7to update player(s) permissions"
, "&f perms <player> &7to check a player's permissions"
, "&f extract (plugin) &7to extract all plugin commands"
, "&f creategroup (group) &7Create a group"
, "&f deletegroup (group) &7Delete a group"
, "&f setpriority (group) (priority) &7to set the priority"
, "&f list &8<group> &7to see all listed commands"
, "&f listgroups &8<server> &7List all groups"
, "&f listpriorities &7to list all group priorities"
, "&f add/rem (command) &8<group> &7to manage the list"
, "&f clear &8<group> &7to clear the list"
, "&7 For a specific server:"
, "&f serv list (server) &8<group>"
, "&f serv add/rem (server) (command) &8<group>"
, "&f serv clear (server) &8<group>"
));
}
}
@@ -1,43 +0,0 @@
package de.rayzs.pat.api.storage.config.messages;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.Reflection;
import de.rayzs.pat.utils.configuration.helper.*;
import java.util.Arrays;
public class InfoSection extends ConfigStorage {
public String VERSION_OUTDATED, VERSION_UPDATED, SYNC_TIME, SYNC_DISABLED, SYNC_WAITING;
public MultipleMessagesHelper MESSAGE;
public InfoSection() {
super("info");
}
@Override
public void load() {
super.load();
VERSION_UPDATED = new ConfigSectionHelper<String>(this, "version.updated", "&aLatest version").getOrSet();
VERSION_OUTDATED = new ConfigSectionHelper<String>(this, "version.outdated", "&cOutdated (%newest_version%)").getOrSet();
SYNC_TIME = new ConfigSectionHelper<String>(this, "proxy-sync.time", "&e%time%").getOrSet();
if (!Reflection.isProxyServer()) {
SYNC_WAITING = new ConfigSectionHelper<String>(this, "proxy-sync.waiting", "&cWaiting to establish connection...").getOrSet();
}
SYNC_DISABLED = new ConfigSectionHelper<String>(this, "proxy-sync.disabled", "&cDisabled").getOrSet();
MESSAGE = new MultipleMessagesHelper(this, "message",
Arrays.asList(
"&7Necessary information about &fPAT&8:"
, "&7 Version: &e%current_version%"
, "&7 Status: %version_status%"
, "&7 Last sync with proxy: &e%sync_time%"
, "&7 Last received alive packet: %last_alive_response%"
, "&7 Proxy sync-token: &e%token%"
, "&7 Proxy-received server name: &e%sync_server_name%"
)
);
}
}
@@ -1,19 +0,0 @@
package de.rayzs.pat.api.storage.config.messages;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
public class NoPermissionSection extends ConfigStorage {
public String MESSAGE;
public NoPermissionSection() {
super("no-permissions");
}
@Override
public void load() {
super.load();
MESSAGE = new ConfigSectionHelper<String>(this, null, "&cYou are not allowed to execute this command! Missing permission: &4proantitab.%permission%").getOrSet();
}
}
@@ -1,24 +0,0 @@
package de.rayzs.pat.api.storage.config.messages;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.configuration.helper.*;
import de.rayzs.pat.utils.Reflection;
import java.util.Collections;
public class NotificationSection extends ConfigStorage {
public String ENABLED, DISABLED;
public MultipleMessagesHelper ALERT;
public NotificationSection() {
super("notification");
}
@Override
public void load() {
super.load();
ENABLED = new ConfigSectionHelper<String>(this, "enabled", "&aEnabled notifications").getOrSet();
DISABLED = new ConfigSectionHelper<String>(this, "disabled", "&cDisabled notifications").getOrSet();
ALERT = new MultipleMessagesHelper(this, "alert", Collections.singletonList("&8[&4ALERT&8] &c%player% &8(&7" + (Reflection.isProxyServer() ? "server: &e%server%" : "world: &e%world%") + "&8) &ctried to execute the following blocked command: &4%command%"));
}
}
@@ -1,21 +0,0 @@
package de.rayzs.pat.api.storage.config.messages;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.Reflection;
public class OnlyForProxySection extends ConfigStorage {
public String MESSAGE;
public OnlyForProxySection() {
super("only-for-proxy");
}
@Override
public void load() {
super.load();
if(Reflection.isProxyServer()) return;
MESSAGE = new ConfigSectionHelper<String>(this, null, "&cThis command works on Bungeecord/Velocity servers only!").getOrSet();
}
}
@@ -1,21 +0,0 @@
package de.rayzs.pat.api.storage.config.messages;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.configuration.helper.*;
public class PermsCheckSection extends ConfigStorage {
public String MESSAGE, PLAYER_MISSING, PLAYER_NOT_ONLINE;
public PermsCheckSection() {
super("perms-check");
}
@Override
public void load() {
super.load();
MESSAGE = new ConfigSectionHelper<String>(this, "message", "&7All of &e%player%'s &7PAT-related permission: &e%permissions%").getOrSet();
PLAYER_MISSING = new ConfigSectionHelper<String>(this, "player-is-missing", "&cPlease specify the player whose permission you want to check.").getOrSet();
PLAYER_NOT_ONLINE = new ConfigSectionHelper<String>(this, "player-not-online", "&c%player% is not online!").getOrSet();
}
}
@@ -1,20 +0,0 @@
package de.rayzs.pat.api.storage.config.messages;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
public class PostDebugSection extends ConfigStorage {
public String SUCCESS, FAILED;
public PostDebugSection() {
super("post-debug");
}
@Override
public void load() {
super.load();
SUCCESS = new ConfigSectionHelper<String>(this, "success", "&aSuccessfully uploaded debug logs: &e%link% &8(<click:open_url:%link%><gray>CLICK</click>&8)").getOrSet();
FAILED = new ConfigSectionHelper<String>(this, "failed", "&cFailed to upload debug logs!").getOrSet();
}
}
@@ -1,19 +0,0 @@
package de.rayzs.pat.api.storage.config.messages;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
public class PrefixSection extends ConfigStorage {
public String PREFIX;
public PrefixSection() {
super("prefix");
}
@Override
public void load() {
super.load();
PREFIX = new ConfigSectionHelper<String>(this, null, "&8[&4ProAntiTab&8]").getOrSet();
}
}
@@ -1,20 +0,0 @@
package de.rayzs.pat.api.storage.config.messages;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
public class ReloadSection extends ConfigStorage {
public String LOADING, DONE;
public ReloadSection() {
super("reload");
}
@Override
public void load() {
super.load();
LOADING = new ConfigSectionHelper<String>(this, "loading", "&eReloading all configuration files...").getOrSet();
DONE = new ConfigSectionHelper<String>(this, "done", "&aSuccessfully reloaded all configuration files!").getOrSet();
}
}
@@ -1,30 +0,0 @@
package de.rayzs.pat.api.storage.config.messages;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.Reflection;
public class ServerListSection extends ConfigStorage {
public String SERVER_DOES_NOT_EXIST, GROUP_DOES_NOT_EXIST;
public String LIST_SERVER_MESSAGE, LIST_SERVER_SPLITTER, LIST_GROUP_MESSAGE, LIST_GROUP_SPLITTER;
public ServerListSection() {
super("server-list");
}
@Override
public void load() {
super.load();
if(!Reflection.isProxyServer()) return;
SERVER_DOES_NOT_EXIST = new ConfigSectionHelper<String>(this, "server-not-found", "&cThe server %server% does not have any commands!").getOrSet();
GROUP_DOES_NOT_EXIST = new ConfigSectionHelper<String>(this, "group-does-not-exist", "&cGroup %group% does not exist for %server%!").getOrSet();
LIST_SERVER_MESSAGE = new ConfigSectionHelper<String>(this, "list.server.message", "&7Listed commands of %server% (&f%size%&7)&8: &f%commands%").getOrSet();
LIST_SERVER_SPLITTER = new ConfigSectionHelper<String>(this, "list.server.splitter", "&7, &f").getOrSet();
LIST_GROUP_MESSAGE = new ConfigSectionHelper<String>(this, "list.group.message", "&7Listed commands of %group% from %server% (&f%size%&7)&8: &f%commands%").getOrSet();
LIST_GROUP_SPLITTER = new ConfigSectionHelper<String>(this, "list.group.splitter", "&7, &f").getOrSet();
}
}
@@ -1,35 +0,0 @@
package de.rayzs.pat.api.storage.config.messages;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.configuration.helper.*;
import de.rayzs.pat.utils.Reflection;
import java.util.Arrays;
public class StatsSection extends ConfigStorage {
public String NO_SERVER, SPLITTER, SERVER;
public MultipleMessagesHelper STATISTIC;
public StatsSection() {
super("stats");
}
@Override
public void load() {
super.load();
if (!Reflection.isProxyServer()) {
return;
}
NO_SERVER = new ConfigSectionHelper<String>(this, "no-server", "&cNone!").getOrSet();
SPLITTER = new ConfigSectionHelper<String>(this, "message.splitter", "&7, ").getOrSet();
SERVER = new ConfigSectionHelper<String>(this, "message.server", "&f%servername% &8(&a%last_alive_response% &8/ &2%updated%&8)").getOrSet();
STATISTIC = new MultipleMessagesHelper(this, "message.statistic", Arrays.asList(
"&7Format: &eserver (last alive packet / last sync packet)",
"&7Last sync sent to &f%server_count% &7server(s) &e%last_sync_time% &7ago:",
"&7Sent to servers: &f%servers%"
));
}
}
@@ -1,21 +0,0 @@
package de.rayzs.pat.api.storage.config.messages;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
public class UpdatePermissionsSection extends ConfigStorage {
public String UPDATE_ALL, UPDATE_SPECIFIC, PLAYER_NOT_ONLINE;
public UpdatePermissionsSection() {
super("update-permissions");
}
@Override
public void load() {
super.load();
UPDATE_ALL = new ConfigSectionHelper<String>(this, "all-players", "&aUpdated permissions!").getOrSet();
UPDATE_SPECIFIC = new ConfigSectionHelper<String>(this, "specific-player", "&aUpdated %target%'s permissions!").getOrSet();
PLAYER_NOT_ONLINE = new ConfigSectionHelper<String>(this, "player-not-online", "&c%target% is not online!").getOrSet();
}
}
@@ -1,19 +0,0 @@
package de.rayzs.pat.api.storage.config.settings;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
public class AllowGroupOverrulingSection extends ConfigStorage {
public boolean ENABLED;
public AllowGroupOverrulingSection() {
super("allow-group-overruling");
}
@Override
public void load() {
super.load();
ENABLED = new ConfigSectionHelper<Boolean>(this, null, false).getOrSet();
}
}
@@ -1,28 +0,0 @@
package de.rayzs.pat.api.storage.config.settings;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.Reflection;
import de.rayzs.pat.utils.StringUtils;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
public class AutoLowercaseCommandsSection extends ConfigStorage {
public boolean ENABLED;
public AutoLowercaseCommandsSection() {
super("auto-lowercase-commands");
}
@Override
public void load() {
super.load();
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
}
public boolean isCommand(String command) {
if(!ENABLED) return false;
return !StringUtils.isLowercased(command);
}
}
@@ -1,22 +0,0 @@
package de.rayzs.pat.api.storage.config.settings;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.utils.configuration.helper.MultipleMessagesHelper;
import java.util.Collections;
public class BaseCommandCaseSensitiveSection extends ConfigStorage {
public boolean ENABLED;
public BaseCommandCaseSensitiveSection() {
super("base-command-case-sensitive");
}
@Override
public void load() {
super.load();
ENABLED = new ConfigSectionHelper<Boolean>(this, null, true).getOrSet();
}
}
@@ -1,39 +0,0 @@
package de.rayzs.pat.api.storage.config.settings;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.StringUtils;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.utils.permission.PermissionUtil;
import de.rayzs.pat.utils.sender.CommandSender;
public class BlockNamespaceCommandsSection extends ConfigStorage {
public boolean ENABLED, ALWAYS_BLOCK_COMMAND;
public BlockNamespaceCommandsSection() {
super("block-namespace-commands");
}
@Override
public void load() {
super.load();
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
ALWAYS_BLOCK_COMMAND = new ConfigSectionHelper<Boolean>(this, "always-block-command", true).getOrSet();
}
public boolean doesAlwaysBlock(String command) {
return ALWAYS_BLOCK_COMMAND && isCommand(command);
}
public boolean isCommand(String command) {
if (!ENABLED) {
return false;
}
return StringUtils.getFirstArg(command).contains(":");
}
public boolean doesBypass(CommandSender sender) {
return !ENABLED || PermissionUtil.hasPermission(sender, "namespace");
}
}
@@ -1,23 +0,0 @@
package de.rayzs.pat.api.storage.config.settings;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.configuration.helper.*;
import java.util.Collections;
public class CancelCommandSection extends ConfigStorage {
public boolean ENABLED;
public MultipleMessagesHelper BASE_COMMAND_RESPONSE, SUB_COMMAND_RESPONSE;
public CancelCommandSection() {
super("cancel-blocked-commands");
}
@Override
public void load() {
super.load();
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
BASE_COMMAND_RESPONSE = new MultipleMessagesHelper(this, "base-command-message", Collections.singletonList("&cThe command %command% is blocked!"));
SUB_COMMAND_RESPONSE = new MultipleMessagesHelper(this, "sub-command-message", Collections.singletonList("&cThis sub-argument is blocked!"));
}
}
@@ -1,38 +0,0 @@
package de.rayzs.pat.api.storage.config.settings;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.configuration.helper.*;
import java.util.Arrays;
public class CustomBrandSection extends ConfigStorage {
public boolean ENABLED;
public int REPEAT_DELAY;
public MultipleMessagesHelper BRANDS;
public CustomBrandSection() {
super("custom-server-brand");
}
@Override
public void load() {
super.load();
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", false).getOrSet();
REPEAT_DELAY = new ConfigSectionHelper<Integer>(this, "repeat-delay", 3).getOrSet();
BRANDS = new MultipleMessagesHelper(this, "brands", Arrays.asList(
"&f&lP&froAntiTab |",
"&fP&lr&foAntiTab /",
"&fPr&lo&fAntiTab -",
"&fPro&lA&fntiTab |",
"&fProA&ln&ftiTab \\",
"&fProAn&lt&fiTab |",
"&fProAnt&li&fTab /",
"&fProAnti&lT&fab -",
"&fProAnti&lT&fab \\",
"&fProAntiT&la&fb |",
"&fProAntiTa&lb&f /",
"&fProAntiTab -",
"&fProAntiTab \\"
));
}
}
@@ -1,43 +0,0 @@
package de.rayzs.pat.api.storage.config.settings;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.StringUtils;
import de.rayzs.pat.utils.configuration.helper.*;
import java.util.*;
public class CustomPluginsSection extends ConfigStorage {
public boolean ENABLED, ALWAYS_TAB_COMPLETABLE;
public MultipleMessagesHelper MESSAGE, COMMANDS;
public CustomPluginsSection() {
super("custom-plugins");
}
@Override
public void load() {
super.load();
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
ALWAYS_TAB_COMPLETABLE = new ConfigSectionHelper<Boolean>(this, "always-tab-completable", false).getOrSet();
COMMANDS = new MultipleMessagesHelper(this, "commands", Arrays.asList("pl", "plugins"));
MESSAGE = new MultipleMessagesHelper(this, "message", Collections.singletonList("&fPlugins (0):"));
}
public boolean isTabCompletable(String command) {
if (!isCommand(command))
return false;
return ALWAYS_TAB_COMPLETABLE;
}
public boolean isCommand(String command) {
if(!ENABLED) return false;
command = StringUtils.getFirstArg(command);
for (String currentCommand : COMMANDS.getLines()) {
if (currentCommand.equalsIgnoreCase(command))
return true;
}
return false;
}
}
@@ -1,54 +0,0 @@
package de.rayzs.pat.api.storage.config.settings;
import de.rayzs.pat.plugin.logger.Logger;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.Reflection;
import de.rayzs.pat.utils.configuration.helper.MultipleMessagesHelper;
import java.util.Arrays;
public class CustomProtocolPingSection extends ConfigStorage {
public boolean ENABLED, ALWAYS_SHOW, HIDE_PLAYERS, USE_EXTEND_AS_MAX_COUNT, USE_CUSTOM_PLAYERLIST, USE_CENTER_VARIABLE;
public String PROTOCOL;
public MultipleMessagesHelper PLAYERLIST;
public int EXTEND_COUNT;
public CustomProtocolPingSection() {
super("custom-protocol-ping");
}
@Override
public void load() {
super.load();
if (!Reflection.isProxyServer() && (!Reflection.isPaper() || Reflection.isBefore(1, 12)))
return;
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
ALWAYS_SHOW = new ConfigSectionHelper<Boolean>(this, "always-show", Reflection.isProxyServer() || Reflection.isPaper()).getOrSet();
USE_EXTEND_AS_MAX_COUNT = new ConfigSectionHelper<Boolean>(this, "use-as-maxplayers", false).getOrSet();
PROTOCOL = new ConfigSectionHelper<String>(this, "protocol", "&f&lProAntiTab &7(&a%online%&7/&c%max%&7)").getOrSet();
EXTEND_COUNT = new ConfigSectionHelper<Integer>(this, "extend-online-count", 1).getOrSet();
HIDE_PLAYERS = new ConfigSectionHelper<Boolean>(this, "hide-players", true).getOrSet();
USE_CUSTOM_PLAYERLIST = new ConfigSectionHelper<Boolean>(this, "custom-playerlist.enabled", false).getOrSet();
PLAYERLIST = new MultipleMessagesHelper(this, "custom-playerlist.list", Arrays.asList(
"&8> &7Online players: &f%online%&7/&c%max%",
"&8> &7Using &fProAntiTab"
));
USE_CENTER_VARIABLE = PLAYERLIST.getLines().stream().anyMatch(l -> l.startsWith("%center%"));
if (HIDE_PLAYERS && USE_CUSTOM_PLAYERLIST) {
Logger.warning("You can't use both 'hide-players' and 'custom-playerlist' at the same time! (Section: custom-protocol-ping)");
Logger.warning("You gotta choose what feature from those two you want to use.");
Logger.warning("In order to avoid any problems, the 'custom-playerlist' feature has been temporarily disabled.");
}
}
}
@@ -1,25 +0,0 @@
package de.rayzs.pat.api.storage.config.settings;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.configuration.helper.*;
import de.rayzs.pat.api.storage.Storage;
import java.util.Collections;
public class CustomUnknownCommandSection extends ConfigStorage {
public boolean ENABLED;
public MultipleMessagesHelper MESSAGE;
public CustomUnknownCommandSection() {
super("custom-unknown-command");
}
@Override
public void load() {
super.load();
if(Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED) return;
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
MESSAGE = new MultipleMessagesHelper(this, "message", Collections.singletonList("&cThis command does not exist!"));
}
}
@@ -1,43 +0,0 @@
package de.rayzs.pat.api.storage.config.settings;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.configuration.helper.*;
import de.rayzs.pat.utils.StringUtils;
import java.util.*;
public class CustomVersionSection extends ConfigStorage {
public boolean ENABLED, ALWAYS_TAB_COMPLETABLE;
public MultipleMessagesHelper MESSAGE, COMMANDS;
public CustomVersionSection() {
super("custom-version");
}
@Override
public void load() {
super.load();
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
ALWAYS_TAB_COMPLETABLE = new ConfigSectionHelper<Boolean>(this, "always-tab-completable", false).getOrSet();
COMMANDS = new MultipleMessagesHelper(this, "commands", Arrays.asList("icanhasbukkit", "about", "ver", "version"));
MESSAGE = new MultipleMessagesHelper(this, "message", Collections.singletonList("&fThis server is running CraftBukkit version git-NasaSpigot-294 (MC: X)"));
}
public boolean isTabCompletable(String command) {
if (!isCommand(command))
return false;
return ALWAYS_TAB_COMPLETABLE;
}
public boolean isCommand(String command) {
if(!ENABLED) return false;
command = StringUtils.getFirstArg(command);
for (String currentCommand : COMMANDS.getLines()) {
if (currentCommand.equalsIgnoreCase(command))
return true;
}
return false;
}
}
@@ -1,26 +0,0 @@
package de.rayzs.pat.api.storage.config.settings;
import de.rayzs.pat.utils.Reflection;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
public class DisableSyncSection extends ConfigStorage {
public boolean ENABLED;
public DisableSyncSection() {
super("disable-sync");
}
@Override
public void load() {
super.load();
if (!Reflection.isProxyServer()) {
return;
}
ENABLED = new ConfigSectionHelper<Boolean>(this, null, false).getOrSet();
}
}
@@ -1,22 +0,0 @@
package de.rayzs.pat.api.storage.config.settings;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.Reflection;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
public class ForwardConsoleNotificationAlertsSection extends ConfigStorage {
public boolean ENABLED;
public ForwardConsoleNotificationAlertsSection() {
super("forward-console-notification-alerts");
}
@Override
public void load() {
super.load();
if(!Reflection.isProxyServer()) return;
ENABLED = new ConfigSectionHelper<Boolean>(this, null, false).getOrSet();
}
}
@@ -1,33 +0,0 @@
package de.rayzs.pat.api.storage.config.settings;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.Reflection;
public class HandleThroughProxySection extends ConfigStorage {
public boolean ENABLED, ALLOW_P2B_ACTIONS;
public boolean LOAD_FROM_ENV;
public String ENV_NAME;
public String TOKEN;
public HandleThroughProxySection() {
super("handle-through-proxy");
}
@Override
public void load() {
super.load();
if (Reflection.isProxyServer()) return;
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", false).getOrSet();
TOKEN = new ConfigSectionHelper<String>(this, "token", "insert-token-of-proxy-here").getOrSet();
ALLOW_P2B_ACTIONS = new ConfigSectionHelper<Boolean>(this, "allow-p2b-actions", false).getOrSet();
LOAD_FROM_ENV = new ConfigSectionHelper<Boolean>(this, "load-from-env.enabled", false).getOrSet();
ENV_NAME = new ConfigSectionHelper<String>(this, "load-from-env.name", "PAT_TOKEN").getOrSet();
}
}
@@ -1,23 +0,0 @@
package de.rayzs.pat.api.storage.config.settings;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
public class InjectionFailedSection extends ConfigStorage {
public boolean ENABLED, SUPPRESS_EXCEPTIONS;
public String KICK_MESSAGE, CONSOLE_MESSAGE;
public InjectionFailedSection() {
super("injection-failed");
}
@Override
public void load() {
super.load();
ENABLED = new ConfigSectionHelper<Boolean>(this, "kick-on-failure", true).getOrSet();
SUPPRESS_EXCEPTIONS = new ConfigSectionHelper<Boolean>(this, "suppress-exceptions", false).getOrSet();
KICK_MESSAGE = new ConfigSectionHelper<String>(this, "kick-message", "&cInjection process failed! Please reconnect.").getOrSet();
CONSOLE_MESSAGE = new ConfigSectionHelper<String>(this, "console-message", "&cInjection process failed! (%player%)").getOrSet();
}
}
@@ -1,32 +0,0 @@
package de.rayzs.pat.api.storage.config.settings;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.configuration.helper.*;
import de.rayzs.pat.utils.StringUtils;
import java.util.Collections;
public class PatchExploitSection extends ConfigStorage {
public boolean ENABLED;
public ConfigSectionHelper<String> ALERT_MESSAGE, KICK_MESSAGE;
public PatchExploitSection() {
super("patch-exploits");
}
@Override
public void load() {
super.load();
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
ALERT_MESSAGE = new ConfigSectionHelper<>(this, "alert-message", "%prefix% &4%player% &ctried to crash/lag the server.");
KICK_MESSAGE = new ConfigSectionHelper(this, "kick-message", "&cFailed to read packet! Please reconnect.");
}
public boolean isMalicious(String text) {
if(!ENABLED) return false;
return text.length() > 256
|| text.contains("nbt")
&& (StringUtils.countMatches('[', text) > 15 || StringUtils.countMatches('{', text) > 25);
}
}
@@ -1,19 +0,0 @@
package de.rayzs.pat.api.storage.config.settings;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
public class TurnBlacklistToWhitelistSection extends ConfigStorage {
public boolean ENABLED;
public TurnBlacklistToWhitelistSection() {
super("turn-blacklist-to-whitelist");
}
@Override
public void load() {
super.load();
ENABLED = new ConfigSectionHelper<Boolean>(this, null, false).getOrSet();
}
}
@@ -1,24 +0,0 @@
package de.rayzs.pat.api.storage.config.settings;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.Reflection;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
public class UpdateGroupsPerServerSection extends ConfigStorage {
public boolean ENABLED = false;
public UpdateGroupsPerServerSection() {
super("update-groups-per-server");
}
@Override
public void load() {
super.load();
if (!Reflection.isProxyServer())
return;
ENABLED = new ConfigSectionHelper<Boolean>(this, null, false).getOrSet();
}
}
@@ -1,24 +0,0 @@
package de.rayzs.pat.api.storage.config.settings;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.Reflection;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
public class UpdateGroupsPerWorldSection extends ConfigStorage {
public boolean ENABLED;
public UpdateGroupsPerWorldSection() {
super("update-groups-per-world");
}
@Override
public void load() {
super.load();
if (Reflection.isProxyServer())
return;
ENABLED = new ConfigSectionHelper<Boolean>(this, null, false).getOrSet();
}
}
@@ -1,30 +0,0 @@
package de.rayzs.pat.api.storage.config.settings;
import de.rayzs.pat.api.storage.storages.ConfigStorage;
import de.rayzs.pat.utils.configuration.helper.*;
import java.util.*;
public class UpdateSection extends ConfigStorage {
public boolean ENABLED, AUTO_UPDATE_CONFIG;
public int PERIOD;
public MultipleMessagesHelper OUTDATED, UPDATED;
public UpdateSection() {
super("updater");
}
@Override
public void load() {
super.load();
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
PERIOD = new ConfigSectionHelper<Integer>(this, "period", 10000).getOrSet();
AUTO_UPDATE_CONFIG = new ConfigSectionHelper<Boolean>(this, "auto-update-config", true).getOrSet();
UPDATED = new MultipleMessagesHelper(this, "updated", Collections.singletonList("&aYou are using the newest version! ^^"));
OUTDATED = new MultipleMessagesHelper(this, "outdated", Arrays.asList(
"&8[&4ProAntiTab&8] &cThere is a new version available! (%newest_version%)",
"&8[&4ProAntiTab&8] &cYou are still using the %current_version%.",
"&8[&4ProAntiTab&8] &cGet the newest version here:",
"&8[&4ProAntiTab&8] &ehttps://www.rayzs.de/products/proantitab/page"));
}
}
@@ -1,25 +0,0 @@
package de.rayzs.pat.api.storage.placeholders.commands.general;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.PlaceholderStorage;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.utils.StringUtils;
import org.bukkit.entity.Player;
public class ListCommandsPlaceholder extends PlaceholderStorage {
public ListCommandsPlaceholder() { super("list_commands"); }
public String SPLITTER;
@Override
public String onRequest(Player player, String param) {
return StringUtils.getStringList(Storage.Blacklist.getBlacklist().getCommands(), SPLITTER);
}
@Override
public void load() {
super.load();
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7, &e").getOrSet();
}
}
@@ -1,25 +0,0 @@
package de.rayzs.pat.api.storage.placeholders.commands.general;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.PlaceholderStorage;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.utils.StringUtils;
import org.bukkit.entity.Player;
public class ListReversedCommandsPlaceholder extends PlaceholderStorage {
public ListReversedCommandsPlaceholder() { super("list_reversed_commands"); }
public String SPLITTER;
@Override
public String onRequest(Player player, String param) {
return StringUtils.getReversedStringList(Storage.Blacklist.getBlacklist().getCommands(), SPLITTER);
}
@Override
public void load() {
super.load();
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7, &e").getOrSet();
}
}
@@ -1,20 +0,0 @@
package de.rayzs.pat.api.storage.placeholders.commands.general;
import de.rayzs.pat.api.storage.storages.PlaceholderStorage;
import de.rayzs.pat.api.storage.Storage;
import org.bukkit.entity.Player;
public class ListSizeCommandsPlaceholder extends PlaceholderStorage {
public ListSizeCommandsPlaceholder() { super("list_size_commands"); }
@Override
public String onRequest(Player player, String param) {
return String.valueOf(Storage.Blacklist.getBlacklist().getCommands().size());
}
@Override
public void load() {
super.load();
}
}
@@ -1,25 +0,0 @@
package de.rayzs.pat.api.storage.placeholders.commands.general;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.PlaceholderStorage;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.utils.StringUtils;
import org.bukkit.entity.Player;
public class ListSortedCommandsPlaceholder extends PlaceholderStorage {
public ListSortedCommandsPlaceholder() { super("list_sorted_commands"); }
public String SPLITTER;
@Override
public String onRequest(Player player, String param) {
return StringUtils.getSortedStringList(Storage.Blacklist.getBlacklist().getCommands(), SPLITTER);
}
@Override
public void load() {
super.load();
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7, &e").getOrSet();
}
}
@@ -1,29 +0,0 @@
package de.rayzs.pat.api.storage.placeholders.commands.group;
import de.rayzs.pat.utils.group.Group;
import de.rayzs.pat.utils.group.GroupManager;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.PlaceholderStorage;
import de.rayzs.pat.utils.StringUtils;
import org.bukkit.entity.Player;
public class ListGroupCommandsPlaceholder extends PlaceholderStorage {
public ListGroupCommandsPlaceholder() { super("list_commands_group_"); }
public String SPLITTER;
@Override
public String onRequest(Player player, String param) {
Group group = GroupManager.getGroupByName(param);
if(group == null) return null;
return StringUtils.getStringList(group.getCommands(), SPLITTER);
}
@Override
public void load() {
super.load();
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7, &e").getOrSet();
}
}
@@ -1,29 +0,0 @@
package de.rayzs.pat.api.storage.placeholders.commands.group;
import de.rayzs.pat.utils.group.Group;
import de.rayzs.pat.utils.group.GroupManager;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.PlaceholderStorage;
import de.rayzs.pat.utils.StringUtils;
import org.bukkit.entity.Player;
public class ListGroupReversedCommandsPlaceholder extends PlaceholderStorage {
public ListGroupReversedCommandsPlaceholder() { super("list_reversed_commands_group_"); }
public String SPLITTER;
@Override
public String onRequest(Player player, String param) {
Group group = GroupManager.getGroupByName(param);
if(group == null) return null;
return StringUtils.getReversedStringList(group.getCommands(), SPLITTER);
}
@Override
public void load() {
super.load();
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7, &e").getOrSet();
}
}
@@ -1,23 +0,0 @@
package de.rayzs.pat.api.storage.placeholders.commands.group;
import de.rayzs.pat.api.storage.storages.PlaceholderStorage;
import de.rayzs.pat.utils.group.Group;
import de.rayzs.pat.utils.group.GroupManager;
import org.bukkit.entity.Player;
public class ListGroupSizeCommandsPlaceholder extends PlaceholderStorage {
public ListGroupSizeCommandsPlaceholder() { super("list_size_commands_group_"); }
@Override
public String onRequest(Player player, String param) {
Group group = GroupManager.getGroupByName(param);
if(group == null) return null;
return String.valueOf(group.getCommands().size());
}
@Override
public void load() {
super.load();
}
}
@@ -1,29 +0,0 @@
package de.rayzs.pat.api.storage.placeholders.commands.group;
import de.rayzs.pat.utils.group.Group;
import de.rayzs.pat.utils.group.GroupManager;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.PlaceholderStorage;
import de.rayzs.pat.utils.StringUtils;
import org.bukkit.entity.Player;
public class ListGroupSortedCommandsPlaceholder extends PlaceholderStorage {
public ListGroupSortedCommandsPlaceholder() { super("list_sorted_commands_group_"); }
public String SPLITTER;
@Override
public String onRequest(Player player, String param) {
Group group = GroupManager.getGroupByName(param);
if(group == null) return null;
return StringUtils.getSortedStringList(group.getCommands(), SPLITTER);
}
@Override
public void load() {
super.load();
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7, &e").getOrSet();
}
}
@@ -1,15 +0,0 @@
package de.rayzs.pat.api.storage.placeholders.general;
import de.rayzs.pat.api.storage.storages.PlaceholderStorage;
import de.rayzs.pat.api.storage.Storage;
import org.bukkit.entity.Player;
public class GeneralCurrentVersionPlaceholder extends PlaceholderStorage {
public GeneralCurrentVersionPlaceholder() { super("general_version_current"); }
@Override
public String onRequest(Player player, String param) {
return Storage.CURRENT_VERSION;
}
}
@@ -1,15 +0,0 @@
package de.rayzs.pat.api.storage.placeholders.general;
import de.rayzs.pat.api.storage.storages.PlaceholderStorage;
import de.rayzs.pat.api.storage.Storage;
import org.bukkit.entity.Player;
public class GeneralNewestVersionPlaceholder extends PlaceholderStorage {
public GeneralNewestVersionPlaceholder() { super("general_version_newest"); }
@Override
public String onRequest(Player player, String param) {
return Storage.NEWER_VERSION;
}
}
@@ -1,16 +0,0 @@
package de.rayzs.pat.api.storage.placeholders.general;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.api.storage.storages.PlaceholderStorage;
import org.bukkit.entity.Player;
public class GeneralPrefixPlaceholder extends PlaceholderStorage {
public GeneralPrefixPlaceholder() { super("general_prefix"); }
@Override
public String onRequest(Player player, String param) {
if (Storage.ConfigSections.Messages.PREFIX == null) return null;
return Storage.ConfigSections.Messages.PREFIX.PREFIX;
}
}
@@ -1,23 +0,0 @@
package de.rayzs.pat.api.storage.placeholders.general;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.PlaceholderStorage;
import org.bukkit.entity.Player;
public class GeneralUserPlaceholder extends PlaceholderStorage {
public GeneralUserPlaceholder() { super("general_user"); }
public String CONSOLE;
@Override
public String onRequest(Player player, String param) {
return player == null ? CONSOLE : player.getName();
}
@Override
public void load() {
super.load();
CONSOLE = new ConfigSectionHelper<String>(this, "console-name", "Server console").getOrSet();
}
}
@@ -1,25 +0,0 @@
package de.rayzs.pat.api.storage.placeholders.groups;
import de.rayzs.pat.utils.group.GroupManager;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.PlaceholderStorage;
import de.rayzs.pat.utils.StringUtils;
import org.bukkit.entity.Player;
public class ListGroupsPlaceholder extends PlaceholderStorage {
public ListGroupsPlaceholder() { super("list_groups"); }
public String SPLITTER;
@Override
public String onRequest(Player player, String param) {
return StringUtils.getStringList(GroupManager.getGroupNames(), SPLITTER);
}
@Override
public void load() {
super.load();
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7, &e").getOrSet();
}
}
@@ -1,25 +0,0 @@
package de.rayzs.pat.api.storage.placeholders.groups;
import de.rayzs.pat.utils.group.GroupManager;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.PlaceholderStorage;
import de.rayzs.pat.utils.StringUtils;
import org.bukkit.entity.Player;
public class ListGroupsReversedPlaceholder extends PlaceholderStorage {
public ListGroupsReversedPlaceholder() { super("list_reversed_groups"); }
public String SPLITTER;
@Override
public String onRequest(Player player, String param) {
return StringUtils.getReversedStringList(GroupManager.getGroupNames(), SPLITTER);
}
@Override
public void load() {
super.load();
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7, &e").getOrSet();
}
}
@@ -1,25 +0,0 @@
package de.rayzs.pat.api.storage.placeholders.groups;
import de.rayzs.pat.utils.group.GroupManager;
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
import de.rayzs.pat.api.storage.storages.PlaceholderStorage;
import de.rayzs.pat.utils.StringUtils;
import org.bukkit.entity.Player;
public class ListGroupsSortedPlaceholder extends PlaceholderStorage {
public ListGroupsSortedPlaceholder() { super("list_sorted_groups"); }
public String SPLITTER;
@Override
public String onRequest(Player player, String param) {
return StringUtils.getSortedStringList(GroupManager.getGroupNames(), SPLITTER);
}
@Override
public void load() {
super.load();
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7, &e").getOrSet();
}
}
@@ -1,20 +0,0 @@
package de.rayzs.pat.api.storage.placeholders.groups;
import de.rayzs.pat.api.storage.storages.PlaceholderStorage;
import de.rayzs.pat.utils.group.GroupManager;
import org.bukkit.entity.Player;
public class ListSizeGroupsPlaceholder extends PlaceholderStorage {
public ListSizeGroupsPlaceholder() { super("list_size_groups"); }
@Override
public String onRequest(Player player, String param) {
return String.valueOf(GroupManager.getGroups().size());
}
@Override
public void load() {
super.load();
}
}
@@ -1,17 +0,0 @@
package de.rayzs.pat.api.storage.placeholders.messages;
import de.rayzs.pat.api.storage.storages.PlaceholderStorage;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.utils.StringUtils;
import org.bukkit.entity.Player;
public class BlockedBaseCommandPlaceholder extends PlaceholderStorage {
public BlockedBaseCommandPlaceholder() { super("message_base_blocked"); }
@Override
public String onRequest(Player player, String param) {
if (Storage.ConfigSections.Settings.CANCEL_COMMAND.BASE_COMMAND_RESPONSE == null) return null;
return StringUtils.getStringList(Storage.ConfigSections.Settings.CANCEL_COMMAND.BASE_COMMAND_RESPONSE.getLines(), "\n");
}
}
@@ -1,17 +0,0 @@
package de.rayzs.pat.api.storage.placeholders.messages;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.api.storage.storages.PlaceholderStorage;
import de.rayzs.pat.utils.StringUtils;
import org.bukkit.entity.Player;
public class BlockedSubCommandPlaceholder extends PlaceholderStorage {
public BlockedSubCommandPlaceholder() { super("message_sub_blocked"); }
@Override
public String onRequest(Player player, String param) {
if (Storage.ConfigSections.Settings.CANCEL_COMMAND.SUB_COMMAND_RESPONSE == null) return null;
return StringUtils.getStringList(Storage.ConfigSections.Settings.CANCEL_COMMAND.SUB_COMMAND_RESPONSE.getLines(), "\n");
}
}
@@ -1,17 +0,0 @@
package de.rayzs.pat.api.storage.placeholders.messages;
import de.rayzs.pat.api.storage.storages.PlaceholderStorage;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.utils.StringUtils;
import org.bukkit.entity.Player;
public class UnknownCommandPlaceholder extends PlaceholderStorage {
public UnknownCommandPlaceholder() { super("message_unknowncommand"); }
@Override
public String onRequest(Player player, String param) {
if (Storage.ConfigSections.Settings.CUSTOM_UNKNOWN_COMMAND.MESSAGE == null) return null;
return StringUtils.getStringList(Storage.ConfigSections.Settings.CUSTOM_UNKNOWN_COMMAND.MESSAGE.getLines(), "\n");
}
}
@@ -1,151 +0,0 @@
package de.rayzs.pat.api.storage.storages;
import de.rayzs.pat.utils.StringUtils;
import de.rayzs.pat.api.storage.*;
import java.io.Serializable;
import java.util.*;
public class BlacklistStorage extends StorageTemplate implements Serializable {
private List<String> commands = new ArrayList<>();
private List<String> hiddenCommands = new ArrayList<>();
public BlacklistStorage(String navigatePath) {
super(Storage.Files.STORAGE, navigatePath);
}
public boolean isListed(String command) {
return isListed(command, false);
}
public boolean isListed(String command, boolean ignoreColons) {
final boolean caseSensitive = Storage.ConfigSections.Settings.BASE_COMMAND_CASE_SENSITIVE.ENABLED;
final boolean turn = Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED;
if (commands == null || command.isEmpty()) {
return false;
}
boolean isNegated = Storage.Blacklist.BlockTypeFetcher.isNegated(command);
if (!isNegated == turn) {
command = StringUtils.getFirstArg(command);
}
for (String listedCommand : hiddenCommands) {
if (listedCommand == null)
continue;
if (ignoreColons) {
command = StringUtils.getFirstArg(command);
if (command.contains(":"))
command = command.substring(command.indexOf(':'));
}
if (!isNegated == turn) {
listedCommand = StringUtils.getFirstArg(listedCommand);
}
if (caseSensitive && listedCommand.equals(command)) {
return true;
} else if (!caseSensitive && listedCommand.equalsIgnoreCase(command)) {
return true;
}
}
return false;
}
public void setList(List<String> commands) {
this.commands = commands;
}
public BlacklistStorage add(String command) {
if (!commands.contains(command)) {
commands.add(command);
hiddenCommands.add(command);
}
return this;
}
public BlacklistStorage remove(String command) {
commands.remove(command);
hiddenCommands.remove(command);
return this;
}
public BlacklistStorage clear() {
commands.clear();
return this;
}
public List<String> getCommands() {
return commands;
}
public List<String> getHiddenCommands() {
return hiddenCommands;
}
@Override
public void save() {
getConfig().setAndSave(getNavigatePath(), commands);
}
@Override
public void load() {
getConfig().reload();
commands = (ArrayList<String>) getConfig().getOrSet(getNavigatePath(), commands);
final List<String> tmpCommands = commands != null ? new ArrayList<>(commands) : new ArrayList<>();
final Set<String> pluginListCommands = new HashSet<>(), negatedPluginListCommands = new HashSet<>();
final String pluginCommandPrefix = "plugin=";
final String negatedPluginCommandPrefix = Storage.Blacklist.BlockType.NEGATE + pluginCommandPrefix;
for (String command : tmpCommands) {
if (command.startsWith(pluginCommandPrefix)) {
pluginListCommands.add(command);
}
if (command.startsWith(negatedPluginCommandPrefix)) {
negatedPluginListCommands.add(command);
}
}
tmpCommands.removeAll(pluginListCommands);
tmpCommands.removeAll(negatedPluginListCommands);
for (String negatedPluginCommand : negatedPluginListCommands) {
negatedPluginCommand = negatedPluginCommand.substring(negatedPluginCommandPrefix.length());
List<String> pluginCommands = Storage.getLoader().getPluginCommands(negatedPluginCommand, false);
for (String pluginCommand : pluginCommands) {
tmpCommands.remove(pluginCommand);
tmpCommands.add(Storage.Blacklist.BlockType.NEGATE + pluginCommand);
}
}
for (String pluginListCommand : pluginListCommands) {
pluginListCommand = pluginListCommand.substring(pluginCommandPrefix.length());
List<String> pluginCommands = Storage.getLoader().getPluginCommands(pluginListCommand, false);
for (String pluginCommand : pluginCommands) {
final String negated = Storage.Blacklist.BlockType.NEGATE + pluginCommand;
if (!commands.contains(negated) && !tmpCommands.contains(negated)) {
tmpCommands.add(pluginCommand);
}
}
}
hiddenCommands = tmpCommands;
}
}
@@ -1,17 +0,0 @@
package de.rayzs.pat.api.storage.storages;
import de.rayzs.pat.api.storage.*;
public class ConfigStorage extends StorageTemplate {
public ConfigStorage(String navigatePath) {
super(Storage.Files.CONFIGURATION, navigatePath);
Storage.ConfigSections.SECTIONS.add(this);
}
@Override
public void save() { getConfig().save(); }
@Override
public void load() { getConfig().reload(); }
}
@@ -1,59 +0,0 @@
package de.rayzs.pat.api.storage.storages;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.api.storage.StorageTemplate;
import de.rayzs.pat.utils.Reflection;
import java.util.ArrayList;
import java.util.List;
public class DisabledServersStorage extends StorageTemplate {
private List<String> servers = new ArrayList<>();
public DisabledServersStorage() {
super(Storage.Files.STORAGE, "disabled-servers");
}
public DisabledServersStorage add(String server) {
server = server.toLowerCase();
if (!servers.contains(server)) {
servers.add(server);
}
return this;
}
public DisabledServersStorage remove(String server) {
server = server.toLowerCase();
servers.remove(server);
return this;
}
public boolean isListed(String server) {
if (servers.isEmpty()) {
return false;
}
return Storage.isServer(server, servers);
}
public boolean isListEmpty() {
return servers.isEmpty();
}
@Override
public void save() { getConfig().save(); }
@Override
public void load() {
if (!Reflection.isProxyServer()) {
return;
}
getConfig().reload();
servers = (ArrayList<String>) getConfig().getOrSet(getNavigatePath(), servers);
}
}
@@ -1,46 +0,0 @@
package de.rayzs.pat.api.storage.storages;
import de.rayzs.pat.utils.Reflection;
import de.rayzs.pat.api.storage.*;
import java.util.*;
public class IgnoredServersStorage extends StorageTemplate {
private List<String> servers = new ArrayList<>();
public IgnoredServersStorage(String navigatePath) {
super(Storage.Files.STORAGE, navigatePath);
}
public IgnoredServersStorage add(String server) {
server = server.toLowerCase();
if(!servers.contains(server))
servers.add(server);
return this;
}
public IgnoredServersStorage remove(String server) {
server = server.toLowerCase();
servers.remove(server);
return this;
}
public boolean isListed(String server) {
if(servers.isEmpty()) return false;
return Storage.isServer(server, servers);
}
public boolean isListEmpty() {
return servers.isEmpty();
}
@Override
public void save() { getConfig().save(); }
@Override
public void load() {
if(!Reflection.isProxyServer()) return;
getConfig().reload();
servers = (ArrayList<String>) getConfig().getOrSet(getNavigatePath(), servers);
}
}
@@ -1,28 +0,0 @@
package de.rayzs.pat.api.storage.storages;
import de.rayzs.pat.api.storage.*;
import org.bukkit.entity.Player;
public abstract class PlaceholderStorage extends StorageTemplate {
private final String request;
public PlaceholderStorage(String request) {
super(Storage.Files.PLACEHOLDERS, request);
this.request = request;
Storage.ConfigSections.PLACEHOLDERS.add(this);
}
@Override
public void save() { getConfig().save(); }
@Override
public void load() { getConfig().reload(); }
public String getRequest() {
return request;
}
public abstract String onRequest(Player player, String param);
}
@@ -1,505 +0,0 @@
package de.rayzs.pat.plugin;
import de.rayzs.pat.plugin.command.commands.ProCommand;
import de.rayzs.pat.plugin.system.communication.cph.impl.BukkitCommunicationHandler;
import de.rayzs.pat.plugin.system.serverbrand.CustomServerBrand;
import de.rayzs.pat.plugin.system.communication.pmc.impl.BukkitPluginMessageClient;
import de.rayzs.pat.plugin.system.converter.StorageConverter;
import de.rayzs.pat.plugin.system.serverbrand.impl.BukkitServerBrand;
import de.rayzs.pat.plugin.command.CommandProcess;
import de.rayzs.pat.plugin.packetanalyzer.bukkit.BukkitPacketAnalyzer;
import de.rayzs.pat.plugin.system.communication.BackendUpdater;
import de.rayzs.pat.plugin.system.subargument.SubArgument;
import de.rayzs.pat.utils.group.Group;
import de.rayzs.pat.utils.hooks.GroupManagerHook;
import de.rayzs.pat.utils.configuration.Configurator;
import de.rayzs.pat.utils.configuration.updater.ConfigUpdater;
import de.rayzs.pat.utils.message.MessageTranslator;
import de.rayzs.pat.utils.permission.PermissionUtil;
import de.rayzs.pat.utils.hooks.ViaVersionHook;
import de.rayzs.pat.plugin.system.communication.Communicator;
import de.rayzs.pat.utils.hooks.LuckPermsHook;
import de.rayzs.pat.plugin.command.impl.BukkitCommand;
import de.rayzs.pat.utils.hooks.PlaceholderHook;
import de.rayzs.pat.plugin.listeners.bukkit.*;
import de.rayzs.pat.utils.group.GroupManager;
import de.rayzs.pat.plugin.metrics.bStats;
import de.rayzs.pat.plugin.logger.Logger;
import de.rayzs.pat.utils.response.ResponseHandler;
import de.rayzs.pat.utils.response.action.ActionHandler;
import de.rayzs.pat.utils.sender.CommandSender;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Entity;
import org.bukkit.permissions.Permission;
import org.bukkit.plugin.java.JavaPlugin;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.utils.scheduler.*;
import org.bukkit.entity.Player;
import java.lang.reflect.Field;
import de.rayzs.pat.utils.*;
import org.bukkit.command.*;
import org.bukkit.plugin.*;
import org.bukkit.Bukkit;
import java.util.*;
import java.util.stream.Collectors;
public class BukkitLoader extends JavaPlugin implements PluginLoader {
private static List<String> commands = new ArrayList<>(),
allowedCommands = new ArrayList<>(),
disallowedCommands = new ArrayList<>();
private static Plugin plugin;
private static java.util.logging.Logger logger;
private final CommandsCache commandsCache = new CommandsCache();
private final List<String> offlinePlayerNames = new ArrayList<>();
private Map<String, Command> commandsMap = null;
private BukkitAntiTabListener bukkitAntiTabListener = null;
private PATSchedulerTask updaterTask;
private long lastCommandsLoad = -1;
@Override
public void onLoad() {
Configurator.createResourcedFile("files\\bukkit-config.yml", "config.yml", false);
Configurator.createResourcedFile("files\\bukkit-storage.yml", "storage.yml", false);
Configurator.createResourcedFile("files\\bukkit-placeholders.yml", "placeholders.yml", false);
Configurator.createResourcedFile("files\\bukkit-custom-responses.yml", "custom-responses.yml", false);
}
@Override
public void onEnable() {
plugin = this;
logger = getLogger();
for (OfflinePlayer offlinePlayerName : Bukkit.getOfflinePlayers()) {
offlinePlayerNames.add(offlinePlayerName.getName());
}
loadCommandMap();
Reflection.initialize(getServer());
CommandProcess.initialize();
ConfigUpdater.initialize();
Storage.initialize(this, getDescription().getVersion());
VersionComparer.get().setCurrentVersion(Storage.CURRENT_VERSION);
Storage.loadAll(true);
if (Bukkit.getServer().getPluginManager().getPlugin("PlaceholderAPI") != null)
new PlaceholderHook().register();
MessageTranslator.initialize();
Communicator.initialize(new BukkitPluginMessageClient(), new BukkitCommunicationHandler());
BackendUpdater.initialize();
bStats.initialize(this);
PluginManager manager = getServer().getPluginManager();
if (!Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED) {
GroupManager.initialize();
BukkitPacketAnalyzer.injectAll();
} else BackendUpdater.get().handle();
manager.registerEvents(new BukkitPlayerListener(), this);
manager.registerEvents(new BukkitBlockCommandListener(), this);
if (Reflection.isAtLeast(1, 13)) {
bukkitAntiTabListener = new BukkitAntiTabListener();
manager.registerEvents(bukkitAntiTabListener, this);
}
if (Reflection.isPaper() && Reflection.isAtLeast(1, 12)) {
manager.registerEvents(new PaperServerListPing(), this);
}
registerCommand("proantitab", "pat");
startUpdaterTask();
if (getServer().getPluginManager().getPlugin("LuckPerms") != null) {
LuckPermsHook.initialize();
Bukkit.getOnlinePlayers().forEach(player -> PermissionUtil.setPlayerPermissions(player.getUniqueId()));
} else {
final Plugin groupManagerPlugin = getServer().getPluginManager().getPlugin("GroupManager");
if (groupManagerPlugin != null) {
GroupManagerHook.initialize(groupManagerPlugin);
Bukkit.getOnlinePlayers().forEach(player -> PermissionUtil.setPlayerPermissions(player.getUniqueId()));
}
}
if (getServer().getPluginManager().getPlugin("ViaVersion") != null) {
ViaVersionHook.initialize();
}
Storage.broadcastPermissionsPluginNotice();
ConfigUpdater.broadcastMissingParts();
ActionHandler.initialize();
SubArgument.initialize();
ResponseHandler.update();
StorageConverter.initialize();
CustomServerBrand.initialize(new BukkitServerBrand());
PATScheduler.createScheduler(() -> {
Storage.reload();
loadAllCommands();
});
for (final ProCommand command : CommandProcess.getCommands()) {
addPermission(command.getName());
}
for (final Group group : GroupManager.getGroups()) {
addPermission("group." + group.getGroupName());
}
}
@Override
public void addPermission(String permission) {
permission = "proantitab." + permission;
final PluginManager manager = getServer().getPluginManager();
if (manager.getPermission(permission) == null) {
manager.addPermission(new Permission(permission));
}
}
@Override
public void removePermission(String permission) {
final PluginManager manager = getServer().getPluginManager();
final Permission perm = manager.getPermission("proantitab." + permission);
if (perm != null) manager.removePermission(perm);
}
@Override
public void onDisable() {
BackendUpdater.get().stop();
BukkitPacketAnalyzer.uninjectAll();
MessageTranslator.closeAudiences();
}
public void registerCommand(String... commands) {
BukkitCommand command = new BukkitCommand();
for (String commandName : commands) {
PluginCommand pluginCommand = getCommand(commandName);
pluginCommand.setExecutor(command);
pluginCommand.setTabCompleter(command);
}
}
@Override
public Object getPluginObj() {
return plugin;
}
@Override
public void updateCommands() {
if (bukkitAntiTabListener == null) return;
Bukkit.getOnlinePlayers().forEach(player -> {
bukkitAntiTabListener.updateCommands(player);
});
}
@Override
public void updateCommands(CommandSender sender) {
final Player player = Bukkit.getPlayer(sender.getUniqueId());
if (bukkitAntiTabListener != null) {
assert player != null;
bukkitAntiTabListener.updateCommands(player);
}
}
@Override
public void handleReload() {
loadAllCommands();
}
@Override
public boolean doesCommandExist(String command) {
if (commandsMap == null)
return false;
loadAllCommands();
return getAllCommands().contains(command);
}
@Override
public Object getConsoleSender() {
return Bukkit.getConsoleSender();
}
@Override
public Object getPlayerObjByName(String name) {
return Bukkit.getPlayer(name);
}
@Override
public Object getPlayerObjByUUID(UUID uuid) {
return Bukkit.getPlayer(uuid);
}
@Override
public void resetCommandsCache() {
commandsCache.reset();
}
@Override
public HashMap<String, CommandsCache> getPerServerCommandsCacheMap() {
return null;
}
@Override
public CommandsCache getBukkitCommandsCacheMap() {
return commandsCache;
}
@Override
public boolean isPlayerOnline(String playerName) {
return Bukkit.getPlayer(playerName) != null;
}
@Override
public boolean doesPlayerExist(String playerName) {
return isPlayerOnline(playerName) || ArrayUtils.containsIgnoreCase(getPlayerNames(), playerName);
}
@Override
public String getPlayerServerName(UUID uuid) {
final Player player = Bukkit.getPlayer(uuid);
if (player == null) { return null; }
return player.getWorld().getName();
}
@Override
public List<UUID> getPlayerIdsByServer(String server) {
return null;
}
@Override
public List<String> getOnlinePlayerNames(String serverName) {
return getOnlinePlayerNames();
}
@Override
public List<UUID> getPlayerIds() {
return Bukkit.getOnlinePlayers().stream().map(Entity::getUniqueId).collect(Collectors.toList());
}
@Override
public List<String> getOnlinePlayerNames() {
return new ArrayList<>(Bukkit.getServer().getOnlinePlayers().stream().map(Player::getName).toList());
}
@Override
public List<String> getOfflinePlayerNames() {
return offlinePlayerNames;
}
@Override
public List<String> getPlayerNames() {
List<String> playerNames = new ArrayList<>(offlinePlayerNames);
playerNames.addAll(getOnlinePlayerNames());
return playerNames;
}
@Override
public String getNameByUUID(UUID uuid) {
Player player = Bukkit.getPlayer(uuid);
return player != null ? player.getName() : "";
}
@Override
public UUID getUUIDByName(String playerName) {
Player player = Bukkit.getPlayer(playerName);
return player != null ? player.getUniqueId() : null;
}
@Override
public List<String> getServerNames() {
return List.of();
}
@Override
public void delayedPermissionsReload() {
PATScheduler.createScheduler(PermissionUtil::reloadPermissions, 40);
}
@Override
public void delayedPermissionsReload(CommandSender sender) {
PATScheduler.createScheduler(() -> {
PermissionUtil.reloadPermissions(sender);
}, 40);
}
public void startUpdaterTask() {
if (!Storage.ConfigSections.Settings.UPDATE.ENABLED)
return;
updaterTask = PATScheduler.createAsyncScheduler(() -> {
if (VersionComparer.get().computeComparison())
updaterTask.cancelTask();
}, 20L, 20L * Storage.ConfigSections.Settings.UPDATE.PERIOD);
}
public static List<String> getAllCommands() {
return new ArrayList<>(commands);
}
public static List<String> getAllowedCommands() {
return new ArrayList<>(allowedCommands);
}
public static List<String> getDisallowedCommands() {
return disallowedCommands;
}
@Override
public List<String> getFormattedPluginNames(String format) {
List<String> pluginNames = new ArrayList<>();
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
PluginDescriptionFile description = plugin.getDescription();
pluginNames.add(
format.replace("%n", description.getName())
.replace("%v", description.getVersion())
);
}
return pluginNames;
}
@Override
public List<String> getAllCommands(boolean useColons) {
List<String> commands = new ArrayList<>();
for (Map.Entry<String, Command> entry : commandsMap.entrySet()) {
if (entry.getKey().toLowerCase().contains(":")) {
String command = entry.getKey().substring(entry.getKey().lastIndexOf(":") + 1);
commands.add(command);
if (useColons) {
commands.add(entry.getKey());
}
}
}
return commands;
}
@Override
public List<String> getPluginCommands(String pluginName, boolean useColons) {
List<String> commands = new ArrayList<>();
if (pluginName.isBlank()) return commands;
pluginName = pluginName.toLowerCase();
for (Map.Entry<String, Command> entry : commandsMap.entrySet()) {
if (entry.getKey().toLowerCase().startsWith(pluginName + ":")) {
String command = entry.getKey().substring(pluginName.length() + 1);
commands.add(command);
if (useColons) {
commands.add(entry.getKey());
}
}
}
return commands;
}
private void loadCommandMap() {
try {
if (Bukkit.getPluginManager() instanceof SimplePluginManager) {
Field commandMapField = SimplePluginManager.class.getDeclaredField("commandMap");
commandMapField.setAccessible(true);
SimpleCommandMap simpleCommandMap = (SimpleCommandMap) commandMapField.get(Bukkit.getPluginManager());
Field knownCommandsField = SimpleCommandMap.class.getDeclaredField("knownCommands");
knownCommandsField.setAccessible(true);
commandsMap = (Map<String, Command>) knownCommandsField.get(simpleCommandMap);
}
} catch (Throwable ignored) { }
if (commandsMap == null) {
Logger.warning("Failed to get server commands!");
}
}
private void loadAllCommands() {
if (lastCommandsLoad != -1 && System.currentTimeMillis() - lastCommandsLoad < 1000)
return;
List<String> result = new ArrayList<>();
if (commandsMap == null) {
result.addAll(
Bukkit.getHelpMap().getHelpTopics().stream()
.map(topic -> {
String name = topic.getName();
if (name.startsWith("/"))
name = name.substring(1);
return name;
}).toList()
);
return;
}
commandsMap.entrySet().forEach(entry -> {
String key = entry.getKey();
Command command = entry.getValue();
result.add(key);
if (!command.getAliases().isEmpty()) {
result.addAll(command.getAliases());
}
});
boolean turn = Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED;
List<String> allowedCommands = new ArrayList<>(result).stream().filter(command -> {
boolean contains = Storage.Blacklist.getBlacklist().getCommands().contains(command);
return turn == contains;
}).toList();
lastCommandsLoad = System.currentTimeMillis();
BukkitLoader.commands = result;
BukkitLoader.allowedCommands = allowedCommands;
BukkitLoader.disallowedCommands = commands.stream().filter(command -> !allowedCommands.contains(command)).toList();
}
public static Plugin getPlugin() {
return plugin;
}
public static java.util.logging.Logger getPluginLogger() {
return logger;
}
}
@@ -1,360 +0,0 @@
package de.rayzs.pat.plugin;
import de.rayzs.pat.plugin.system.communication.cph.impl.BungeeCommunicationHandler;
import de.rayzs.pat.plugin.system.serverbrand.CustomServerBrand;
import de.rayzs.pat.plugin.system.communication.pmc.impl.BungeePluginMessageClient;
import de.rayzs.pat.plugin.system.converter.StorageConverter;
import de.rayzs.pat.plugin.command.CommandProcess;
import de.rayzs.pat.plugin.system.serverbrand.impl.BungeeServerBrand;
import de.rayzs.pat.plugin.packetanalyzer.proxy.BungeePacketAnalyzer;
import de.rayzs.pat.plugin.system.subargument.SubArgument;
import de.rayzs.pat.utils.configuration.Configurator;
import de.rayzs.pat.utils.configuration.updater.ConfigUpdater;
import de.rayzs.pat.utils.message.MessageTranslator;
import de.rayzs.pat.utils.hooks.LuckPermsHook;
import de.rayzs.pat.plugin.system.communication.Communicator;
import de.rayzs.pat.utils.permission.PermissionUtil;
import de.rayzs.pat.utils.response.ResponseHandler;
import de.rayzs.pat.utils.response.action.ActionHandler;
import de.rayzs.pat.utils.sender.CommandSender;
import net.md_5.bungee.api.scheduler.ScheduledTask;
import de.rayzs.pat.plugin.command.impl.BungeeCommand;
import de.rayzs.pat.plugin.listeners.bungee.*;
import de.rayzs.pat.utils.group.GroupManager;
import net.md_5.bungee.api.config.ServerInfo;
import de.rayzs.pat.plugin.metrics.bStats;
import de.rayzs.pat.plugin.logger.Logger;
import net.md_5.bungee.api.connection.*;
import de.rayzs.pat.api.storage.Storage;
import net.md_5.bungee.api.ProxyServer;
import java.util.concurrent.TimeUnit;
import net.md_5.bungee.api.plugin.*;
import de.rayzs.pat.utils.*;
import java.util.*;
public class BungeeLoader extends Plugin implements PluginLoader {
private ScheduledTask updaterTask;
private static Plugin plugin;
private static java.util.logging.Logger logger;
private static final HashMap<String, CommandsCache> commandsCacheMap = new HashMap<>();
@Override
public void onLoad() {
Configurator.createResourcedFile("files\\proxy-config.yml", "config.yml", false);
Configurator.createResourcedFile("files\\proxy-storage.yml", "storage.yml", false);
Configurator.createResourcedFile("files\\proxy-placeholders.yml", "placeholders.yml", false);
Configurator.createResourcedFile("files\\proxy-custom-responses.yml", "custom-responses.yml", false);
}
@Override
public void onEnable() {
plugin = this;
logger = getLogger();
Reflection.initialize(getProxy());
CommandProcess.initialize();
ConfigUpdater.initialize();
Storage.initialize(this, getDescription().getVersion());
VersionComparer.get().setCurrentVersion(Storage.CURRENT_VERSION);
Storage.loadAll(true);
MessageTranslator.initialize();
GroupManager.initialize();
bStats.initialize(this);
PluginManager manager = ProxyServer.getInstance().getPluginManager();
registerCommand("bungeeproantitab", "bpat");
manager.registerListener(this, new BungeePlayerConnectionListener());
manager.registerListener(this, new BungeeAntiTabListener());
manager.registerListener(this, new BungeeBlockCommandListener());
manager.registerListener(this, new BungeePingListener());
if (Reflection.isPaper())
manager.registerListener(this, new WaterfallAntiTabListener());
startUpdaterTask();
if (manager.getPlugin("LuckPerms") != null)
LuckPermsHook.initialize();
if(manager.getPlugin("PAPIProxyBridge") != null) {
Storage.USE_PAPIPROXYBRIDGE = true;
Logger.info("Successfully hooked into PAPIProxyBridge!");
}
BungeePacketAnalyzer.injectAll();
Storage.broadcastPermissionsPluginNotice();
ConfigUpdater.broadcastMissingParts();
ActionHandler.initialize();
SubArgument.initialize();
ResponseHandler.update();
StorageConverter.initialize();
CustomServerBrand.initialize(new BungeeServerBrand());
Communicator.initialize(new BungeePluginMessageClient(), new BungeeCommunicationHandler());
// Reload proxy commands after 1, 5, and 15 seconds.
for (int i : new Integer[] { 1, 5, 15 }) {
ProxyServer.getInstance().getScheduler().schedule(this, BungeePacketAnalyzer::loadProxyCommands, i, TimeUnit.SECONDS);
}
BungeePacketAnalyzer.injectAll();
}
@Override
public void onDisable() {
BungeePacketAnalyzer.uninjectAll();
MessageTranslator.closeAudiences();
}
private static void registerCommand(String... commands) {
for (String commandName : commands) {
BungeeCommand command = new BungeeCommand(commandName);
ProxyServer.getInstance().getPluginManager().registerCommand(plugin, command);
}
}
@Override
public void addPermission(String permission) {}
@Override
public void removePermission(String permission) {}
@Override
public Object getPluginObj() {
return plugin;
}
@Override
public void updateCommands() {
Communicator.Proxy2Backend.sendUpdateCommand();
}
@Override
public void updateCommands(CommandSender sender) {
Communicator.Proxy2Backend.sendUpdateCommand(sender.getUniqueId(), sender.getServerName());
}
@Override
public void handleReload() {
BungeePacketAnalyzer.loadProxyCommands();
}
@Override
public void delayedPermissionsReload() {
getProxy().getScheduler().schedule(this, () -> {
PermissionUtil.reloadPermissions();
Storage.getLoader().resetCommandsCache();
Communicator.Proxy2Backend.sendUpdateCommand();
}, 1, TimeUnit.SECONDS);
}
@Override
public void delayedPermissionsReload(CommandSender sender) {
getProxy().getScheduler().schedule(this, () -> {
PermissionUtil.reloadPermissions(sender.getUniqueId());
Communicator.Proxy2Backend.sendUpdateCommand(sender.getUniqueId(), sender.getServerName());
}, 1, TimeUnit.SECONDS);
}
@Override
public boolean doesCommandExist(String command) {
return false;
}
@Override
public List<String> getAllCommands(boolean useColons) {
return List.of();
}
@Override
public Object getConsoleSender() {
return ProxyServer.getInstance().getConsole();
}
@Override
public Object getPlayerObjByName(String name) {
return plugin.getProxy().getPlayer(name);
}
@Override
public Object getPlayerObjByUUID(UUID uuid) {
return plugin.getProxy().getPlayer(uuid);
}
@Override
public HashMap<String, CommandsCache> getPerServerCommandsCacheMap() {
return commandsCacheMap;
}
@Override
public CommandsCache getBukkitCommandsCacheMap() {
return null;
}
@Override
public void resetCommandsCache() {
new ArrayList<>(commandsCacheMap.values()).forEach(CommandsCache::reset);
}
@Override
public String getPlayerServerName(UUID uuid) {
final String cachedServerName = Storage.getCachedPlayerServername(uuid);
if (cachedServerName != null) {
return cachedServerName;
}
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(uuid);
if (player == null || player.getServer() == null || player.getServer().getInfo() == null) {
return null;
}
return player.getServer().getInfo().getName();
}
@Override
public List<UUID> getPlayerIds() {
return new ArrayList<>(ProxyServer.getInstance().getPlayers().stream().map(ProxiedPlayer::getUniqueId).toList());
}
@Override
public List<UUID> getPlayerIdsByServer(String server) {
List<UUID> uuids = new ArrayList<>();
getServerNames().stream()
.filter(serverName -> Storage.isServer(server, serverName))
.forEach(serverName -> {
ServerInfo serverInfo = ProxyServer.getInstance().getServerInfo(serverName);
if (serverInfo == null)
return;
uuids.addAll(serverInfo.getPlayers().stream().map(ProxiedPlayer::getUniqueId).toList());
});
return uuids;
}
@Override
public List<String> getOnlinePlayerNames(String serverName) {
return new ArrayList<>(ProxyServer.getInstance().getPlayers().stream()
.filter(player -> {
if (player == null || player.getServer() == null || player.getServer().getInfo() == null)
return false;
return player.getServer().getInfo().getName().equalsIgnoreCase(serverName);
}).map(ProxiedPlayer::getName).toList());
}
@Override
public boolean isPlayerOnline(String playerName) {
return ProxyServer.getInstance().getPlayer(playerName) != null;
}
@Override
public boolean doesPlayerExist(String playerName) {
return isPlayerOnline(playerName);
}
@Override
public List<String> getOnlinePlayerNames() {
return new ArrayList<>(ProxyServer.getInstance().getPlayers().stream().map(ProxiedPlayer::getName).toList());
}
@Override
public List<String> getOfflinePlayerNames() {
return new ArrayList<>(ProxyServer.getInstance().getPlayers().stream().map(ProxiedPlayer::getName).toList());
}
@Override
public List<String> getPlayerNames() {
return new ArrayList<>(ProxyServer.getInstance().getPlayers().stream().map(ProxiedPlayer::getName).toList());
}
@Override
public String getNameByUUID(UUID uuid) {
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(uuid);
return player != null ? player.getName() : "";
}
@Override
public UUID getUUIDByName(String playerName) {
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(playerName);
return player != null ? player.getUniqueId() : null;
}
@Override
public List<String> getServerNames() {
return new ArrayList<>(ProxyServer.getInstance().getServers().keySet().stream().toList());
}
@Override
public List<String> getFormattedPluginNames(String format) {
List<String> pluginNames = new ArrayList<>();
for (Plugin plugin : ProxyServer.getInstance().getPluginManager().getPlugins()) {
PluginDescription description = plugin.getDescription();
pluginNames.add(
format.replace("%n", description.getName())
.replace("%v", description.getVersion())
);
}
return pluginNames;
}
@Override
public List<String> getPluginCommands(String pluginName, boolean useColons) {
return List.of();
}
public void startUpdaterTask() {
if (!Storage.ConfigSections.Settings.UPDATE.ENABLED)
return;
updaterTask = getProxy().getScheduler().schedule(this, () -> {
if (VersionComparer.get().computeComparison())
getProxy().getScheduler().cancel(updaterTask);
}, 20L, Storage.ConfigSections.Settings.UPDATE.PERIOD, TimeUnit.MILLISECONDS);
}
public static String getServerNameByPlayerUUID(UUID uuid) {
ProxiedPlayer proxiedPlayer = ProxyServer.getInstance().getPlayer(uuid);
if(proxiedPlayer == null) return null;
Server server = proxiedPlayer.getServer();
if(server == null) return null;
ServerInfo serverInfo = server.getInfo();
if(serverInfo == null) return null;
return serverInfo.getName();
}
public static Plugin getPlugin() {
return plugin;
}
public static java.util.logging.Logger getPluginLogger() {
return logger;
}
}
@@ -1,77 +0,0 @@
package de.rayzs.pat.plugin;
import de.rayzs.pat.utils.CommandsCache;
import de.rayzs.pat.utils.sender.CommandSender;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
public interface PluginLoader {
void addPermission(String permission);
void removePermission(String permission);
Object getPluginObj();
void handleReload();
boolean doesCommandExist(String command);
/**
* Updates commands for all players.
* Requires PAT sync on proxy for it to work!
* Non-proxy servers do not require anything additionally.
*/
void updateCommands();
/**
* Updates commands for a certain player.
* Requires PAT sync on proxy for it to work!
* Non-proxy servers do not require anything additionally.
*/
void updateCommands(CommandSender sender);
HashMap<String, CommandsCache> getPerServerCommandsCacheMap();
CommandsCache getBukkitCommandsCacheMap();
void delayedPermissionsReload();
void delayedPermissionsReload(CommandSender sender);
void resetCommandsCache();
List<String> getServerNames();
Object getConsoleSender();
Object getPlayerObjByName(String name);
Object getPlayerObjByUUID(UUID uuid);
UUID getUUIDByName(String playerName);
String getNameByUUID(UUID uuid);
String getPlayerServerName(UUID uuid);
boolean isPlayerOnline(String playerName);
boolean doesPlayerExist(String playerName);
List<String> getOnlinePlayerNames(String server);
List<UUID> getPlayerIdsByServer(String server);
List<UUID> getPlayerIds();
List<String> getPlayerNames();
List<String> getOnlinePlayerNames();
List<String> getOfflinePlayerNames();
List<String> getAllCommands(boolean useColons);
List<String> getPluginCommands(String pluginName, boolean useColons);
/**
* <pre>
* %n = Plugin name
* %v = Plugin version
* </pre>
*/
List<String> getFormattedPluginNames(String format);
}
@@ -1,363 +0,0 @@
package de.rayzs.pat.plugin;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ServerConnection;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import de.rayzs.pat.plugin.system.communication.cph.impl.VelocityCommunicationHandler;
import de.rayzs.pat.plugin.system.serverbrand.CustomServerBrand;
import de.rayzs.pat.plugin.system.communication.pmc.impl.VelocityPluginMessageClient;
import de.rayzs.pat.plugin.packetanalyzer.proxy.VelocityPacketAnalyzer;
import de.rayzs.pat.plugin.system.converter.StorageConverter;
import de.rayzs.pat.plugin.system.serverbrand.impl.VelocityServerBrand;
import de.rayzs.pat.plugin.command.CommandProcess;
import de.rayzs.pat.plugin.system.subargument.SubArgument;
import de.rayzs.pat.utils.CommandsCache;
import de.rayzs.pat.plugin.metrics.impl.VelocityMetrics;
import com.velocitypowered.api.scheduler.ScheduledTask;
import de.rayzs.pat.utils.configuration.Configurator;
import de.rayzs.pat.utils.configuration.updater.ConfigUpdater;
import de.rayzs.pat.utils.permission.PermissionUtil;
import de.rayzs.pat.plugin.command.impl.VelocityCommand;
import de.rayzs.pat.utils.message.MessageTranslator;
import de.rayzs.pat.plugin.system.communication.Communicator;
import de.rayzs.pat.utils.hooks.LuckPermsHook;
import com.velocitypowered.api.proxy.ProxyServer;
import de.rayzs.pat.plugin.listeners.velocity.*;
import de.rayzs.pat.utils.group.GroupManager;
import de.rayzs.pat.utils.VersionComparer;
import de.rayzs.pat.plugin.logger.Logger;
import com.velocitypowered.api.plugin.*;
import de.rayzs.pat.api.storage.Storage;
import com.velocitypowered.api.event.*;
import de.rayzs.pat.utils.Reflection;
import java.util.concurrent.TimeUnit;
import com.google.inject.Inject;
import de.rayzs.pat.utils.response.ResponseHandler;
import de.rayzs.pat.utils.response.action.ActionHandler;
import de.rayzs.pat.utils.sender.CommandSender;
import java.util.*;
@Plugin(name = "ProAntiTab",
id = "proantitab",
version = "2.3.4",
authors = "Rayzs_YT",
description = "Hides more than just your plugins.",
url = "https://www.rayzs.de/products/proantitab/page",
dependencies = {
@Dependency(id = "luckperms", optional = true),
@Dependency(id = "papiproxybridge", optional = true)
})
public class VelocityLoader implements PluginLoader {
private static VelocityLoader instance;
private static ProxyServer server;
private static org.slf4j.Logger logger;
private final EventManager manager;
private final VelocityMetrics.Factory metricsFactory;
private ScheduledTask updaterTask;
private static final HashMap<String, CommandsCache> commandsCacheMap = new HashMap<>();
@Inject
public VelocityLoader(ProxyServer server, org.slf4j.Logger logger, VelocityMetrics.Factory metricsFactory) {
VelocityLoader.instance = this;
VelocityLoader.server = server;
VelocityLoader.logger = logger;
this.manager = server.getEventManager();
this.metricsFactory = metricsFactory;
}
@Subscribe
public void onProxyInitialization(ProxyInitializeEvent event) {
PluginContainer pluginContainer = server.getPluginManager().getPlugin("proantitab").get();
Configurator.createResourcedFile("files\\proxy-config.yml", "config.yml", false);
Configurator.createResourcedFile("files\\proxy-storage.yml", "storage.yml", false);
Configurator.createResourcedFile("files\\proxy-placeholders.yml", "placeholders.yml", false);
Configurator.createResourcedFile("files\\proxy-custom-responses.yml", "custom-responses.yml", false);
Reflection.initialize(server);
CommandProcess.initialize();
ConfigUpdater.initialize();
Storage.initialize(this, pluginContainer.getDescription().getVersion().get());
VersionComparer.get().setCurrentVersion(Storage.CURRENT_VERSION);
Storage.loadAll(true);
MessageTranslator.initialize();
GroupManager.initialize();
metricsFactory.make(this, 21638);
server.getCommandManager().register("bpat", new VelocityCommand(), "bungeeproantitab");
server.getEventManager().register(this, new VelocityBlockCommandListener());
server.getEventManager().register(this, new VelocityAntiTabListener(server));
server.getEventManager().register(this, new VelocityConnectionListener(server, this));
server.getEventManager().register(this, new VelocityPingListener(server));
startUpdaterTask();
if (server.getPluginManager().getPlugin("luckperms").isPresent())
LuckPermsHook.initialize();
if (server.getPluginManager().getPlugin("papiproxybridge").isPresent()) {
Storage.USE_PAPIPROXYBRIDGE = true;
Logger.info("Successfully hooked into PAPIProxyBridge!");
}
Storage.broadcastPermissionsPluginNotice();
ConfigUpdater.broadcastMissingParts();
ActionHandler.initialize();
SubArgument.initialize();
ResponseHandler.update();
StorageConverter.initialize();
CustomServerBrand.initialize(new VelocityServerBrand());
Communicator.initialize(new VelocityPluginMessageClient(), new VelocityCommunicationHandler());
VelocityPacketAnalyzer.injectAll();
}
public static org.slf4j.Logger getPluginLogger() {
return logger;
}
@Override
public void addPermission(String permission) {}
@Override
public void removePermission(String permission) {}
@Override
public Object getPluginObj() {
return instance;
}
@Override
public void updateCommands() {
Communicator.Proxy2Backend.sendUpdateCommand();
}
@Override
public void updateCommands(CommandSender sender) {
Communicator.Proxy2Backend.sendUpdateCommand(sender.getUniqueId(), sender.getServerName());
}
@Override
public void delayedPermissionsReload() {
server.getScheduler().buildTask(VelocityLoader.instance, () -> {
PermissionUtil.reloadPermissions();
resetCommandsCache();
Communicator.Proxy2Backend.sendUpdateCommand();
}).delay(1, TimeUnit.SECONDS).schedule();
}
@Override
public void delayedPermissionsReload(CommandSender sender) {
server.getScheduler().buildTask(VelocityLoader.instance, () -> {
PermissionUtil.reloadPermissions(sender);
Communicator.Proxy2Backend.sendUpdateCommand(sender.getUniqueId(), sender.getServerName());
}).delay(1, TimeUnit.SECONDS).schedule();
}
@Override
public void handleReload() {}
@Override
public boolean doesCommandExist(String command) {
return false;
}
@Override
public List<String> getAllCommands(boolean useColons) {
return List.of();
}
@Override
public Object getConsoleSender() {
return server.getConsoleCommandSource();
}
@Override
public Object getPlayerObjByName(String name) {
return server.getPlayer(name).orElse(null);
}
@Override
public Object getPlayerObjByUUID(UUID uuid) {
return server.getPlayer(uuid).orElse(null);
}
@Override
public void resetCommandsCache() {
new ArrayList<>(commandsCacheMap.values()).forEach(CommandsCache::reset);
}
@Override
public HashMap<String, CommandsCache> getPerServerCommandsCacheMap() {
return commandsCacheMap;
}
@Override
public CommandsCache getBukkitCommandsCacheMap() {
return null;
}
@Override
public boolean isPlayerOnline(String playerName) {
return server.getPlayer(playerName).isPresent();
}
@Override
public boolean doesPlayerExist(String playerName) {
return isPlayerOnline(playerName);
}
@Override
public List<UUID> getPlayerIdsByServer(String serverName) {
List<UUID> uuids = new ArrayList<>();
getServerNames().stream()
.filter(originServerName -> Storage.isServer(serverName, originServerName))
.forEach(originServerName -> {
Optional<RegisteredServer> optionalRegServerInfo = server.getServer(serverName);
if (optionalRegServerInfo.isEmpty())
return;
RegisteredServer regServerInfo = optionalRegServerInfo.get();
uuids.addAll(regServerInfo.getPlayersConnected().stream().map(Player::getUniqueId).toList());
});
return uuids;
}
@Override
public String getPlayerServerName(UUID uuid) {
final String cachedServerName = Storage.getCachedPlayerServername(uuid);
if (cachedServerName != null) {
return cachedServerName;
}
Optional<Player> optPlayer = server.getPlayer(uuid);
if (optPlayer.isEmpty())
return null;
Player player = optPlayer.get();
Optional<ServerConnection> optConnection = player.getCurrentServer();
if (optConnection.isEmpty()) {
return null;
}
ServerConnection connection = optConnection.get();
return connection.getServer().getServerInfo().getName();
}
@Override
public List<UUID> getPlayerIds() {
return server.getAllPlayers().stream().map(Player::getUniqueId).toList();
}
@Override
public List<String> getOnlinePlayerNames(String serverName) {
return server.getAllPlayers().stream()
.filter(player -> {
Optional<ServerConnection> optConnection = player.getCurrentServer();
if (optConnection.isEmpty())
return false;
ServerConnection connection = optConnection.get();
return connection.getServer().getServerInfo().getName().equalsIgnoreCase(serverName);
}).map(Player::getUsername).toList();
}
@Override
public List<String> getOnlinePlayerNames() {
return server.getAllPlayers().stream().map(Player::getUsername).toList();
}
@Override
public List<String> getOfflinePlayerNames() {
return server.getAllPlayers().stream().map(Player::getUsername).toList();
}
public List<String> getPlayerNames() {
return server.getAllPlayers().stream().map(Player::getUsername).toList();
}
@Override
public String getNameByUUID(UUID uuid) {
Player player = server.getPlayer(uuid).orElse(null);
return player != null ? player.getUsername() : "";
}
@Override
public UUID getUUIDByName(String playerName) {
Player player = server.getPlayer(playerName).orElse(null);
return player != null ? player.getUniqueId() : null;
}
@Override
public List<String> getServerNames() {
return new ArrayList<>(server.getAllServers().stream().map(registeredServer -> registeredServer.getServerInfo().getName()).toList());
}
@Override
public List<String> getFormattedPluginNames(String format) {
List<String> pluginNames = new ArrayList<>();
for (PluginContainer plugin : server.getPluginManager().getPlugins()) {
PluginDescription description = plugin.getDescription();
String pluginName = description.getName().orElse("/");
String version = description.getVersion().orElse("/");
pluginNames.add(
format.replace("%n", pluginName)
.replace("%v", version)
);
}
return pluginNames;
}
@Override
public List<String> getPluginCommands(String pluginName, boolean useColons) {
return List.of();
}
public void startUpdaterTask() {
if (!Storage.ConfigSections.Settings.UPDATE.ENABLED) return;
updaterTask = server.getScheduler().buildTask(this, () -> {
if (VersionComparer.get().computeComparison())
updaterTask.cancel();
}).delay(1, TimeUnit.SECONDS).repeat(Storage.ConfigSections.Settings.UPDATE.PERIOD, TimeUnit.SECONDS).schedule();
}
public static ProxyServer getServer() {
return server;
}
public static VelocityLoader getInstance() {
return instance;
}
}
@@ -1,261 +0,0 @@
package de.rayzs.pat.plugin.command;
import de.rayzs.pat.plugin.command.commands.ProCommand;
import de.rayzs.pat.plugin.command.commands.local.info.InfoCommand;
import de.rayzs.pat.plugin.command.commands.local.info.PermsCommand;
import de.rayzs.pat.plugin.command.commands.local.info.StatsCommand;
import de.rayzs.pat.plugin.command.commands.local.modify.*;
import de.rayzs.pat.plugin.command.commands.local.modify.list.ListCommand;
import de.rayzs.pat.plugin.command.commands.local.modify.list.ListGroupsCommand;
import de.rayzs.pat.plugin.command.commands.local.modify.list.ListPrioritiesCommand;
import de.rayzs.pat.plugin.command.commands.local.system.NotifyCommand;
import de.rayzs.pat.plugin.command.commands.local.system.PostDebugCommand;
import de.rayzs.pat.plugin.command.commands.local.system.ReloadCommand;
import de.rayzs.pat.plugin.command.commands.local.system.UpdateCommand;
import de.rayzs.pat.plugin.command.commands.server.ServAddCommand;
import de.rayzs.pat.plugin.command.commands.server.ServClearCommand;
import de.rayzs.pat.plugin.command.commands.server.ServRemoveCommand;
import de.rayzs.pat.plugin.command.commands.server.list.ServListCommand;
import de.rayzs.pat.utils.permission.PermissionUtil;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.utils.*;
import de.rayzs.pat.utils.sender.CommandSender;
import java.util.*;
public class CommandProcess {
private static final List<ProCommand> COMMANDS = new ArrayList<>();
public static void initialize() {
COMMANDS.add(new SetPriorityCommand());
COMMANDS.add(new NotifyCommand());
COMMANDS.add(new AddCommand());
COMMANDS.add(new RemoveCommand());
COMMANDS.add(new ClearCommand());
COMMANDS.add(new ConvertCommand());
if (!Reflection.isProxyServer()) {
COMMANDS.add(new ExtractCommand());
}
COMMANDS.add(new CreateGroupCommand());
COMMANDS.add(new DeleteGroupCommand());
COMMANDS.add(new ListCommand());
COMMANDS.add(new ListGroupsCommand());
COMMANDS.add(new ListPrioritiesCommand());
COMMANDS.add(new StatsCommand());
COMMANDS.add(new InfoCommand());
COMMANDS.add(new PermsCommand());
COMMANDS.add(new PostDebugCommand());
COMMANDS.add(new UpdateCommand());
COMMANDS.add(new ReloadCommand());
// PROXY
COMMANDS.add(new ServListCommand());
COMMANDS.add(new ServAddCommand());
COMMANDS.add(new ServRemoveCommand());
COMMANDS.add(new ServClearCommand());
}
public static void handleCommand(Object senderObj, String[] args, String label) {
CommandSender sender = CommandSender.from(senderObj);
if (!PermissionUtil.hasPermissionWithResponse(sender, "use"))
return;
if (args.length == 0) {
Storage.ConfigSections.Messages.HELP.MESSAGE.getLines().forEach(line -> {
sender.sendMessage(line.replace("%label%", label));
});
return;
}
String commandName = args[0];
String[] commandArgs = new String[] {};
if (commandName.equals("serv") || commandName.equals("server")) {
if (args.length < 2) {
sender.sendMessage(Storage.ConfigSections.Messages.COMMAND_FAILED.MESSAGE);
return;
}
String servCommandName = StringUtils.getFirstArg(args[1]);
if (args.length > 2) {
commandArgs = Arrays.copyOfRange(args, 2, args.length);
}
Optional<ProCommand> optCommand = COMMANDS.stream().filter(cmd -> {
if (Reflection.isProxyServer() && cmd.isServerCommand())
return cmd.isCommand(servCommandName);
return false;
}).findFirst();
if (optCommand.isEmpty()) {
sender.sendMessage(Storage.ConfigSections.Messages.COMMAND_FAILED.MESSAGE);
return;
}
ProCommand command = optCommand.get();
if (!PermissionUtil.hasPermissionWithResponse(sender, command.getName()))
return;
if (!command.execute(sender, commandArgs)) {
sender.sendMessage(Storage.ConfigSections.Messages.COMMAND_FAILED.MESSAGE);
}
return;
}
if (args.length > 1) {
commandArgs = Arrays.copyOfRange(args, 1, args.length);
}
Optional<ProCommand> optCommand = COMMANDS.stream().filter(cmd -> {
if (!Reflection.isProxyServer() && !cmd.isProxyOnly() || Reflection.isProxyServer() && !cmd.isServerCommand())
return cmd.isCommand(commandName);
return false;
}).findFirst();
if (optCommand.isEmpty()) {
sender.sendMessage(Storage.ConfigSections.Messages.COMMAND_FAILED.MESSAGE);
return;
}
ProCommand command = optCommand.get();
if (!PermissionUtil.hasPermissionWithResponse(sender, command.getName()))
return;
if (!command.execute(sender, commandArgs)) {
sender.sendMessage(Storage.ConfigSections.Messages.COMMAND_FAILED.MESSAGE);
}
}
public static List<String> handleTabComplete(Object senderObj, String[] args) {
CommandSender sender = CommandSender.from(senderObj);
List<String> result = new ArrayList<>();
if (!PermissionUtil.hasPermission(sender, "use"))
return result;
if (args.length <= 1) {
if (Reflection.isProxyServer())
result.addAll(Arrays.asList("serv", "server"));
COMMANDS.stream()
.filter(cmd -> {
if (!Reflection.isProxyServer() && cmd.isProxyOnly())
return false;
return PermissionUtil.hasPermission(sender, cmd.getName());
})
.forEach(cmd -> {
result.add(cmd.getName());
result.addAll(cmd.getAliases());
});
} else {
String commandName = StringUtils.getFirstArg(args[0]);
String[] commandArgs;
Optional<ProCommand> optCommand;
if (commandName.equals("serv") || commandName.equals("server")) {
if (args.length == 2) {
COMMANDS.stream()
.filter(cmd -> {
if (Reflection.isProxyServer() && cmd.isServerCommand())
return PermissionUtil.hasPermission(sender, cmd.getName());
return false;
})
.forEach(cmd -> {
result.add(cmd.getName());
result.addAll(cmd.getAliases());
});
return result;
}
String servCommandName = StringUtils.getFirstArg(args[1]);
commandArgs = Arrays.copyOfRange(args, 2, args.length);
if (commandArgs.length == 1 && commandArgs[0].isBlank())
commandArgs = new String[] {};
optCommand = COMMANDS.stream().filter(cmd -> {
if (Reflection.isProxyServer() && cmd.isServerCommand()) {
return cmd.isCommand(servCommandName) && PermissionUtil.hasPermission(sender, cmd.getName());
}
return false;
}).findFirst();
} else {
commandArgs = Arrays.copyOfRange(args, 1, args.length);
if (commandArgs.length == 1 && commandArgs[0].isBlank())
commandArgs = new String[]{};
optCommand = COMMANDS.stream().filter(cmd -> {
if (!Reflection.isProxyServer() && cmd.isProxyOnly() || cmd.isServerCommand()) {
return false;
}
return cmd.isCommand(commandName);
}).findFirst();
}
if (optCommand.isPresent()) {
ProCommand command = optCommand.get();
if (PermissionUtil.hasPermission(sender, command.getName())) {
List<String> cmdCompletions = command.tabComplete(sender, commandArgs);
result.addAll(cmdCompletions != null ? cmdCompletions : List.of());
}
}
}
return result.stream().filter(suggestion -> {
if (args.length == 0)
return true;
String command = args[Math.max(0, args.length-1)].toLowerCase();
suggestion = suggestion.toLowerCase();
if (command.startsWith("\"")) {
command = command.length() == 1 ? "" : command.substring(1);
}
return suggestion.startsWith(command);
}).toList();
}
public static List<ProCommand> getCommands() {
return COMMANDS;
}
}
@@ -1,47 +0,0 @@
package de.rayzs.pat.plugin.command.commands;
import de.rayzs.pat.utils.*;
import de.rayzs.pat.utils.sender.CommandSender;
import java.util.*;
public abstract class ProCommand {
private final String name;
private final List<String> aliases;
protected boolean proxyOnly = false, serverCommand = false;
public ProCommand(String name, String... aliases) {
this.name = name.toLowerCase();
this.aliases = aliases != null && !aliases[0].isBlank() ? Arrays.asList(aliases) : new ArrayList<>();
}
public String getName() {
return name;
}
public boolean isProxyOnly() {
return proxyOnly;
}
public boolean isServerCommand() {
return serverCommand;
}
public List<String> getAliases() {
return aliases;
}
public boolean isCommand(String label) {
String commandName = StringUtils.getFirstArg(label);
if (name.equalsIgnoreCase(commandName))
return true;
return !aliases.isEmpty() && aliases.stream().anyMatch(commandName::equalsIgnoreCase);
}
public abstract boolean execute(CommandSender sender, String[] args);
public abstract List<String> tabComplete(CommandSender sender, String[] args);
}
@@ -1,64 +0,0 @@
package de.rayzs.pat.plugin.command.commands.local.info;
import de.rayzs.pat.plugin.system.communication.BackendUpdater;
import de.rayzs.pat.plugin.system.communication.Communicator;
import de.rayzs.pat.plugin.command.commands.ProCommand;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.utils.*;
import de.rayzs.pat.utils.sender.CommandSender;
import java.util.List;
public class InfoCommand extends ProCommand {
public InfoCommand() {
super(
"info",
""
);
}
@Override
public boolean execute(CommandSender sender, String[] args) {
String message = StringUtils.getStringList(Storage.ConfigSections.Messages.INFO.MESSAGE.getLines(), "\n");
String syncTime = Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED ||
Reflection.isProxyServer()
? Storage.ConfigSections.Messages.INFO.SYNC_TIME.replace("%time%", TimeConverter.calcAndGetTime(Communicator.get().getLastSync()))
: Storage.ConfigSections.Messages.INFO.SYNC_DISABLED;
String lastAlivePacketTime = Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED ||
Reflection.isProxyServer()
? Storage.ConfigSections.Messages.INFO.SYNC_TIME.replace("%time%", TimeConverter.calcAndGetTime(Communicator.get().getLastReceivedKeepAliveResponse()))
: Storage.ConfigSections.Messages.INFO.SYNC_DISABLED;
if (!Reflection.isProxyServer()
&& !BackendUpdater.get().isConnected()
&& Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED)
{
syncTime = Storage.ConfigSections.Messages.INFO.SYNC_WAITING;
lastAlivePacketTime = Storage.ConfigSections.Messages.INFO.SYNC_WAITING;
}
final String versionStatus = Storage.OUTDATED
? Storage.ConfigSections.Messages.INFO.VERSION_OUTDATED
: Storage.ConfigSections.Messages.INFO.VERSION_UPDATED;
message = StringUtils.replace(message,
"%sync_time%", syncTime,
"%last_alive_response%", lastAlivePacketTime,
"%version_status%", versionStatus
);
sender.sendMessage(message);
return true;
}
@Override
public List<String> tabComplete(CommandSender sender, String[] args) {
return List.of();
}
}
@@ -1,45 +0,0 @@
package de.rayzs.pat.plugin.command.commands.local.info;
import de.rayzs.pat.utils.permission.PermissionUtil;
import de.rayzs.pat.plugin.command.commands.ProCommand;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.utils.sender.CommandSender;
import java.util.*;
public class PermsCommand extends ProCommand {
public PermsCommand() {
super(
"perms",
""
);
}
@Override
public boolean execute(CommandSender sender, String[] args) {
if (args.length == 0)
return false;
String name = args[0];
UUID uuid = Storage.getLoader().getUUIDByName(name);
boolean online = uuid != null;
if (online) {
name = Storage.getLoader().getNameByUUID(uuid);
}
sender.sendMessage((online
? Storage.ConfigSections.Messages.PERMS_CHECK.MESSAGE.replace("%permissions%", PermissionUtil.getPermissionsAsString(uuid))
: Storage.ConfigSections.Messages.PERMS_CHECK.PLAYER_NOT_ONLINE
).replace("%player%", name)
);
return true;
}
@Override
public List<String> tabComplete(CommandSender sender, String[] args) {
return args.length < 2 ? Storage.getLoader().getPlayerNames() : null;
}
}
@@ -1,79 +0,0 @@
package de.rayzs.pat.plugin.command.commands.local.info;
import de.rayzs.pat.plugin.system.communication.client.Client;
import de.rayzs.pat.plugin.system.communication.Communicator;
import de.rayzs.pat.plugin.command.commands.ProCommand;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.utils.*;
import de.rayzs.pat.utils.sender.CommandSender;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
public class StatsCommand extends ProCommand {
public StatsCommand() {
super(
"stats",
""
);
proxyOnly = true;
}
@Override
public boolean execute(CommandSender sender, String[] args) {
boolean backend = Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED && !Reflection.isProxyServer();
if(backend) {
sender.sendMessage(Storage.ConfigSections.Messages.NO_PROXY.MESSAGE);
return true;
}
final Set<Client> clients = Communicator.get().getClients();
final Iterator<Client> iterator = clients.iterator();
boolean tmpFound = false;
StringBuilder statsBuilder = new StringBuilder();
while (iterator.hasNext()) {
Client client = iterator.next();
if (!tmpFound) {
tmpFound = true;
}
statsBuilder.append(StringUtils.replace(Storage.ConfigSections.Messages.STATS.SERVER,
"%updated%", client.getFormattedSyncTime(),
"%servername%", client.getServerName(),
"%last_alive_response%", client.getFormattedLastReceivedKeepAlivePacketTime()
));
if (iterator.hasNext()) {
statsBuilder.append(Storage.ConfigSections.Messages.STATS.SPLITTER);
}
}
final boolean found = tmpFound;
Storage.ConfigSections.Messages.STATS.STATISTIC.getLines().forEach(message -> {
message = StringUtils.replace(message,
"%server_count%", String.valueOf(Communicator.get().getClients().size()),
"%last_sync_time%", TimeConverter.calcAndGetTime(Communicator.get().getLastSync()),
"%last_alive_response_time%", TimeConverter.calcAndGetTime(Communicator.get().getLastReceivedKeepAliveResponse()),
"%servers%", found ? statsBuilder.toString() : Storage.ConfigSections.Messages.STATS.NO_SERVER
);
sender.sendMessage(message);
});
return true;
}
@Override
public List<String> tabComplete(CommandSender sender, String[] args) {
return List.of();
}
}
@@ -1,138 +0,0 @@
package de.rayzs.pat.plugin.command.commands.local.modify;
import de.rayzs.pat.plugin.command.commands.ProCommand;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.api.storage.blacklist.impl.GroupBlacklist;
import de.rayzs.pat.plugin.BukkitLoader;
import de.rayzs.pat.utils.group.Group;
import de.rayzs.pat.utils.group.GroupManager;
import de.rayzs.pat.utils.*;
import de.rayzs.pat.utils.sender.CommandSender;
import java.util.*;
public class AddCommand extends ProCommand {
public AddCommand() {
super(
"add",
""
);
}
@Override
public boolean execute(CommandSender sender, String[] args) {
if (args.length == 0)
return false;
boolean backend = Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED && !Reflection.isProxyServer();
if (backend) {
sender.sendMessage(Storage.ConfigSections.Messages.NO_PROXY.MESSAGE);
return true;
}
String fullString = String.join(" ", args);
String command = fullString;
if (!command.startsWith("\"")) {
command = args[0];
} else {
command = command.substring(1);
int lastIndex = command.indexOf("\"");
if (lastIndex == -1) {
return false;
}
command = command.substring(0, lastIndex);
fullString = fullString.replace("\"" + command + "\"", ":::");
args = fullString.split(" ");
}
command = StringUtils.replaceTriggers(command, "", "\\.", "'", "\"");
if (command.isEmpty())
return false;
final boolean loadBlacklist = command.startsWith("plugin=") || command.startsWith("!");
final int length = args.length;
if (length == 1) {
boolean exist = command.contains(" ")
? Storage.Blacklist.getBlacklist().getCommands().contains(command)
: Storage.Blacklist.getBlacklist().isListed(command);
if (!exist) {
Storage.Blacklist.getBlacklist().add(command).save();
if (loadBlacklist) Storage.Blacklist.getBlacklist().load();
Storage.handleChange();
}
String message = exist ? Storage.ConfigSections.Messages.BLACKLIST.ADD_FAILED : Storage.ConfigSections.Messages.BLACKLIST.ADD_SUCCESS;
message = StringUtils.replace(message, "%command%", command);
sender.sendMessage(message);
return true;
}
String groupName = args[1];
Group group = GroupManager.getGroupByName(groupName);
if (group == null) {
sender.sendMessage(Storage.ConfigSections.Messages.GROUP.DOES_NOT_EXIST.replace("%group%", groupName));
return true;
}
GroupBlacklist blacklist = group.getGeneralGroupBlacklist();
boolean exist = blacklist.getCommands().contains(command);
if (!exist) {
group.add(command);
Storage.handleChange();
}
String message = exist ? Storage.ConfigSections.Messages.GROUP.ADD_FAILED : Storage.ConfigSections.Messages.GROUP.ADD_SUCCESS;
message = StringUtils.replace(message, "%group%", groupName, "%command%", command);
sender.sendMessage(message);
return true;
}
@Override
public List<String> tabComplete(CommandSender sender, String[] args) {
if (args.length == 0 || args.length == 1 && !args[0].startsWith("\"")) {
if (Reflection.isProxyServer())
return null;
return Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED
? BukkitLoader.getDisallowedCommands()
: BukkitLoader.getAllowedCommands();
}
String fullString = String.join(" ", args);
String command = fullString;
if (args[0].startsWith("\"")) {
command = command.length() == 1 ? "" : command.substring(1, command.length() - 1);
int lastIndex = command.indexOf("\"");
if (lastIndex == -1) {
return null;
}
command = command.substring(0, lastIndex);
args = Arrays.copyOfRange(args, command.split(" ").length - 1, args.length);
}
final int length = args.length;
return length == 2 ? GroupManager.getGroupNames() : null;
}
}
@@ -1,79 +0,0 @@
package de.rayzs.pat.plugin.command.commands.local.modify;
import de.rayzs.pat.plugin.command.commands.ProCommand;
import de.rayzs.pat.api.storage.Storage;
import java.util.concurrent.TimeUnit;
import de.rayzs.pat.utils.group.Group;
import de.rayzs.pat.utils.group.GroupManager;
import de.rayzs.pat.utils.*;
import de.rayzs.pat.utils.sender.CommandSender;
import java.util.*;
public class ClearCommand extends ProCommand {
private final ExpireCache<UUID, String> CONFIRMATION = new ExpireCache<>(4, TimeUnit.SECONDS);
public ClearCommand() {
super(
"clear",
"clr"
);
}
@Override
public boolean execute(CommandSender sender, String[] args) {
if (args.length == 0) {
final String confirmationString = "clear";
if (!CONFIRMATION.getOrDefault(sender.getUniqueId(), "").equals(confirmationString)) {
CONFIRMATION.put(sender.getUniqueId(), confirmationString);
sender.sendMessage(Storage.ConfigSections.Messages.BLACKLIST.CLEAR_CONFIRM);
return true;
}
Storage.Blacklist.getBlacklist().clear().save();
Storage.Blacklist.getBlacklist().load();
Storage.handleChange();
CONFIRMATION.remove(sender.getUniqueId());
sender.sendMessage(Storage.ConfigSections.Messages.BLACKLIST.CLEAR);
return true;
}
String groupName = args[0];
Group group = GroupManager.getGroupByName(groupName);
if (group == null) {
sender.sendMessage(Storage.ConfigSections.Messages.GROUP.DOES_NOT_EXIST.replace("%group%", groupName));
return true;
}
groupName = group.getGroupName();
final String confirmationString = "clear " + groupName;
if (!CONFIRMATION.getOrDefault(sender.getUniqueId(), "").equals(confirmationString)) {
CONFIRMATION.put(sender.getUniqueId(), confirmationString);
sender.sendMessage(Storage.ConfigSections.Messages.GROUP.CLEAR_CONFIRM);
return true;
}
group.clear();
Storage.handleChange();
CONFIRMATION.remove(sender.getUniqueId());
sender.sendMessage(Storage.ConfigSections.Messages.GROUP.CLEAR.replace("%group%", groupName));
return true;
}
@Override
public List<String> tabComplete(CommandSender sender, String[] args) {
return args.length < 2 ? GroupManager.getGroupNames() : null;
}
}
@@ -1,51 +0,0 @@
package de.rayzs.pat.plugin.command.commands.local.modify;
import de.rayzs.pat.plugin.command.commands.ProCommand;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.plugin.system.converter.Converter;
import de.rayzs.pat.plugin.system.converter.StorageConverter;
import de.rayzs.pat.utils.StringUtils;
import de.rayzs.pat.utils.sender.CommandSender;
import java.util.List;
public class ConvertCommand extends ProCommand {
public ConvertCommand() {
super(
"convert",
""
);
}
@Override
public boolean execute(CommandSender sender, String[] args) {
if (args.length != 1)
return false;
String converterName = args[0];
Converter converter = StorageConverter.get().getConverter(converterName);
if (converter == null) {
sender.sendMessage(StringUtils.replace(Storage.ConfigSections.Messages.CONVERT.INVALID_CONVERTER,
"%converter%", converterName)
);
return true;
}
converterName = converter.getPluginName();
sender.sendMessage(StringUtils.replace(Storage.ConfigSections.Messages.CONVERT.SUCCESS,
"%converter%", converterName)
);
converter.apply(sender);
Storage.reload();
return true;
}
@Override
public List<String> tabComplete(CommandSender sender, String[] args) {
return StorageConverter.get().getConverters().stream().toList();
}
}
@@ -1,57 +0,0 @@
package de.rayzs.pat.plugin.command.commands.local.modify;
import de.rayzs.pat.plugin.command.commands.ProCommand;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.utils.sender.CommandSender;
import de.rayzs.pat.utils.Reflection;
import de.rayzs.pat.utils.StringUtils;
import de.rayzs.pat.utils.group.Group;
import de.rayzs.pat.utils.group.GroupManager;
import java.util.Collections;
import java.util.List;
public class CreateGroupCommand extends ProCommand {
public CreateGroupCommand() {
super(
"creategroup",
"cg"
);
}
@Override
public boolean execute(CommandSender sender, String[] args) {
if (args.length == 0) {
return false;
}
boolean backend = Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED && !Reflection.isProxyServer();
if (backend) {
sender.sendMessage(Storage.ConfigSections.Messages.NO_PROXY.MESSAGE);
return true;
}
String groupName = args[0].toLowerCase();
Group group = GroupManager.getGroupByName(groupName);
boolean registered = group != null;
if (!registered) {
GroupManager.registerGroup(groupName);
Storage.getLoader().addPermission("group." + groupName);
} else groupName = group.getGroupName();
String message = registered ? Storage.ConfigSections.Messages.GROUP.ALREADY_EXIST : Storage.ConfigSections.Messages.GROUP.CREATE;
message = StringUtils.replace(message, "%group%", groupName);
sender.sendMessage(message);
return true;
}
@Override
public List<String> tabComplete(CommandSender sender, String[] args) {
return Collections.emptyList();
}
}
@@ -1,75 +0,0 @@
package de.rayzs.pat.plugin.command.commands.local.modify;
import de.rayzs.pat.plugin.command.commands.ProCommand;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.utils.sender.CommandSender;
import de.rayzs.pat.utils.ExpireCache;
import de.rayzs.pat.utils.Reflection;
import de.rayzs.pat.utils.StringUtils;
import de.rayzs.pat.utils.group.Group;
import de.rayzs.pat.utils.group.GroupManager;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
public class DeleteGroupCommand extends ProCommand {
private final ExpireCache<UUID, String> CONFIRMATION = new ExpireCache<>(4, TimeUnit.SECONDS);
public DeleteGroupCommand() {
super(
"deletegroup",
"dg"
);
}
@Override
public boolean execute(CommandSender sender, String[] args) {
if (args.length == 0) {
return false;
}
boolean backend = Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED && !Reflection.isProxyServer();
if (backend) {
sender.sendMessage(Storage.ConfigSections.Messages.NO_PROXY.MESSAGE);
return true;
}
String groupName = args[0];
Group group = GroupManager.getGroupByName(groupName);
boolean registered = group != null;
if (!registered) {
sender.sendMessage(Storage.ConfigSections.Messages.GROUP.DOES_NOT_EXIST.replace("%group%", groupName));
return true;
}
groupName = group.getGroupName();
String confirmationString = "deletegroup " + groupName;
if (!CONFIRMATION.getOrDefault(sender.getUniqueId(), "").equals(confirmationString)) {
CONFIRMATION.put(sender.getUniqueId(), confirmationString);
sender.sendMessage(Storage.ConfigSections.Messages.GROUP.DELETE_CONFIRM);
return true;
}
GroupManager.unregisterGroup(groupName);
Storage.getLoader().removePermission("group." + group.getGroupName());
CONFIRMATION.remove(sender.getUniqueId());
String message = registered ? Storage.ConfigSections.Messages.GROUP.DELETE : Storage.ConfigSections.Messages.GROUP.DOES_NOT_EXIST;
message = StringUtils.replace(message, "%group%", groupName);
sender.sendMessage(message);
return true;
}
@Override
public List<String> tabComplete(CommandSender sender, String[] args) {
return args.length < 2 ? GroupManager.getGroupNames() : null;
}
}
@@ -1,157 +0,0 @@
package de.rayzs.pat.plugin.command.commands.local.modify;
import de.rayzs.pat.plugin.command.commands.ProCommand;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.api.storage.storages.BlacklistStorage;
import de.rayzs.pat.utils.StringUtils;
import de.rayzs.pat.utils.group.Group;
import de.rayzs.pat.utils.group.GroupManager;
import de.rayzs.pat.utils.sender.CommandSender;
import java.util.*;
public class ExtractCommand extends ProCommand {
public ExtractCommand() {
super(
"extract",
""
);
}
private enum Mode {
BOTH("both", true), ONLY_COLON("only-colon", true), NON_COLON("non-colon", false);
private static Mode getMode(final String name) {
for (final Mode mode : Mode.values()) {
if (mode.getName().equalsIgnoreCase(name)) {
return mode;
}
}
return null;
}
public String getName() {
return name;
}
public boolean doesIncludesColons() {
return includesColons;
}
private final String name;
private final boolean includesColons;
Mode(final String name, final boolean includesColons) {
this.name = name;
this.includesColons = includesColons;
}
}
@Override
public boolean execute(CommandSender sender, String[] args) {
if (args.length < 1) {
sender.sendMessage(Storage.ConfigSections.Messages.EXTRACT.USAGE);
return true;
}
Mode mode = Mode.NON_COLON;
String pluginName = args[0].toLowerCase();
boolean failed = false;
Group group = null;
if (args.length == 2) {
group = GroupManager.getGroupByName(args[1]);
if (group == null) {
mode = Mode.getMode(args[1]);
failed = mode == null;
}
} else if (args.length == 3) {
group = GroupManager.getGroupByName(args[1]);
mode = Mode.getMode(args[2]);
if (group == null || mode == null) {
failed = true;
}
}
if (failed) {
sender.sendMessage(Storage.ConfigSections.Messages.EXTRACT.USAGE);
return true;
}
List<String> pluginNames = Storage.getLoader().getFormattedPluginNames("%n");
boolean pluginFound = false, all = pluginName.equalsIgnoreCase("*");
for (String name : pluginNames) {
if (name.equalsIgnoreCase(pluginName)) {
pluginFound = true;
break;
}
}
if (!all && !pluginFound) {
sender.sendMessage(StringUtils.replace(Storage.ConfigSections.Messages.EXTRACT.PLUGIN_NOT_FOUND,
"%plugin%", pluginName)
);
return true;
}
List<String> commands = all
? Storage.getLoader().getAllCommands(mode.doesIncludesColons())
: Storage.getLoader().getPluginCommands(args[0], mode.doesIncludesColons());
if (mode == Mode.ONLY_COLON) {
commands = commands.stream().filter(command -> command.contains(":")).toList();
}
BlacklistStorage storage = group == null
? Storage.Blacklist.getBlacklist()
: group.getGeneralGroupBlacklist();
commands = commands.stream().filter(command -> !storage.isListed(command)).toList();
commands.forEach(storage::add);
storage.save();
sender.sendMessage(StringUtils.replace(Storage.ConfigSections.Messages.EXTRACT.SUCCESS,
"%amount%", String.valueOf(commands.size()),
"%plugin%", pluginName
));
return true;
}
@Override
public List<String> tabComplete(CommandSender sender, String[] args) {
final int length = args.length;
if (length <= 1) {
final List<String> suggestions = Storage.getLoader().getFormattedPluginNames("%n");
suggestions.add("*");
return suggestions;
}
List<String> result = new ArrayList<>();
if (length == 2 || length == 3 && GroupManager.getGroupByName(args[1]) != null) {
result.addAll(Arrays.stream(Mode.values()).map(Mode::getName).toList());
}
if (length == 2) {
result.addAll(GroupManager.getGroupNames());
}
return result;
}
}
@@ -1,140 +0,0 @@
package de.rayzs.pat.plugin.command.commands.local.modify;
import de.rayzs.pat.plugin.command.commands.ProCommand;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.api.storage.blacklist.impl.GroupBlacklist;
import de.rayzs.pat.utils.group.Group;
import de.rayzs.pat.utils.group.GroupManager;
import de.rayzs.pat.utils.*;
import de.rayzs.pat.utils.sender.CommandSender;
import java.util.*;
import java.util.stream.Stream;
public class RemoveCommand extends ProCommand {
public RemoveCommand() {
super(
"remove",
"rem", "rm"
);
}
@Override
public boolean execute(CommandSender sender, String[] args) {
if (args.length == 0)
return false;
boolean backend = Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED && !Reflection.isProxyServer();
if (backend) {
sender.sendMessage(Storage.ConfigSections.Messages.NO_PROXY.MESSAGE);
return true;
}
String fullString = String.join(" ", args);
String command = fullString;
if (!command.startsWith("\"")) {
command = args[0];
} else {
command = command.substring(1);
int lastIndex = command.indexOf("\"");
if (lastIndex == -1) {
return false;
}
command = command.substring(0, lastIndex);
fullString = fullString.replace("\"" + command + "\"", ":::");
args = fullString.split(" ");
}
command = StringUtils.replaceTriggers(command, "", "\\.", "'", "\"");
if (command.isEmpty())
return false;
final boolean loadBlacklist = command.startsWith("plugin=") || command.startsWith("!");
final int length = args.length;
if (length == 1) {
boolean exist = Storage.Blacklist.getBlacklist().getCommands().contains(command);
if (exist) {
Storage.Blacklist.getBlacklist().remove(command).save();
if (loadBlacklist) Storage.Blacklist.getBlacklist().load();
Storage.handleChange();
}
String message = !exist ? Storage.ConfigSections.Messages.BLACKLIST.REMOVE_FAILED : Storage.ConfigSections.Messages.BLACKLIST.REMOVE_SUCCESS;
message = StringUtils.replace(message, "%command%", command);
sender.sendMessage(message);
return true;
}
String groupName = args[1];
Group group = GroupManager.getGroupByName(groupName);
if (group == null) {
sender.sendMessage(Storage.ConfigSections.Messages.GROUP.DOES_NOT_EXIST.replace("%group%", groupName));
return true;
}
GroupBlacklist blacklist = group.getGeneralGroupBlacklist();
boolean exist = blacklist.getCommands().contains(command);
if (exist) {
group.remove(command);
Storage.handleChange();
}
String message = !exist ? Storage.ConfigSections.Messages.GROUP.REMOVE_FAILED : Storage.ConfigSections.Messages.GROUP.REMOVE_SUCCESS;
message = StringUtils.replace(message, "%group%", groupName, "%command%", command);
sender.sendMessage(message);
return true;
}
@Override
public List<String> tabComplete(CommandSender sender, String[] args) {
if (args.length == 0 || args.length == 1 && !args[0].startsWith("\"")) {
return new ArrayList<>(Storage.Blacklist.getBlacklist().getCommands()).stream().filter(str -> !str.contains(" ")).toList();
}
String fullString = String.join(" ", args);
String command = fullString;
if (args[0].startsWith("\"")) {
command = command.length() == 1 ? "" : command.substring(1, command.length() - 1);
int lastIndex = command.indexOf("\"");
if (lastIndex == -1) {
if (args.length == 1) {
Stream<String> stream = new ArrayList<>(Storage.Blacklist.getBlacklist().getCommands())
.stream()
.filter(str -> str.contains(" "));
if (!Reflection.isProxyServer())
stream = stream.map(str -> "\"" + str + "\"");
return stream.toList();
}
return null;
}
command = command.substring(0, lastIndex);
args = Arrays.copyOfRange(args, command.split(" ").length - 1, args.length);
}
final int length = args.length;
return length == 2 ? GroupManager.getGroupNames() : null;
}
}
@@ -1,68 +0,0 @@
package de.rayzs.pat.plugin.command.commands.local.modify;
import de.rayzs.pat.plugin.command.commands.ProCommand;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.utils.sender.CommandSender;
import de.rayzs.pat.utils.Reflection;
import de.rayzs.pat.utils.group.Group;
import de.rayzs.pat.utils.group.GroupManager;
import java.util.List;
public class SetPriorityCommand extends ProCommand {
public SetPriorityCommand() {
super(
"setpriority",
"sp"
);
}
@Override
public boolean execute(CommandSender sender, String[] args) {
boolean backend = Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED && !Reflection.isProxyServer();
if (backend) {
sender.sendMessage(Storage.ConfigSections.Messages.NO_PROXY.MESSAGE);
return true;
}
if (args.length < 2) {
return false;
}
String groupName = args[0];
Group group = GroupManager.getGroupByName(groupName);
if (group == null) {
sender.sendMessage(Storage.ConfigSections.Messages.GROUP.DOES_NOT_EXIST.replace("%group%", groupName));
return true;
}
String priorityStr = args[1];
try {
int priority = Integer.parseInt(priorityStr);
if (priority > 0) {
group.setPriority(priority);
GroupManager.sort();
Storage.handleChange();
sender.sendMessage(Storage.ConfigSections.Messages.GROUP.PRIORITY_SUCCESS.replace("%group%", group.getGroupName()).replace("%priority%", priorityStr));
return true;
}
} catch (Exception ignored) {}
sender.sendMessage(Storage.ConfigSections.Messages.GROUP.PRIORITY_FAILED.replace("%group%", groupName).replace("%priority%", priorityStr));
return true;
}
@Override
public List<String> tabComplete(CommandSender sender, String[] args) {
return args.length < 2 ? GroupManager.getGroupNames() : null;
}
}
@@ -1,68 +0,0 @@
package de.rayzs.pat.plugin.command.commands.local.modify.list;
import de.rayzs.pat.plugin.command.commands.ProCommand;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.utils.group.Group;
import de.rayzs.pat.utils.group.GroupManager;
import de.rayzs.pat.utils.sender.CommandSender;
import de.rayzs.pat.utils.StringUtils;
import java.util.List;
public class ListCommand extends ProCommand {
public ListCommand() {
super(
"list",
"ls"
);
}
@Override
public boolean execute(CommandSender sender, String[] args) {
if (args.length == 0) {
String commandsListMessage = StringUtils.getStringList(
Storage.Blacklist.getBlacklist().getCommands(),
Storage.ConfigSections.Messages.BLACKLIST.LIST_SPLITTER
);
String message = Storage.ConfigSections.Messages.BLACKLIST.LIST_MESSAGE;
message = StringUtils.replace(message,
"%size%", String.valueOf(Storage.Blacklist.getBlacklist().getCommands().size()),
"%commands%", commandsListMessage
);
sender.sendMessage(message);
return true;
}
String groupName = args[0];
Group group = GroupManager.getGroupByName(groupName);
if (group == null) {
sender.sendMessage(Storage.ConfigSections.Messages.GROUP.DOES_NOT_EXIST.replace("%group%", groupName));
return true;
}
String commandsListMessage = StringUtils.getStringList(
group.getCommands(),
Storage.ConfigSections.Messages.GROUP.LIST_SPLITTER
);
String message = Storage.ConfigSections.Messages.GROUP.LIST_MESSAGE;
message = StringUtils.replace(message,
"%group%", groupName,
"%size%", String.valueOf(group.getCommands().size()),
"%commands%", commandsListMessage
);
sender.sendMessage(message);
return true;
}
@Override
public List<String> tabComplete(CommandSender sender, String[] args) {
return args.length < 2 ? GroupManager.getGroupNames() : null;
}
}
@@ -1,41 +0,0 @@
package de.rayzs.pat.plugin.command.commands.local.modify.list;
import de.rayzs.pat.utils.group.GroupManager;
import de.rayzs.pat.plugin.command.commands.ProCommand;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.utils.*;
import de.rayzs.pat.utils.sender.CommandSender;
import java.util.List;
public class ListGroupsCommand extends ProCommand {
public ListGroupsCommand() {
super(
"listgroups",
"lg"
);
}
@Override
public boolean execute(CommandSender sender, String[] args) {
String groupsListMessage = StringUtils.getStringList(
GroupManager.getGroupNames(),
Storage.ConfigSections.Messages.GROUP.LIST_SPLITTER
);
String message = Storage.ConfigSections.Messages.GROUP.LIST_GROUP_MESSAGE;
message = StringUtils.replace(message,
"%size%", String.valueOf(GroupManager.getGroups().size()),
"%groups%", groupsListMessage
);
sender.sendMessage(message);
return true;
}
@Override
public List<String> tabComplete(CommandSender sender, String[] args) {
return null;
}
}
@@ -1,59 +0,0 @@
package de.rayzs.pat.plugin.command.commands.local.modify.list;
import de.rayzs.pat.plugin.command.commands.ProCommand;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.utils.sender.CommandSender;
import de.rayzs.pat.utils.StringUtils;
import de.rayzs.pat.utils.group.Group;
import de.rayzs.pat.utils.group.GroupManager;
import java.util.List;
public class ListPrioritiesCommand extends ProCommand {
public ListPrioritiesCommand() {
super(
"listpriorities",
"lp"
);
}
@Override
public boolean execute(CommandSender sender, String[] args) {
String groupsPriorityListMessage = buildGroupPriorityMessage(
GroupManager.getGroups(),
Storage.ConfigSections.Messages.GROUP.LIST_PRIORITY_SPLITTER,
Storage.ConfigSections.Messages.GROUP.LIST_PRIORITY_GROUPS
);
String message = StringUtils.replace(groupsPriorityListMessage,
"%size%", String.valueOf(GroupManager.getGroups().size()),
"%groups%", groupsPriorityListMessage
);
sender.sendMessage(message);
return true;
}
@Override
public List<String> tabComplete(CommandSender sender, String[] args) {
return args.length < 2 ? GroupManager.getGroupNames() : null;
}
private String buildGroupPriorityMessage(List<Group> list, String splitter, String format) {
StringBuilder builder = new StringBuilder();
boolean end;
Group group;
for (int i = 0; i < list.size(); i++) {
end = i >= list.size() - 1;
group = list.get(i);
builder.append(format.replace("%group%", group.getGroupName()).replace("%priority%", String.valueOf(group.getPriority())));
if (!end && splitter != null) builder.append(splitter);
}
return builder.toString();
}
}
Loaded 100 of 257 files, more files were not shown because too many files have changed in this diff. Show more