mirror of
https://github.com/funkemunky/AntiVPN.git
synced 2026-05-31 09:31:54 +00:00
Correcting logic bug with getDatabaseType function, removing unnecessary function in StringUtil
This commit is contained in:
@@ -149,10 +149,10 @@ public class BukkitPlugin implements LoaderBootstrap {
|
||||
private String getDatabaseType() {
|
||||
VPNDatabase database = AntiVPN.getInstance().getDatabase();
|
||||
|
||||
if(database instanceof H2VPN) {
|
||||
return "H2";
|
||||
} else if(database instanceof MySqlVPN) {
|
||||
if(database instanceof MySqlVPN) {
|
||||
return "MySQL";
|
||||
} else if(database instanceof H2VPN) {
|
||||
return "H2";
|
||||
} else if(database instanceof MongoVPN) {
|
||||
return "MongoDB";
|
||||
} else {
|
||||
|
||||
@@ -85,11 +85,10 @@ public class BungeePlugin implements LoaderBootstrap {
|
||||
|
||||
private String getDatabaseType() {
|
||||
VPNDatabase database = AntiVPN.getInstance().getDatabase();
|
||||
|
||||
if(database instanceof H2VPN) {
|
||||
return "H2";
|
||||
} else if(database instanceof MySqlVPN) {
|
||||
if(database instanceof MySqlVPN) {
|
||||
return "MySQL";
|
||||
} else if(database instanceof H2VPN) {
|
||||
return "H2";
|
||||
} else if(database instanceof MongoVPN) {
|
||||
return "MongoDB";
|
||||
} else {
|
||||
|
||||
@@ -125,7 +125,7 @@ public class AntiVPN {
|
||||
break;
|
||||
}
|
||||
case "mysql":
|
||||
case "sql":{
|
||||
case "sql": {
|
||||
AntiVPN.getInstance().getExecutor().log("Using databaseType MySQL...");
|
||||
INSTANCE.database = new MySqlVPN();
|
||||
INSTANCE.database.init();
|
||||
|
||||
@@ -16,12 +16,6 @@
|
||||
|
||||
package dev.brighten.antivpn.utils;
|
||||
|
||||
import dev.brighten.antivpn.AntiVPN;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
import dev.brighten.antivpn.api.APIPlayer;
|
||||
import dev.brighten.antivpn.web.objects.VPNResponse;
|
||||
|
||||
@@ -34,25 +28,6 @@ public class StringUtil {
|
||||
return "&m-----------------------------------------------------";
|
||||
}
|
||||
|
||||
public static String getHash(String input) {
|
||||
try {
|
||||
MessageDigest digest = MessageDigest.getInstance("SHA1");
|
||||
byte[] hash = digest.digest(input.getBytes(StandardCharsets.UTF_8));
|
||||
StringBuilder hexString = new StringBuilder(2 * hash.length);
|
||||
for (byte b : hash) {
|
||||
String hex = Integer.toHexString(0xff & b);
|
||||
if (hex.length() == 1) {
|
||||
hexString.append('0');
|
||||
}
|
||||
hexString.append(hex);
|
||||
}
|
||||
return hexString.toString();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
AntiVPN.getInstance().getExecutor().logException(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String varReplace(String input, APIPlayer player, VPNResponse result) {
|
||||
return translateAlternateColorCodes('&', input.replace("%player%", player.getName())
|
||||
.replace("%reason%", result.getMethod())
|
||||
|
||||
+4
-5
@@ -61,12 +61,11 @@ public class VelocityPlugin implements LoaderBootstrap {
|
||||
|
||||
private String getDatabaseType() {
|
||||
VPNDatabase database = AntiVPN.getInstance().getDatabase();
|
||||
|
||||
if(database instanceof H2VPN) {
|
||||
return "H2";
|
||||
} else if(database instanceof MySqlVPN) {
|
||||
if(database instanceof MySqlVPN) {
|
||||
return "MySQL";
|
||||
} else if(database instanceof MongoVPN) {
|
||||
} else if(database instanceof H2VPN) {
|
||||
return "H2";
|
||||
} else if(database instanceof MongoVPN) {
|
||||
return "MongoDB";
|
||||
} else {
|
||||
return "No-Database";
|
||||
|
||||
Reference in New Issue
Block a user