mirror of
https://github.com/RayzsYT/ProAntiTab.git
synced 2026-11-07 01:52:35 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a9afbad0a2 | ||
|
|
d625212ac1 | ||
|
|
ee23b2d47e | ||
|
|
30714d5b7d | ||
|
|
07734f70bb | ||
|
|
367d0cec7e |
No files matched your search
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>de.rayzs.pat</groupId>
|
||||
<artifactId>ProAntiTab</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.4</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
|
||||
@@ -38,7 +38,7 @@ import java.util.*;
|
||||
|
||||
@Plugin(name = "ProAntiTab",
|
||||
id = "proantitab",
|
||||
version = "2.0.3",
|
||||
version = "2.0.4",
|
||||
authors = "Rayzs_YT",
|
||||
description = "Hide more than just your plugins. Hide almost everything!",
|
||||
url = "https://www.rayzs.de/products/proantitab/page",
|
||||
|
||||
@@ -124,4 +124,36 @@ public class SubArgsModule {
|
||||
});
|
||||
return commands;
|
||||
}
|
||||
|
||||
public static String replacePlaceholders(String input) {
|
||||
String[] split = input.split(" ");
|
||||
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
String s = split[i];
|
||||
|
||||
boolean number = NumberUtils.isDigit(split[i]),
|
||||
online = Storage.getLoader().isPlayerOnline(s),
|
||||
general = Storage.getLoader().doesPlayerExist(s);
|
||||
|
||||
if (number) {
|
||||
split[i] = "%numbers%";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (online && general) {
|
||||
split[i] = "%both_players%";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (online) {
|
||||
split[i] = "%online_players%";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (general)
|
||||
split[i] = "%players%";
|
||||
}
|
||||
|
||||
return String.join(" ", split);
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,8 @@ public class ExecuteCommand extends ExecuteCommandEvent {
|
||||
List<String> commands = new ArrayList<>(arguments.CHAT_ARGUMENTS.getGeneralArgument().getInputs());
|
||||
|
||||
final String unmodifiable = command;
|
||||
if (commands.stream().noneMatch(c -> StringUtils.getFirstArg(c).equalsIgnoreCase(StringUtils.getFirstArg(unmodifiable)))) {
|
||||
final String firstArgUnmodifiable = StringUtils.getFirstArg(unmodifiable);
|
||||
if (commands.stream().noneMatch(c -> StringUtils.getFirstArg(c).equalsIgnoreCase(firstArgUnmodifiable))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -102,10 +103,12 @@ public class ExecuteCommand extends ExecuteCommandEvent {
|
||||
return c;
|
||||
}).toList();
|
||||
|
||||
List<String> placeholderCommands = commands.stream().filter(s -> s.contains("%")).toList();
|
||||
List<String> placeholderCommands = commands.stream().filter(s ->
|
||||
StringUtils.getFirstArg(s).equalsIgnoreCase(firstArgUnmodifiable) && s.contains("%")
|
||||
).toList();
|
||||
|
||||
if (!placeholderCommands.isEmpty())
|
||||
command = replacePlaceholders(command, placeholderCommands);
|
||||
command = SubArgsModule.replacePlaceholders(command);
|
||||
|
||||
String cpyCommand;
|
||||
for (String c : commands) {
|
||||
@@ -139,36 +142,4 @@ public class ExecuteCommand extends ExecuteCommandEvent {
|
||||
|
||||
return turn == listed;
|
||||
}
|
||||
|
||||
private String replacePlaceholders(String input, List<String> abnormalCommands) {
|
||||
String[] split = input.split(" ");
|
||||
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
String s = split[i];
|
||||
|
||||
boolean number = NumberUtils.isDigit(split[i]),
|
||||
online = Storage.getLoader().isPlayerOnline(s),
|
||||
general = Storage.getLoader().doesPlayerExist(s);
|
||||
|
||||
if (number) {
|
||||
split[i] = "%numbers%";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (online && general) {
|
||||
split[i] = "%both_players%";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (online) {
|
||||
split[i] = "%online_players%";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (general)
|
||||
split[i] = "%players%";
|
||||
}
|
||||
|
||||
return String.join(" ", split);
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,10 @@ public class TabCompletion extends FilteredTabCompletionEvent {
|
||||
|
||||
if (result.contains("%numbers%")) {
|
||||
possibilities.remove("%numbers%");
|
||||
possibilities.addAll(possibilities.stream().filter(NumberUtils::isDigit).toList());
|
||||
possibilities.addAll(event.getCompletion().stream().filter(NumberUtils::isDigit).toList());
|
||||
|
||||
if (possibilities.isEmpty())
|
||||
possibilities.add("///////////");
|
||||
}
|
||||
|
||||
if (result.contains("%players%")) {
|
||||
@@ -67,7 +70,8 @@ public class TabCompletion extends FilteredTabCompletionEvent {
|
||||
return result.contains(completion);
|
||||
}).toList());
|
||||
|
||||
if (possibilities.isEmpty()) possibilities.add("///////////");
|
||||
if (possibilities.isEmpty())
|
||||
possibilities.add("///////////");
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -85,7 +89,9 @@ public class TabCompletion extends FilteredTabCompletionEvent {
|
||||
}
|
||||
|
||||
cursor = StringUtils.getFirstArg(cursor.toLowerCase());
|
||||
if(possibilities.isEmpty() && !SubArgsModule.GENERAL_LIST.contains(cursor)) return;
|
||||
if (possibilities.isEmpty() && !SubArgsModule.GENERAL_LIST.contains(cursor)) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCompletion(possibilities);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,9 @@ public class ArgumentBuilder {
|
||||
String firstInputArg = input.contains(" ") ? input.split(" ")[0] : input;
|
||||
|
||||
for (Map.Entry<String, ArgumentStack> entry : source.ARGUMENT_STACKS.entrySet()) {
|
||||
if(!entry.getKey().equals(firstInputArg)) continue;
|
||||
if (!entry.getKey().equals(firstInputArg))
|
||||
continue;
|
||||
|
||||
return source.ARGUMENT_STACKS.get(entry.getKey()).getResult(input);
|
||||
}
|
||||
|
||||
@@ -31,7 +33,8 @@ public class ArgumentBuilder {
|
||||
}
|
||||
|
||||
public void buildArgumentStacks(String input) {
|
||||
if(!input.contains(" ")) return;
|
||||
if (!input.contains(" "))
|
||||
return;
|
||||
|
||||
if(!source.INPUTS.contains(input))
|
||||
source.INPUTS.add(input);
|
||||
@@ -40,7 +43,7 @@ public class ArgumentBuilder {
|
||||
ArgumentStack argumentStack = null;
|
||||
|
||||
for (String s : input.split(" ")) {
|
||||
if(!first) {
|
||||
if (!first) {
|
||||
argumentStack = argumentStack.createAndGetArgumentStack(s);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -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.3
|
||||
version: 2.0.4
|
||||
main: de.rayzs.pat.plugin.BungeeLoader
|
||||
|
||||
softDepends: [LuckPerms, PAPIProxyBridge]
|
||||
@@ -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.3
|
||||
version: 2.0.4
|
||||
api-version: 1.13
|
||||
folia-supported: true
|
||||
main: de.rayzs.pat.plugin.BukkitLoader
|
||||
|
||||
Reference in new issue
Block a user