Refactor, code cleanup, sponge impl.

BungeeCord still has problems, bad API, not my fault technically. still need to fix though
This commit is contained in:
2025-05-27 13:13:53 -04:00
parent de31d837b9
commit 3f6bb4a0e6
19 changed files with 739 additions and 446 deletions
@@ -1,5 +1,8 @@
package dev.brighten.antivpn.utils;
import dev.brighten.antivpn.api.APIPlayer;
import dev.brighten.antivpn.web.objects.VPNResponse;
public class StringUtil {
public static String line(String color) {
return color + "&m-----------------------------------------------------";
@@ -12,4 +15,24 @@ public class StringUtil {
public static String lineNoStrike(String color) {
return color + "-----------------------------------------------------";
}
public static String varReplace(String input, APIPlayer player, VPNResponse result) {
return input.replace("%player%", player.getName())
.replace("%reason%", result.getMethod())
.replace("%country%", result.getCountryName())
.replace("%city%", result.getCity());
}
public static String translateAlternateColorCodes(char altColorChar, String textToTranslate) {
char[] b = textToTranslate.toCharArray();
for(int i = 0; i < b.length - 1; ++i) {
if (b[i] == altColorChar && "0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[i + 1]) > -1) {
b[i] = 167;
b[i + 1] = Character.toLowerCase(b[i + 1]);
}
}
return new String(b);
}
}