more implemtaions

This commit is contained in:
2021-12-14 20:55:57 +04:00
parent 4d19f68a28
commit a5d0613c69
8 changed files with 153 additions and 8 deletions

View File

@@ -0,0 +1,28 @@
package net.limework.gal.utils;
import net.limework.gal.utils.config.Configuration;
public class PlayerNamesUtils {
public static boolean isCrackedPlayer(String username, Configuration configuration) {
if (configuration.useTheContainMethod()) {
return username.contains(configuration.getCrackedCharString());
} else {
return username.charAt(0) == configuration.getCrackedChar();
}
}
public static String getCorrectCrackedUsername(String username, Configuration configuration) {
if (configuration.doReplaceSpacesWithUnderscore()) {
username = username.replace(" ", "_");
}
if (username.length() >= 16) {
username = username.substring(0, 15);
}
return username;
}
}

View File

@@ -0,0 +1,13 @@
package net.limework.gal.utils;
import java.nio.charset.StandardCharsets;
import java.util.UUID;
public class PlayerUUIDUtils {
// source -> https://www.spigotmc.org/threads/how-uuid-is-generated-for-offline-mode-nicknames.347835/
public static UUID getCrackedPlayerUUIDByName(String name) {
return UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(StandardCharsets.UTF_8));
}
}

View File

@@ -2,8 +2,12 @@ package net.limework.gal.utils.config;
public interface Configuration {
String getCrackedChar();
char getCrackedChar();
String getCrackedCharString();
boolean doReplaceSpacesWithUnderscore();
boolean useTheContainMethod();
AntiBot getAntiBot();

View File

@@ -1,7 +1,9 @@
{
"default-cracked-char": "-",
"replace-spaces-with-underscore": true,
"use-the-contain-method": false,
"simple-anti-bot": {
"max-connections" : 590,
"reset" : 10
"max-connections": 590,
"reset": 10
}
}

View File

@@ -4,13 +4,34 @@
# Ham1255 is a cracked player want to join mc.limework.net
# when system checks if he is cracked then if the name does not contain -
# system will replace the name to -Ham1255
# Default: "-"
# Warning: if you put more than 1 character it will use the first one and the rest is ignored.
default-cracked-char: "-"
# if the cracked player name is like this
# Ham 1255 system will convert it to Ham_1255
# Default: true
replace-spaces-with-underscore: true
# Notice:
# I don't recommend using this. -ham1255
# Example:
# true: when joining it checks the whole username if it has Cracked character or not!
# so Players who has - in middle or else like this:
# [ Ham-1255 Ham1255- Ha-m1255 -Ham1255 ] will work
# in java syntax: .contains(DEFAULT_CRACKED_CHAR)
# false: when joining it checks the first character if its
use-the-contain-method: false
# Just simple anti bot
# example:
# when a player joins a server it makes request to mojang api which has 600 per 10 mins
# when a player joins a server it makes request to mojang api which has 600 per 10 minutes
# if the server reach's the limits players can no longer join + possibility of getting banned by mojang api for a day!
# default:
# max: 590
# reset: 10
simple-anti-bot:
max-connections: 590
reset: 10