Compare commits

...
7 Commits
8 changed files with 68 additions and 36 deletions

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>de.rayzs.pat</groupId>
<artifactId>ProAntiTab</artifactId>
<version>2.0.19</version>
<version>2.0.20</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
@@ -37,7 +37,7 @@ import java.util.*;
@Plugin(name = "ProAntiTab",
id = "proantitab",
version = "2.0.19",
version = "2.0.20",
authors = "Rayzs_YT",
description = "Hide more than just your plugins. Hide almost everything!",
url = "https://www.rayzs.de/products/proantitab/page",
@@ -108,6 +108,12 @@ public class Logger {
.append(Storage.USE_LUCKPERMS)
.append("\n");
if (!Reflection.isProxyServer()) {
builder.append(" GroupManager: ")
.append(Storage.USE_GROUPMANAGER)
.append("\n");
}
builder.append(" PlaceholderAPI: ")
.append(Storage.USE_PLACEHOLDERAPI)
.append("\n");
@@ -25,50 +25,56 @@ public class ResponseHandler {
}
public static String replaceArgsVariables(String input, String command) {
if (!input.contains(" "))
return input;
final String[] commandSplit = command.contains(" ") ? command.split(" ") : new String[] { command };
final String[] inputSplit = input.contains(" ") ? input.split(" ") : new String[] { input };
String[] commandSplit = command.contains(" ") ? command.split(" ") : new String[]{command};
String[] split = input.split(" ");
final StringBuilder output = new StringBuilder();
final int commandLength = commandSplit.length;
for (int i = 0; i < split.length; i++) {
String part = split[i];
for (int i = 0; i < inputSplit.length; i++) {
String part = inputSplit[i];
if (! (part.startsWith("%args[") && part.endsWith("]%")))
if (i > 0) {
output.append(" ");
}
if (! (part.startsWith("%args[") && part.endsWith("]%"))) {
output.append(part);
continue;
}
part = part.substring(part.indexOf('[') + 1, part.lastIndexOf(']'));
int length = commandSplit.length, fromIndex, toIndex;
int fromIndex, toIndex;
if (part.contains("-")) {
String[] indexSplit = part.split("-");
try {
if (part.contains("-")) {
final String[] partSplit = part.split("-");
fromIndex = Integer.parseInt(partSplit[0]);
toIndex = Integer.parseInt(partSplit[1]);
} else if (part.startsWith("_")) {
final String[] partSplit = part.split("_");
fromIndex = 0;
toIndex = Integer.parseInt(partSplit[1]);
} else if (part.endsWith("_")) {
final String[] partSplit = part.split("_");
fromIndex = Integer.parseInt(partSplit[0]);
toIndex = commandLength + 1;
} else {
fromIndex = Integer.parseInt(part);
toIndex = fromIndex;
}
fromIndex = Integer.parseInt(indexSplit[0]) - 1;
toIndex = Integer.parseInt(indexSplit[1]);
} else {
fromIndex = Integer.parseInt(part);
toIndex = fromIndex;
fromIndex = Math.max(0, fromIndex - 1);
toIndex = Math.min(commandLength, toIndex);
output.append(String.join(" ", Arrays.copyOfRange(commandSplit, fromIndex, toIndex)));
} catch (NumberFormatException exception) {
Logger.warning("Failed to convert number! (" + part + ")");
}
if (fromIndex < 0 || toIndex > length) {
Logger.warning("Custom response contains an error! (" + input + ")");
Logger.warning("Out of bounds! (Input: " + input + ", Possible: " + (length > 1 ? "1-" : "") + length + ")");
continue;
}
String replacement;
if (fromIndex == toIndex) {
replacement = commandSplit[fromIndex - 1];
} else {
replacement = String.join(" ", Arrays.copyOfRange(commandSplit, fromIndex, toIndex));;
}
split[i] = replacement;
}
return String.join(" ", split);
return output.toString();
}
public static List<String> getResponse(UUID uuid, String input) {
+1 -1
View File
@@ -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.19
version: 2.0.20
main: de.rayzs.pat.plugin.BungeeLoader
softDepends: [LuckPerms, PAPIProxyBridge]
@@ -35,11 +35,21 @@
# Possible variable:
# %args[from-to]% to get the command arguments
# Example if you've typed: /shop open gui user
# A:
# %args[1]% = shop
# %args[2]% = open
# A-B:
# %args[1-2]% = shop open
# %args[1-3]% = shop open gui
# %args[2-4]% = open gui user
# A_:
# %args[1_]% = shop open gui user
# %args[2_]% = open gui user
# %args[3_]% = gui user
# _B:
# %args[_1]% = shop
# %args[_2]% = shop open
# %args[_3]% = shop open gui
# Here are a few examples:
@@ -29,11 +29,21 @@
# Possible variable:
# %args[from-to]% to get the command arguments
# Example if you've typed: /shop open gui user
# A:
# %args[1]% = shop
# %args[2]% = open
# A-B:
# %args[1-2]% = shop open
# %args[1-3]% = shop open gui
# %args[2-4]% = open gui user
# A_:
# %args[1_]% = shop open gui user
# %args[2_]% = open gui user
# %args[3_]% = gui user
# _B:
# %args[_1]% = shop
# %args[_2]% = shop open
# %args[_3]% = shop open gui
# Here are a few examples:
+1 -1
View File
@@ -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.19
version: 2.0.20
api-version: 1.13
folia-supported: true
main: de.rayzs.pat.plugin.BukkitLoader