Compare commits

...
7 Commits
Author SHA1 Message Date
RayzsYT 1f7e6cd77a Fix exception on <1.21 servers 2024-10-31 20:38:40 +01:00
RayzsYT 34cba027f9 Even more improved server-based commands 2024-10-31 20:30:39 +01:00
RayzsYT db42fc1295 Updated version 2024-10-31 20:00:53 +01:00
RayzsYT 5270a432e9 Improve per-server functionality (same server-endings) 2024-10-31 19:56:25 +01:00
RayzsYT ab052d62b5 Minor code improvement 2024-10-31 12:55:21 +01:00
RayzsYT a878944b33 Updated version name 2024-10-27 13:04:34 +01:00
RayzsYT cb349e8abb Fixed CustomServerBrand issues with Folia 2024-10-27 13:02:25 +01:00
9 changed files with 41 additions and 21 deletions

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>de.rayzs.pat</groupId>
<artifactId>ProAntiTab</artifactId>
<version>1.8.3</version>
<version>1.8.5</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
@@ -5,6 +5,8 @@ import de.rayzs.pat.utils.message.MessageTranslator;
import java.util.concurrent.atomic.AtomicInteger;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.plugin.BukkitLoader;
import de.rayzs.pat.utils.scheduler.PATScheduler;
import de.rayzs.pat.utils.scheduler.PATSchedulerTask;
import io.netty.channel.Channel;
import de.rayzs.pat.api.brand.*;
import org.bukkit.entity.Player;
@@ -19,7 +21,7 @@ public class BukkitServerBrand implements ServerBrand {
private static final List<Player> MODIFIED_BRAND_PLAYERS = new ArrayList<>();
private static final Server SERVER = Bukkit.getServer();
private static String BRAND = Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().get(0);
private static int TASK = -1;
private static PATSchedulerTask TASK;
private static boolean INITIALIZED = false;
private static Class<?> brandPayloadClass, clientBoundCustomPacketPayloadPacketClass, customPacketPayloadPacketClass;
@@ -48,9 +50,9 @@ public class BukkitServerBrand implements ServerBrand {
exception.printStackTrace();
}
if(TASK != -1) {
Bukkit.getScheduler().cancelTask(TASK);
TASK = -1;
if(TASK != null && TASK.isActive()) {
TASK.cancelTask();
TASK = null;
MODIFIED_BRAND_PLAYERS.clear();
}
@@ -58,12 +60,13 @@ public class BukkitServerBrand implements ServerBrand {
if(Storage.ConfigSections.Settings.CUSTOM_BRAND.REPEAT_DELAY == -1) {
BRAND = Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().get(0) + "§r";
TASK = Bukkit.getScheduler().scheduleAsyncRepeatingTask(BukkitLoader.getPlugin(), () -> {
PATScheduler.createAsyncScheduler(() -> {
Bukkit.getOnlinePlayers().forEach(this::send);
}, 1, Storage.ConfigSections.Settings.CUSTOM_BRAND.REPEAT_DELAY);
} else {
AtomicInteger animationState = new AtomicInteger(0);
TASK = Bukkit.getScheduler().scheduleAsyncRepeatingTask(BukkitLoader.getPlugin(), () -> {
TASK = PATScheduler.createAsyncScheduler(() -> {
if (animationState.getAndIncrement() >= Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().size() - 1)
animationState.set(0);
BRAND = Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().get(animationState.get()) + "§r";
@@ -62,7 +62,7 @@ public class ModernPacketHandler implements BukkitPacketHandler {
if(!cancelsBeforeHand) cancelsBeforeHand = Storage.ConfigSections.Settings.CUSTOM_VERSION.isCommand(input) || Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isCommand(input);
}
if(is121Packet || Reflection.isPaper() && packetObj.getClass().getSimpleName().equals("PacketPlayOutTabComplete")) {
if(is121Packet || Reflection.isFoliaServer() && packetObj.getClass().getSimpleName().equals("PacketPlayOutTabComplete")) {
try {
Field suggestionsField = Reflection.getFieldsByTypeNormal(packetObj.getClass(), "List", Reflection.SearchOption.ENDS).get(0);
List<?> suggestionsTmp = (List<?>) suggestionsField.get(packetObj),
@@ -189,7 +189,7 @@ public class Storage {
public static class Blacklist {
private static HashMap<String, GeneralBlacklist> SERVER_BLACKLISTS = new HashMap<>();
private static final HashMap<String, GeneralBlacklist> SERVER_BLACKLISTS = new HashMap<>();
private static final GeneralBlacklist BLACKLIST = BlacklistCreator.createGeneralBlacklist();
private static final IgnoredServersStorage IGNORED_SERVERS = new GeneralIgnoredServers();
private static final ExpireCache<String, List<GeneralBlacklist>> CACHED_SERVER_BLACKLIST = new ExpireCache<>(1, TimeUnit.HOURS);
@@ -342,13 +342,22 @@ public class Storage {
}
public static boolean isListed(Object playerObj, String command, boolean intensive, boolean listed, boolean slash, String server) {
return isListed(playerObj, command, intensive, listed, slash, server, false);
}
public static boolean isListed(Object playerObj, String command, boolean intensive, boolean listed, boolean slash, String server, boolean instantReturn) {
if(GroupManager.getGroupsByServer(server).stream().anyMatch(group -> isInListed(command, group.getAllCommands(server), intensive) && group.hasPermission(playerObj)))
return false;
if(!listed) for (GeneralBlacklist blacklist : getBlacklists(server)) {
if(listed) return true;
for (GeneralBlacklist blacklist : getBlacklists(server)) {
listed = blacklist.isListed(command, intensive, true, slash);
if(instantReturn) return listed;
if(listed) break;
}
return listed;
}
@@ -371,18 +380,26 @@ public class Storage {
if(focusOnBlock && blockedGlobal) return true;
for (GeneralBlacklist blacklist : getBlacklists(server)) {
if(!focusOnBlock) {
blockedServer = blacklist.isBlockedIgnorePermission(command, intensive);
if (blockedServer) break;
} else {
if(blacklist.isBlocked(command, intensive)) return true;
if(focusOnBlock && blacklist.isBlocked(command, intensive))
return true;
blockedServer = blacklist.isBlockedIgnorePermission(command, intensive);
break;
/* Former code
if (!blacklist.isBlockedIgnorePermission(command, intensive)) {
blockedServer = false;
break;
}
blockedServer = true;
*/
}
blocked = turn ? blockedGlobal && blockedServer : blockedServer || blockedGlobal;
if(!blocked
&& CACHED_SERVER_BLACKLIST.contains(server)
&& CACHED_SERVER_BLACKLIST.get(server).size() == 0)
&& CACHED_SERVER_BLACKLIST.get(server).isEmpty())
if(turn) blocked = true;
return blocked;
@@ -28,7 +28,7 @@ import java.util.*;
@Plugin(name = "ProAntiTab",
id = "proantitab",
version = "1.8.3",
version = "1.8.5",
authors = "Rayzs_YT",
description = "Hide more than just your plugins. Hide almost everything!",
dependencies = {
@@ -84,7 +84,7 @@ public class BungeeBlockCommandListener implements Listener {
}
listed = Storage.Blacklist.isListed(command, false, true, false);
serverListed = Storage.Blacklist.isListed(player, command, false, listed, false, serverName);
serverListed = Storage.Blacklist.isListed(player, command, false, listed, false, serverName, true);
ignored = Storage.Blacklist.isOnIgnoredServer(serverName);
if(ignored ? !listed && serverListed : serverListed) {
@@ -196,7 +196,7 @@ public class VelocityBlockCommandListener {
}
listed = Storage.Blacklist.isListed(command, false, true, false);
serverListed = Storage.Blacklist.isListed(player, command, false, listed, false, serverName);
serverListed = Storage.Blacklist.isListed(player, command, false, listed, false, serverName, true);
ignored = Storage.Blacklist.isOnIgnoredServer(serverName);
if (ignored ? !listed && serverListed : serverListed) {
+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.8.3
version: 1.8.5
main: de.rayzs.pat.plugin.BungeeLoader
softDepends:
+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.8.3
version: 1.8.5
api-version: 1.13
folia-supported: true
main: de.rayzs.pat.plugin.BukkitLoader