Compare commits

...
14 Commits
19 changed files with 117 additions and 35 deletions

No files matched your search

+5 -5
View File
@@ -6,7 +6,7 @@
<groupId>de.rayzs.pat</groupId>
<artifactId>ProAntiTab</artifactId>
<version>1.9.1</version>
<version>1.9.2</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
@@ -233,28 +233,28 @@
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-minimessage</artifactId>
<version>4.15.0</version>
<version>4.18.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
<version>4.17.0</version>
<version>4.18.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-api</artifactId>
<version>4.3.2</version>
<version>4.3.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bungeecord</artifactId>
<version>4.3.2</version>
<version>4.3.3</version>
<scope>compile</scope>
</dependency>
@@ -101,6 +101,8 @@ public class Communicator {
}
public static void syncData(String serverId) {
if (Storage.ConfigSections.Settings.DISABLE_SYNC.DISABLED) return;
LAST_DATA_UPDATE = System.currentTimeMillis();
ClientInfo clientInfo;
if(serverId == null) {
@@ -45,7 +45,7 @@ public class LegacyPacketHandler implements BukkitPacketHandler {
}
cancelsBeforeHand = Storage.Blacklist.isBlocked(player, input, !Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED);
if(!cancelsBeforeHand) cancelsBeforeHand = Storage.ConfigSections.Settings.CUSTOM_VERSION.isCommand(input) || Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isCommand(input);
if(!cancelsBeforeHand) cancelsBeforeHand = Storage.ConfigSections.Settings.CUSTOM_VERSION.isTabCompletable(input) || Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isTabCompletable(input);
} else return true;
for (Field field : Reflection.getFields(packetObj)) {
@@ -59,7 +59,7 @@ public class ModernPacketHandler implements BukkitPacketHandler {
}
cancelsBeforeHand = Storage.Blacklist.isBlocked(player, input, !Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED);
if(!cancelsBeforeHand) cancelsBeforeHand = Storage.ConfigSections.Settings.CUSTOM_VERSION.isCommand(input) || Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isCommand(input);
if(!cancelsBeforeHand) cancelsBeforeHand = Storage.ConfigSections.Settings.CUSTOM_VERSION.isTabCompletable(input) || Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isTabCompletable(input);
}
if(is121Packet || Reflection.isFoliaServer() && packetObj.getClass().getSimpleName().equals("PacketPlayOutTabComplete")) {
@@ -197,7 +197,8 @@ public class BungeePacketAnalyzer {
if(!playerInput.equals("/")) {
cancelsBeforeHand = Storage.Blacklist.isBlocked(player, StringUtils.replaceFirst(playerInput, "/", ""), !Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED, server);
if(!cancelsBeforeHand) cancelsBeforeHand = Storage.ConfigSections.Settings.CUSTOM_VERSION.isCommand(StringUtils.replaceFirst(playerInput, "/", "")) || Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isCommand(StringUtils.replaceFirst(playerInput, "/", ""));
if(!cancelsBeforeHand) cancelsBeforeHand = Storage.ConfigSections.Settings.CUSTOM_VERSION.isTabCompletable(StringUtils.replaceFirst(playerInput, "/", "")) || Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isTabCompletable(StringUtils.replaceFirst(playerInput, "/", ""));
}
final String cursor = playerInput;
if(cursor.startsWith("/")) {
@@ -194,7 +194,7 @@ public class VelocityPacketAnalyzer {
if(!playerInput.equals("/")) {
cancelsBeforeHand = Storage.Blacklist.isBlocked(player, StringUtils.replaceFirst(playerInput, "/", ""), !Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED, server);
if(!cancelsBeforeHand) cancelsBeforeHand = Storage.ConfigSections.Settings.CUSTOM_VERSION.isCommand(StringUtils.replaceFirst(playerInput, "/", "")) || Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isCommand(StringUtils.replaceFirst(playerInput, "/", ""));
if(!cancelsBeforeHand) cancelsBeforeHand = Storage.ConfigSections.Settings.CUSTOM_VERSION.isTabCompletable(StringUtils.replaceFirst(playerInput, "/", "")) || Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isTabCompletable(StringUtils.replaceFirst(playerInput, "/", ""));
}
final String cursor = playerInput;
@@ -114,6 +114,7 @@ public class Storage {
public static CancelCommandSection CANCEL_COMMAND = new CancelCommandSection();
public static CustomPluginsSection CUSTOM_PLUGIN = new CustomPluginsSection();
public static CustomVersionSection CUSTOM_VERSION = new CustomVersionSection();
public static DisableSyncSection DISABLE_SYNC = new DisableSyncSection();
public static CustomProtocolPingSection CUSTOM_PROTOCOL_PING = new CustomProtocolPingSection();
public static CustomUnknownCommandSection CUSTOM_UNKNOWN_COMMAND = new CustomUnknownCommandSection();
public static TurnBlacklistToWhitelistSection TURN_BLACKLIST_TO_WHITELIST = new TurnBlacklistToWhitelistSection();
@@ -6,7 +6,7 @@ import java.util.*;
public class CustomPluginsSection extends ConfigStorage {
public boolean ENABLED;
public boolean ENABLED, ALWAYS_TAB_COMPLETABLE;
public MultipleMessagesHelper MESSAGE, COMMANDS;
public CustomPluginsSection() {
@@ -17,10 +17,18 @@ public class CustomPluginsSection extends ConfigStorage {
public void load() {
super.load();
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
COMMANDS = new MultipleMessagesHelper(this, "commands", Arrays.asList("pl", "plugins", "bukkit:pl", "bukkit:plugins"));
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;
@@ -31,7 +39,7 @@ public class CustomPluginsSection extends ConfigStorage {
command = command.split(" ")[0];
}
for (String currentCommand : COMMANDS.getLines()) {
if (currentCommand.equals(command.toLowerCase()))
if (currentCommand.equalsIgnoreCase(command))
return true;
}
return false;
@@ -7,7 +7,7 @@ import java.util.*;
public class CustomVersionSection extends ConfigStorage {
public boolean ENABLED;
public boolean ENABLED, ALWAYS_TAB_COMPLETABLE;
public MultipleMessagesHelper MESSAGE, COMMANDS;
public CustomVersionSection() {
@@ -18,16 +18,24 @@ public class CustomVersionSection extends ConfigStorage {
public void load() {
super.load();
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
COMMANDS = new MultipleMessagesHelper(this, "commands", Arrays.asList("icanhasbukkit", "ver", "version", "bukkit:ver", "bukkit:version"));
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.equals(command.toLowerCase()))
if (currentCommand.equalsIgnoreCase(command))
return true;
}
return false;
@@ -0,0 +1,22 @@
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 DISABLED;
public DisableSyncSection() {
super("disable-sync");
}
@Override
public void load() {
super.load();
if(!Reflection.isProxyServer()) return;
DISABLED = new ConfigSectionHelper<Boolean>(this, null, false).getOrSet();
}
}
@@ -71,7 +71,9 @@ public class BungeeLoader extends Plugin {
manager.registerListener(this, new WaterfallAntiTabListener());
startUpdaterTask();
ProxyServer.getInstance().getScheduler().schedule(this, Communicator::syncData, 5, TimeUnit.SECONDS);
if (!Storage.ConfigSections.Settings.DISABLE_SYNC.DISABLED)
ProxyServer.getInstance().getScheduler().schedule(this, Communicator::syncData, 5, TimeUnit.SECONDS);
Storage.PLUGIN_OBJECT = this;
@@ -34,7 +34,7 @@ import java.util.*;
@Plugin(name = "ProAntiTab",
id = "proantitab",
version = "1.9.1",
version = "1.9.2",
authors = "Rayzs_YT",
description = "Hide more than just your plugins. Hide almost everything!",
dependencies = {
@@ -89,7 +89,9 @@ public class VelocityLoader {
server.getEventManager().register(this, new VelocityPingListener(server));
startUpdaterTask();
server.getScheduler().buildTask(this, Communicator::syncData).delay(5, TimeUnit.SECONDS).schedule();
if (!Storage.ConfigSections.Settings.DISABLE_SYNC.DISABLED)
server.getScheduler().buildTask(this, Communicator::syncData).delay(5, TimeUnit.SECONDS).schedule();
Storage.PLUGIN_OBJECT = this;
@@ -21,6 +21,7 @@ public class TabCompletion extends FilteredTabCompletionEvent {
if(Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED) {
possibilities = result;
if(result.contains("%online_players%")) {
possibilities.remove("%online_players%");
possibilities.addAll(SubArgsModule.getPlayerNames());
@@ -96,6 +96,16 @@ public class CommandsCache {
if (playerCommands.contains(command)) continue;
if (Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isTabCompletable(command) || Storage.ConfigSections.Settings.CUSTOM_VERSION.isCommand(command)) {
if (useList)
playerCommands.add(command);
else
playerCommands.remove(command);
continue;
}
permitted = Reflection.isProxyServer() && serverName != null
? !Storage.Blacklist.isBlocked(targetObj, command, !turn, serverName)
: !Storage.Blacklist.isBlocked(targetObj, command, !turn, false, false);
@@ -132,7 +142,10 @@ public class CommandsCache {
}
public void reset() {
if(change) return;
// Removed to reset the change state. Experimental change though
//if(change) return;
// Prob. gonna change it to: if (CONNECTED_TO_BUNGEE && change) return;
updateChangeState();
filteredCommands = null;
}
@@ -41,6 +41,11 @@ public class Argument {
public List<String> getResult(String input) {
String firstInputArg = input.contains(" ") ? input.split(" ")[0] : input;
for (Map.Entry<String, ArgumentStack> entry : ARGUMENT_STACKS.entrySet()) {
if(!entry.getKey().equals(firstInputArg)) continue;
return ARGUMENT_STACKS.get(entry.getKey()).getResult(input);
}
for (Map.Entry<String, ArgumentStack> entry : ARGUMENT_STACKS.entrySet()) {
if(!entry.getKey().startsWith(firstInputArg)) continue;
return ARGUMENT_STACKS.get(entry.getKey()).getResult(input);
+1 -1
View File
@@ -2,7 +2,7 @@ name: ProAntiTab
description: Hide more than just your plugins. Hide almost everything!
author: Rayzs_YT
version: 1.9.1
version: 1.9.2
main: de.rayzs.pat.plugin.BungeeLoader
softDepends:
+12 -7
View File
@@ -91,28 +91,33 @@ cancel-blocked-commands:
#>> HTP (Overwritten)
# Here you can customize your own fake '/plugins' command.
# WARNING: Commands in there are always tab-completable, if it's enabled.
custom-plugins:
enabled: true
# If this is set to true, the command will always be tab-completable,
# even if the command is supposed to be blocked
always-tab-completable: false
commands:
- pl
- plugins
- bukkit:pl
- bukkit:plugins
message:
- '&fPlugins (0):'
#>> HTP (Overwritten)
# Here you can customize your own fake '/version' command.
# WARNING: Commands in there are always tab-completable, if it's enabled.
custom-version:
enabled: true
# If this is set to true, the command will always be tab-completable,
# even if the command is supposed to be blocked
always-tab-completable: false
commands:
- icanhasbukkit
- about
- version
- ver
- icanhasbukkit
- bukkit:ver
- bukkit:version
message:
- '&fThis server is running CraftBukkit version git-NasaSpigot-294 (MC: X)'
+19 -7
View File
@@ -20,6 +20,13 @@ updater:
- '&8[&4PAT &7| &4Proxy&8] &cGet the newest version here:'
- '&8[&4PAT &7| &4Proxy&8] &ehttps://www.rayzs.de/products/proantitab/page'
# If this value is set to 'true', the proxy won't communicate with the backend servers anymore.
# In other words, the backend servers won't receive any updates from the proxy about the storage.yml.
# It's here to prevent any unnecessary communication between the proxy and the backend servers, if PAT is being used on the proxy alone.
# For why this can be the case, read the following: https://github.com/RayzsYT/ProAntiTab/wiki/FAQ#can-i-install-pat-just-on-my-proxy-server
# It is NOT recommended to enable this option, unless you know what you are doing.
disable-sync: false
# 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.
@@ -73,27 +80,32 @@ cancel-blocked-commands:
- '&cCommand &8(&4%command%&8) &cwith the provided sub-argument is not allowed!'
# Here you can customize your own fake '/plugins' command.
# WARNING: Commands in there are always tab-completable, if it's enabled.
custom-plugins:
enabled: true
# If this is set to true, the command will always be tab-completable,
# even if the command is supposed to be blocked
always-tab-completable: false
commands:
- pl
- plugins
- bukkit:pl
- bukkit:plugins
message:
- '&fPlugins (0):'
# Here you can customize your own fake '/version' command.
# WARNING: Commands in there are always tab-completable, if it's enabled.
custom-version:
enabled: true
# If this is set to true, the command will always be tab-completable,
# even if the command is supposed to be blocked
always-tab-completable: false
commands:
- icanhasbukkit
- about
- version
- ver
- icanhasbukkit
- bukkit:ver
- bukkit:version
message:
- '&fThis server is running CraftBukkit version git-NasaSpigot-294 (MC: X)'
+1 -1
View File
@@ -2,7 +2,7 @@ name: ProAntiTab
description: Hide more than just your plugins. Hide almost everything!
author: Rayzs_YT
version: 1.9.1
version: 1.9.2
api-version: 1.13
folia-supported: true
main: de.rayzs.pat.plugin.BukkitLoader