mirror of
https://github.com/RayzsYT/ProAntiTab.git
synced 2026-11-13 20:42:09 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f870625551 | ||
|
|
993aa1e439 | ||
|
|
44822601ee | ||
|
|
19e698cce4 | ||
|
|
f393156471 | ||
|
|
08e996d8df | ||
|
|
afffeed10f | ||
|
|
ac7efd60de | ||
|
|
f0db105e7f | ||
|
|
e07a8bdebb | ||
|
|
84cff08785 | ||
|
|
0f8740c54b | ||
|
|
35e1c9aca2 | ||
|
|
98848cffd1 | ||
|
|
df6b6f447d | ||
|
|
ae59f6c84b | ||
|
|
74ee1fa94c | ||
|
|
9e11143b88 | ||
|
|
9786e3e472 | ||
|
|
468c7d9bd7 | ||
|
|
640d428d70 |
No files matched your search
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>de.rayzs.pat</groupId>
|
||||
<artifactId>ProAntiTab</artifactId>
|
||||
<version>2.0.17</version>
|
||||
<version>2.0.19</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
@@ -119,6 +119,13 @@
|
||||
<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>
|
||||
@@ -220,14 +227,14 @@
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-text-minimessage</artifactId>
|
||||
<version>4.20.0</version>
|
||||
<version>4.25.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-api</artifactId>
|
||||
<version>4.20.0</version>
|
||||
<version>4.25.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import de.rayzs.pat.utils.StringUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import de.rayzs.pat.api.event.PATEventHandler;
|
||||
@@ -13,7 +13,6 @@ import de.rayzs.pat.api.event.events.FilteredTabCompletionEvent;
|
||||
import de.rayzs.pat.api.netty.bukkit.BukkitPacketAnalyzer;
|
||||
import de.rayzs.pat.api.netty.bukkit.BukkitPacketHandler;
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import de.rayzs.pat.plugin.BukkitLoader;
|
||||
import de.rayzs.pat.plugin.logger.Logger;
|
||||
import de.rayzs.pat.utils.Reflection;
|
||||
|
||||
@@ -34,75 +33,78 @@ public class LegacyPacketHandler implements BukkitPacketHandler {
|
||||
|
||||
@Override
|
||||
public boolean handleOutgoingPacket(Player player, Object packetObj) throws Exception {
|
||||
String input = BukkitPacketAnalyzer.getPlayerInput(player);
|
||||
final String rawInput = BukkitPacketAnalyzer.getPlayerInput(player);
|
||||
|
||||
if(input == null)
|
||||
if(rawInput == null)
|
||||
return false;
|
||||
|
||||
boolean cancelsBeforeHand;
|
||||
int spaces = 0;
|
||||
String input = rawInput;
|
||||
boolean cancelsBeforeHand = false;
|
||||
|
||||
if (input.startsWith("/")) {
|
||||
input = input.replace("/", "");
|
||||
if (!input.startsWith("/")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (input.contains(" ")) {
|
||||
String[] split = input.split(" ");
|
||||
spaces = split.length;
|
||||
if (spaces > 0)
|
||||
input = split[0];
|
||||
}
|
||||
input = input.substring(1);
|
||||
|
||||
cancelsBeforeHand = Storage.Blacklist.canPlayerAccessTab(player, input);
|
||||
|
||||
if (!cancelsBeforeHand)
|
||||
cancelsBeforeHand = Storage.ConfigSections.Settings.CUSTOM_VERSION.isTabCompletable(input) || Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isTabCompletable(input);
|
||||
} else return true;
|
||||
final boolean doesBypassNamespace = Storage.ConfigSections.Settings.BLOCK_NAMESPACE_COMMANDS.doesBypass(player);
|
||||
final boolean spaces = input.contains(" ");
|
||||
|
||||
if (Storage.ConfigSections.Settings.BLOCK_NAMESPACE_COMMANDS.isCommand(input) && !doesBypassNamespace) {
|
||||
cancelsBeforeHand = true;
|
||||
}
|
||||
|
||||
if (!cancelsBeforeHand && !input.isEmpty()) {
|
||||
cancelsBeforeHand = !Storage.Blacklist.canPlayerAccessTab(player, StringUtils.getFirstArg(input));
|
||||
}
|
||||
|
||||
if (!cancelsBeforeHand) {
|
||||
cancelsBeforeHand = Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isTabCompletable(input) || Storage.ConfigSections.Settings.CUSTOM_VERSION.isTabCompletable(input);
|
||||
}
|
||||
|
||||
for (Field field : Reflection.getFields(packetObj)) {
|
||||
field.setAccessible(true);
|
||||
Object result = field.get(packetObj);
|
||||
|
||||
if (!(result instanceof String[]))
|
||||
if (!(result instanceof String[])) {
|
||||
continue;
|
||||
|
||||
List<String> newResultList = new ArrayList<>();
|
||||
String[] tR = (String[]) result;
|
||||
|
||||
String tempName;
|
||||
|
||||
boolean doesBypassNamespace = Storage.ConfigSections.Settings.BLOCK_NAMESPACE_COMMANDS.doesBypass(player);
|
||||
|
||||
if (spaces == 0) {
|
||||
for (String s : tR) {
|
||||
if (!BukkitLoader.isLoaded())
|
||||
continue;
|
||||
|
||||
if (!s.startsWith("/")) {
|
||||
newResultList.add(s);
|
||||
continue;
|
||||
}
|
||||
|
||||
tempName = s.replaceFirst("/", "");
|
||||
|
||||
if (!doesBypassNamespace && Storage.ConfigSections.Settings.BLOCK_NAMESPACE_COMMANDS.isCommand(tempName))
|
||||
continue;
|
||||
|
||||
if (!Storage.Blacklist.canPlayerAccessTab(player, tempName))
|
||||
newResultList.add(s);
|
||||
}
|
||||
} else {
|
||||
if (!cancelsBeforeHand) {
|
||||
FilteredTabCompletionEvent filteredTabCompletionEvent = PATEventHandler.callFilteredTabCompletionEvents(player.getUniqueId(), input, Arrays.asList(tR));
|
||||
|
||||
if (!filteredTabCompletionEvent.isCancelled()) {
|
||||
List<String> suggestions = Arrays.stream(tR).filter(s -> filteredTabCompletionEvent.getCompletion().contains(s)).collect(Collectors.toList());
|
||||
newResultList.addAll(suggestions);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
field.set(packetObj, newResultList.toArray(new String[0]));
|
||||
String[] tR = (String[]) result;
|
||||
List<String> suggestions = new ArrayList<>(Arrays.asList(tR));
|
||||
|
||||
if (spaces) {
|
||||
|
||||
if (cancelsBeforeHand) {
|
||||
suggestions.clear();
|
||||
field.set(packetObj, suggestions.toArray(new String[0]));
|
||||
return true;
|
||||
}
|
||||
|
||||
FilteredTabCompletionEvent filteredTabCompletionEvent = PATEventHandler.callFilteredTabCompletionEvents(player.getUniqueId(), rawInput, new ArrayList<>(suggestions));
|
||||
|
||||
if (filteredTabCompletionEvent.isCancelled()) {
|
||||
suggestions.clear();
|
||||
} else {
|
||||
suggestions.removeIf(s -> !filteredTabCompletionEvent.getCompletion().contains(s));
|
||||
}
|
||||
|
||||
} else {
|
||||
suggestions.removeIf(s -> {
|
||||
String cpy = s;
|
||||
if (cpy.startsWith("/")) {
|
||||
cpy = cpy.substring(1);
|
||||
}
|
||||
|
||||
if (Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isTabCompletable(cpy) || Storage.ConfigSections.Settings.CUSTOM_VERSION.isTabCompletable(cpy)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !Storage.Blacklist.canPlayerAccessTab(player, cpy);
|
||||
});
|
||||
}
|
||||
|
||||
field.set(packetObj, suggestions.toArray(new String[0]));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -70,7 +70,7 @@ public class Storage {
|
||||
public static String TOKEN = "", SERVER_NAME = null, CURRENT_VERSION = "", NEWER_VERSION = "";
|
||||
public static boolean OUTDATED = false, SEND_CONSOLE_NOTIFICATION = true;
|
||||
public static Object PLUGIN_OBJECT;
|
||||
public static boolean USE_LUCKPERMS = false, USE_PLACEHOLDERAPI = false, USE_PAPIPROXYBRIDGE = false, USE_VIAVERSION = false, USE_VELOCITY = false, USE_SIMPLECLOUD;
|
||||
public static boolean USE_LUCKPERMS = false, USE_GROUPMANAGER = false, USE_PLACEHOLDERAPI = false, USE_PAPIPROXYBRIDGE = false, USE_VIAVERSION = false, USE_VELOCITY = false, USE_SIMPLECLOUD;
|
||||
public static long LAST_SYNC = System.currentTimeMillis();
|
||||
|
||||
public static void initialize(PluginLoader loader, String currentVersion) {
|
||||
@@ -217,7 +217,17 @@ public class Storage {
|
||||
|
||||
PermissionUtil.reloadPermissions();
|
||||
|
||||
if (Reflection.getMinor() >= 13) {
|
||||
if (Reflection.getMinor() < 13) {
|
||||
final List<UUID> playerIds = Storage.getLoader().getPlayerIds();
|
||||
final List<String> commands = new ArrayList<>(Blacklist.BLACKLIST.getCommands());
|
||||
|
||||
playerIds.forEach(playerId -> {
|
||||
List<String> playerCommands = new ArrayList<>(commands);
|
||||
playerCommands.addAll(SubArgsModule.getGroupCommands(playerId));
|
||||
|
||||
PATEventHandler.callUpdatePlayerCommandsEvents(playerId, playerCommands, true);
|
||||
});
|
||||
} else {
|
||||
BukkitAntiTabListener.handleTabCompletion();
|
||||
}
|
||||
}
|
||||
@@ -291,6 +301,7 @@ public class Storage {
|
||||
public static CustomUnknownCommandSection CUSTOM_UNKNOWN_COMMAND = new CustomUnknownCommandSection();
|
||||
public static TurnBlacklistToWhitelistSection TURN_BLACKLIST_TO_WHITELIST = new TurnBlacklistToWhitelistSection();
|
||||
public static BaseCommandCaseSensitiveSection BASE_COMMAND_CASE_SENSITIVE = new BaseCommandCaseSensitiveSection();
|
||||
public static UpdateCommandsPerWorldSection UPDATE_COMMANDS_PER_WORLD = new UpdateCommandsPerWorldSection();
|
||||
public static UpdateSection UPDATE = new UpdateSection();
|
||||
|
||||
public static void initialize() {}
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
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 UpdateCommandsPerWorldSection extends ConfigStorage {
|
||||
|
||||
public boolean ENABLED;
|
||||
|
||||
public UpdateCommandsPerWorldSection() {
|
||||
super("update-commands-per-world");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
super.load();
|
||||
|
||||
if (Reflection.isProxyServer())
|
||||
return;
|
||||
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, null, false).getOrSet();
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import de.rayzs.pat.plugin.modules.SubArgsModule;
|
||||
import de.rayzs.pat.plugin.process.CommandProcess;
|
||||
import de.rayzs.pat.api.netty.bukkit.BukkitPacketAnalyzer;
|
||||
import de.rayzs.pat.api.communication.BackendUpdater;
|
||||
import de.rayzs.pat.utils.adapter.GroupManagerAdapter;
|
||||
import de.rayzs.pat.utils.configuration.Configurator;
|
||||
import de.rayzs.pat.utils.configuration.updater.ConfigUpdater;
|
||||
import de.rayzs.pat.utils.group.TinyGroup;
|
||||
@@ -22,6 +23,7 @@ import de.rayzs.pat.plugin.metrics.bStats;
|
||||
import de.rayzs.pat.plugin.logger.Logger;
|
||||
import de.rayzs.pat.utils.response.action.ActionHandler;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import de.rayzs.pat.utils.scheduler.*;
|
||||
@@ -32,6 +34,7 @@ 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 {
|
||||
|
||||
@@ -91,7 +94,7 @@ public class BukkitLoader extends JavaPlugin implements PluginLoader {
|
||||
BukkitPacketAnalyzer.injectAll();
|
||||
} else BackendUpdater.handle();
|
||||
|
||||
manager.registerEvents(new BukkitPlayerConnectionListener(), this);
|
||||
manager.registerEvents(new BukkitPlayerListener(), this);
|
||||
manager.registerEvents(new BukkitBlockCommandListener(), this);
|
||||
|
||||
if (Reflection.getMinor() >= 13) {
|
||||
@@ -112,6 +115,12 @@ public class BukkitLoader extends JavaPlugin implements PluginLoader {
|
||||
Bukkit.getOnlinePlayers().forEach(player -> PermissionUtil.setPlayerPermissions(player.getUniqueId()));
|
||||
}
|
||||
|
||||
final Plugin groupManagerPlugin = getServer().getPluginManager().getPlugin("GroupManager");
|
||||
if (groupManagerPlugin != null) {
|
||||
GroupManagerAdapter.initialize(groupManagerPlugin);
|
||||
Bukkit.getOnlinePlayers().forEach(player -> PermissionUtil.setPlayerPermissions(player.getUniqueId()));
|
||||
}
|
||||
|
||||
if (getServer().getPluginManager().getPlugin("ViaVersion") != null)
|
||||
ViaVersionAdapter.initialize();
|
||||
|
||||
@@ -207,7 +216,7 @@ public class BukkitLoader extends JavaPlugin implements PluginLoader {
|
||||
|
||||
@Override
|
||||
public List<UUID> getPlayerIds() {
|
||||
return null;
|
||||
return Bukkit.getOnlinePlayers().stream().map(Entity::getUniqueId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -246,6 +255,14 @@ public class BukkitLoader extends JavaPlugin implements PluginLoader {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
public static void delayedPermissionsReload() {
|
||||
PATScheduler.createScheduler(PermissionUtil::reloadPermissions, 40);
|
||||
}
|
||||
|
||||
public static void userPermissionsReload(UUID uuid) {
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(BukkitLoader.getPlugin(), () -> PermissionUtil.reloadPermissions(uuid));
|
||||
}
|
||||
|
||||
public void startUpdaterTask() {
|
||||
if (!Storage.ConfigSections.Settings.UPDATE.ENABLED)
|
||||
return;
|
||||
|
||||
@@ -21,7 +21,6 @@ import de.rayzs.pat.utils.adapter.LuckPermsAdapter;
|
||||
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.ConnectionBuilder;
|
||||
import de.rayzs.pat.utils.VersionComparer;
|
||||
import de.rayzs.pat.plugin.logger.Logger;
|
||||
import com.velocitypowered.api.plugin.*;
|
||||
@@ -38,7 +37,7 @@ import java.util.*;
|
||||
|
||||
@Plugin(name = "ProAntiTab",
|
||||
id = "proantitab",
|
||||
version = "2.0.17",
|
||||
version = "2.0.19",
|
||||
authors = "Rayzs_YT",
|
||||
description = "Hide more than just your plugins. Hide almost everything!",
|
||||
url = "https://www.rayzs.de/products/proantitab/page",
|
||||
|
||||
@@ -69,14 +69,6 @@ public class BukkitAntiTabListener implements Listener {
|
||||
|
||||
// --------------- LUCKPERMS SECTIONS --------------- //
|
||||
|
||||
public static void luckpermsNetworkSync() {
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(BukkitLoader.getPlugin(), PermissionUtil::reloadPermissions, 40);
|
||||
}
|
||||
|
||||
public static void luckpermsNetworkUserSync(UUID uuid) {
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(BukkitLoader.getPlugin(), () -> PermissionUtil.reloadPermissions(uuid));
|
||||
}
|
||||
|
||||
public static void updateCommands() {
|
||||
Bukkit.getOnlinePlayers().forEach(BukkitAntiTabListener::updateCommands);
|
||||
}
|
||||
|
||||
+113
-84
@@ -1,84 +1,113 @@
|
||||
package de.rayzs.pat.plugin.listeners.bukkit;
|
||||
|
||||
import de.rayzs.pat.api.brand.CustomServerBrand;
|
||||
import de.rayzs.pat.api.event.PATEventHandler;
|
||||
import de.rayzs.pat.api.event.events.ServerPlayersChangeEvent;
|
||||
import de.rayzs.pat.api.netty.bukkit.BukkitPacketAnalyzer;
|
||||
import de.rayzs.pat.api.communication.BackendUpdater;
|
||||
import de.rayzs.pat.plugin.logger.Logger;
|
||||
import de.rayzs.pat.utils.message.MessageTranslator;
|
||||
import de.rayzs.pat.utils.permission.PermissionUtil;
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import de.rayzs.pat.utils.scheduler.PATScheduler;
|
||||
import de.rayzs.pat.utils.sender.CommandSender;
|
||||
import de.rayzs.pat.utils.sender.CommandSenderHandler;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.*;
|
||||
|
||||
public class BukkitPlayerConnectionListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
PATEventHandler.callServerPlayersChangeEvents(player, ServerPlayersChangeEvent.Type.JOINED);
|
||||
|
||||
if (Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED)
|
||||
BackendUpdater.handle();
|
||||
|
||||
PermissionUtil.setPlayerPermissions(player.getUniqueId());
|
||||
CustomServerBrand.preparePlayer(player);
|
||||
|
||||
if (CustomServerBrand.isEnabled())
|
||||
CustomServerBrand.sendBrandToPlayer(player);
|
||||
|
||||
if (!Storage.USE_LUCKPERMS && !Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED) {
|
||||
PATScheduler.createScheduler(() -> {
|
||||
CommandSender sender = CommandSenderHandler.from(player);
|
||||
|
||||
assert sender != null;
|
||||
PermissionUtil.reloadPermissions(sender);
|
||||
BukkitAntiTabListener.handleTabCompletion(player.getUniqueId());
|
||||
}, 20);
|
||||
}
|
||||
|
||||
if (!BukkitPacketAnalyzer.inject(player)) {
|
||||
|
||||
PATScheduler.createScheduler(() -> {
|
||||
if (player.isOnline()) {
|
||||
if (!BukkitPacketAnalyzer.inject(player)) {
|
||||
Logger.warning("Failed to inject into player! (" + player.getName() + ")" );
|
||||
player.kickPlayer("Failed to inject player!");
|
||||
}
|
||||
}
|
||||
}, 10);
|
||||
|
||||
}
|
||||
|
||||
if(Storage.OUTDATED && PermissionUtil.hasPermission(player, "joinupdate")) {
|
||||
PATScheduler.createScheduler(() -> {
|
||||
if (player.isOnline()) {
|
||||
MessageTranslator.send(player, Storage.ConfigSections.Settings.UPDATE.OUTDATED.getLines());
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler (priority = EventPriority.LOWEST)
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
PATEventHandler.callServerPlayersChangeEvents(player, ServerPlayersChangeEvent.Type.LEFT);
|
||||
|
||||
BukkitPacketAnalyzer.uninject(player.getUniqueId());
|
||||
PermissionUtil.resetPermissions(player.getUniqueId());
|
||||
if(Storage.ConfigSections.Settings.CUSTOM_BRAND.REPEAT_DELAY != -1) return;
|
||||
}
|
||||
|
||||
@EventHandler (priority = EventPriority.LOWEST)
|
||||
public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(Storage.ConfigSections.Settings.CUSTOM_BRAND.REPEAT_DELAY != -1) return;
|
||||
|
||||
CustomServerBrand.sendBrandToPlayer(player);
|
||||
}
|
||||
}
|
||||
package de.rayzs.pat.plugin.listeners.bukkit;
|
||||
|
||||
import de.rayzs.pat.api.brand.CustomServerBrand;
|
||||
import de.rayzs.pat.api.event.PATEventHandler;
|
||||
import de.rayzs.pat.api.event.events.ServerPlayersChangeEvent;
|
||||
import de.rayzs.pat.api.netty.bukkit.BukkitPacketAnalyzer;
|
||||
import de.rayzs.pat.api.communication.BackendUpdater;
|
||||
import de.rayzs.pat.plugin.logger.Logger;
|
||||
import de.rayzs.pat.plugin.modules.SubArgsModule;
|
||||
import de.rayzs.pat.utils.Reflection;
|
||||
import de.rayzs.pat.utils.message.MessageTranslator;
|
||||
import de.rayzs.pat.utils.permission.PermissionUtil;
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import de.rayzs.pat.utils.scheduler.PATScheduler;
|
||||
import de.rayzs.pat.utils.sender.CommandSender;
|
||||
import de.rayzs.pat.utils.sender.CommandSenderHandler;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class BukkitPlayerListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
final UUID uuid = player.getUniqueId();
|
||||
|
||||
PATEventHandler.callServerPlayersChangeEvents(player, ServerPlayersChangeEvent.Type.JOINED);
|
||||
|
||||
if (Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED) {
|
||||
BackendUpdater.handle();
|
||||
}
|
||||
|
||||
PermissionUtil.setPlayerPermissions(player.getUniqueId());
|
||||
CustomServerBrand.preparePlayer(player);
|
||||
|
||||
if (CustomServerBrand.isEnabled()) {
|
||||
CustomServerBrand.sendBrandToPlayer(player);
|
||||
}
|
||||
|
||||
if (!Storage.USE_LUCKPERMS && !Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED) {
|
||||
PATScheduler.createScheduler(() -> {
|
||||
CommandSender sender = CommandSenderHandler.from(player);
|
||||
|
||||
assert sender != null;
|
||||
PermissionUtil.reloadPermissions(sender);
|
||||
|
||||
if (Reflection.getMinor() >= 13) {
|
||||
BukkitAntiTabListener.handleTabCompletion(player.getUniqueId());
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
|
||||
if (!BukkitPacketAnalyzer.inject(player)) {
|
||||
PATScheduler.createScheduler(() -> {
|
||||
if (player.isOnline()) {
|
||||
if (!BukkitPacketAnalyzer.inject(player)) {
|
||||
Logger.warning("Failed to inject into player! (" + player.getName() + ")" );
|
||||
player.kickPlayer("Failed to inject player!");
|
||||
}
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
|
||||
if (Reflection.getMinor() < 13) {
|
||||
List<String> playerCommands = new ArrayList<>(SubArgsModule.getServerCommands(uuid));
|
||||
playerCommands.addAll(SubArgsModule.getGroupCommands(uuid));
|
||||
|
||||
PATEventHandler.callUpdatePlayerCommandsEvents(uuid, playerCommands, false);
|
||||
}
|
||||
|
||||
if (Storage.OUTDATED && PermissionUtil.hasPermission(player, "joinupdate")) {
|
||||
PATScheduler.createScheduler(() -> {
|
||||
if (player.isOnline()) {
|
||||
MessageTranslator.send(player, Storage.ConfigSections.Settings.UPDATE.OUTDATED.getLines());
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler (priority = EventPriority.LOWEST)
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
PATEventHandler.callServerPlayersChangeEvents(player, ServerPlayersChangeEvent.Type.LEFT);
|
||||
|
||||
BukkitPacketAnalyzer.uninject(player.getUniqueId());
|
||||
PermissionUtil.resetPermissions(player.getUniqueId());
|
||||
}
|
||||
|
||||
@EventHandler (priority = EventPriority.LOWEST)
|
||||
public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (Storage.ConfigSections.Settings.CUSTOM_BRAND.REPEAT_DELAY == -1) {
|
||||
CustomServerBrand.sendBrandToPlayer(player);
|
||||
}
|
||||
|
||||
if (Storage.ConfigSections.Settings.UPDATE_COMMANDS_PER_WORLD.ENABLED) {
|
||||
CommandSender sender = CommandSenderHandler.from(player);
|
||||
|
||||
assert sender != null;
|
||||
PermissionUtil.reloadPermissions(sender);
|
||||
|
||||
if (Reflection.getMinor() >= 13) {
|
||||
BukkitAntiTabListener.handleTabCompletion(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import de.rayzs.pat.plugin.process.impl.local.modify.list.ListPrioritiesCommand;
|
||||
import de.rayzs.pat.plugin.process.impl.local.system.NotifyCommand;
|
||||
import de.rayzs.pat.plugin.process.impl.local.system.PostDebugCommand;
|
||||
import de.rayzs.pat.plugin.process.impl.local.system.ReloadCommand;
|
||||
import de.rayzs.pat.plugin.process.impl.local.system.UpdateCommand;
|
||||
import de.rayzs.pat.plugin.process.impl.server.ServAddCommand;
|
||||
import de.rayzs.pat.plugin.process.impl.server.ServClearCommand;
|
||||
import de.rayzs.pat.plugin.process.impl.server.ServRemoveCommand;
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package de.rayzs.pat.plugin.process.impl.local.info;
|
||||
package de.rayzs.pat.plugin.process.impl.local.system;
|
||||
|
||||
import de.rayzs.pat.plugin.listeners.bukkit.BukkitAntiTabListener;
|
||||
import de.rayzs.pat.utils.Reflection;
|
||||
@@ -35,7 +35,7 @@ public class UpdateCommand extends ProCommand {
|
||||
}
|
||||
});
|
||||
|
||||
if (!Reflection.isProxyServer()) {
|
||||
if (!Reflection.isProxyServer() && Reflection.getMinor() >= 13) {
|
||||
BukkitAntiTabListener.handleTabCompletion();
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class UpdateCommand extends ProCommand {
|
||||
|
||||
PermissionUtil.reloadPermissions(targetSender);
|
||||
|
||||
if (!Reflection.isProxyServer()) {
|
||||
if (!Reflection.isProxyServer() && Reflection.getMinor() >= 13) {
|
||||
BukkitAntiTabListener.handleTabCompletion(uuid);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package de.rayzs.pat.utils.adapter;
|
||||
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import de.rayzs.pat.plugin.BukkitLoader;
|
||||
import de.rayzs.pat.plugin.listeners.bukkit.BukkitAntiTabListener;
|
||||
import de.rayzs.pat.utils.Reflection;
|
||||
import de.rayzs.pat.utils.permission.PermissionUtil;
|
||||
import de.rayzs.pat.utils.scheduler.PATScheduler;
|
||||
import org.anjocaido.groupmanager.GroupManager;
|
||||
import org.anjocaido.groupmanager.events.GMGroupEvent;
|
||||
import org.anjocaido.groupmanager.events.GMSystemEvent;
|
||||
import org.anjocaido.groupmanager.events.GMUserEvent;
|
||||
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class GroupManagerAdapter implements Listener {
|
||||
|
||||
private static GroupManager manager;
|
||||
|
||||
public static void initialize(Plugin plugin) {
|
||||
manager = (GroupManager) plugin;
|
||||
Storage.USE_GROUPMANAGER = true;
|
||||
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new GroupManagerListener(), BukkitLoader.getPlugin());
|
||||
}
|
||||
|
||||
public static void setPermissions(UUID uuid) {
|
||||
final Player player = Bukkit.getPlayer(uuid);
|
||||
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final AnjoPermissionsHandler handler = manager.getWorldsHolder().getWorldPermissions(player);
|
||||
handler.getAllPlayersPermissions(player.getName()).stream()
|
||||
.filter(permission -> permission.startsWith("proantitab."))
|
||||
.forEach(permission -> PermissionUtil.setPermission(uuid, permission, true));
|
||||
|
||||
if (Reflection.getMinor() >= 13) {
|
||||
BukkitAntiTabListener.handleTabCompletion(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
private static class GroupManagerListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onGMUser(GMUserEvent event) {
|
||||
PATScheduler.createScheduler(() -> {
|
||||
BukkitLoader.userPermissionsReload(event.getUser().getBukkitPlayer().getUniqueId());
|
||||
}, 10);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onGMGroup(GMGroupEvent event) {
|
||||
PATScheduler.createScheduler(() -> {
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
BukkitLoader.userPermissionsReload(player.getUniqueId());
|
||||
});
|
||||
}, 10);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onGMSystem(GMSystemEvent event) {
|
||||
PATScheduler.createScheduler(() -> {
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
BukkitLoader.userPermissionsReload(player.getUniqueId());
|
||||
});
|
||||
}, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,9 +29,7 @@ public class LuckPermsAdapter {
|
||||
eventBus.subscribe(Storage.PLUGIN_OBJECT, NodeMutateEvent.class, LuckPermsAdapter::onNoteMutate);
|
||||
|
||||
if (!Reflection.isProxyServer()) {
|
||||
|
||||
if (BukkitLoader.useSuggestions())
|
||||
eventBus.subscribe(Storage.PLUGIN_OBJECT, PreNetworkSyncEvent.class, event -> BukkitAntiTabListener.luckpermsNetworkSync());
|
||||
eventBus.subscribe(Storage.PLUGIN_OBJECT, PreNetworkSyncEvent.class, event -> BukkitLoader.delayedPermissionsReload());
|
||||
|
||||
} else {
|
||||
|
||||
@@ -107,10 +105,7 @@ public class LuckPermsAdapter {
|
||||
UUID uuid = user.getUniqueId();
|
||||
|
||||
if (!Reflection.isProxyServer()) {
|
||||
|
||||
if (Reflection.getMinor() >= 13)
|
||||
BukkitAntiTabListener.luckpermsNetworkUserSync(user.getUniqueId());
|
||||
|
||||
BukkitLoader.userPermissionsReload(user.getUniqueId());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package de.rayzs.pat.utils.permission;
|
||||
import java.util.*;
|
||||
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import de.rayzs.pat.utils.adapter.GroupManagerAdapter;
|
||||
import de.rayzs.pat.utils.group.GroupManager;
|
||||
import de.rayzs.pat.utils.sender.CommandSender;
|
||||
import de.rayzs.pat.utils.sender.CommandSenderHandler;
|
||||
@@ -57,6 +58,8 @@ public class PermissionUtil {
|
||||
public static void setPlayerPermissions(CommandSender sender) {
|
||||
if (Storage.USE_LUCKPERMS) {
|
||||
LuckPermsAdapter.setPermissions(sender.getUniqueId());
|
||||
} else if (Storage.USE_GROUPMANAGER) {
|
||||
GroupManagerAdapter.setPermissions(sender.getUniqueId());
|
||||
} else {
|
||||
GroupManager.getGroups().forEach(group -> group.hasPermission(sender));
|
||||
}
|
||||
@@ -65,6 +68,8 @@ public class PermissionUtil {
|
||||
public static void setPlayerPermissions(UUID uuid) {
|
||||
if (Storage.USE_LUCKPERMS) {
|
||||
LuckPermsAdapter.setPermissions(uuid);
|
||||
} else if (Storage.USE_GROUPMANAGER) {
|
||||
GroupManagerAdapter.setPermissions(uuid);
|
||||
} else {
|
||||
GroupManager.getGroups().forEach(group -> group.hasPermission(uuid));
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ description: Hide more than just your plugins. Hide almost everything!
|
||||
website: https://www.rayzs.de/products/proantitab/page
|
||||
|
||||
author: Rayzs_YT
|
||||
version: 2.0.17
|
||||
version: 2.0.19
|
||||
main: de.rayzs.pat.plugin.BungeeLoader
|
||||
|
||||
softDepends: [LuckPerms, PAPIProxyBridge]
|
||||
@@ -48,6 +48,7 @@ handle-through-proxy:
|
||||
enabled: false
|
||||
name: "PAT_TOKEN"
|
||||
|
||||
|
||||
#>> HTP
|
||||
# This is a very necessary feature if you have way too many commands to block and instead decide
|
||||
# to whitelist specific commands.
|
||||
@@ -63,6 +64,18 @@ turn-blacklist-to-whitelist: true
|
||||
# Pro tip: You can also just use auto-lowercase-commands feature instead. ^^
|
||||
base-command-case-sensitive: true
|
||||
|
||||
# (!) Warning:
|
||||
# Enabling this could lead to performance issues if many players
|
||||
# change worlds frequently in short amount of time.
|
||||
#
|
||||
# This decides whether PAT updates the commands for a player after changing worlds.
|
||||
# Enabling this allows you to make per-world commands using PAT's group system by
|
||||
# giving a user/group the PAT group permission using a LuckPerms world as context.
|
||||
#
|
||||
# Example command:
|
||||
# lp (...) permission set proantitab.group.<group> world=<world>
|
||||
update-commands-per-world: false
|
||||
|
||||
# Here you can customize the server version that is displayed on a ping. (The text at the player-count)
|
||||
# (!) Warning: It's required to use Paper or Purpur to use this feature!
|
||||
# (!) Supported server versions: 1.12.2 - latest
|
||||
|
||||
@@ -3,7 +3,7 @@ description: Hide more than just your plugins. Hide almost everything!
|
||||
website: https://www.rayzs.de/products/proantitab/page
|
||||
|
||||
author: Rayzs_YT
|
||||
version: 2.0.17
|
||||
version: 2.0.19
|
||||
api-version: 1.13
|
||||
folia-supported: true
|
||||
main: de.rayzs.pat.plugin.BukkitLoader
|
||||
|
||||
Reference in new issue
Block a user