mirror of
https://github.com/funkemunky/AntiVPN.git
synced 2026-05-31 09:31:54 +00:00
Fixing sql errors and fixing NPE of missing VpnStrings
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package dev.brighten.antivpn.bukkit;
|
||||
|
||||
import dev.brighten.antivpn.AntiVPN;
|
||||
import dev.brighten.antivpn.bukkit.util.ConfigDefault;
|
||||
import dev.brighten.antivpn.command.Command;
|
||||
import lombok.val;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
@@ -39,6 +40,11 @@ public class BukkitPlugin extends JavaPlugin {
|
||||
Bukkit.getLogger().info("Starting AntiVPN services...");
|
||||
AntiVPN.start(new BukkitConfig(), new BukkitListener(), new BukkitPlayerExecutor());
|
||||
|
||||
Bukkit.getLogger().info("Getting strings...");
|
||||
AntiVPN.getInstance().getMessageHandler().initStrings(vpnString -> new ConfigDefault<>
|
||||
(vpnString.getDefaultMessage(), "messages." + vpnString.getKey(), BukkitPlugin.pluginInstance)
|
||||
.get());
|
||||
|
||||
if(AntiVPN.getInstance().getConfig().metrics()) {
|
||||
Bukkit.getLogger().info("Starting bStats metrics...");
|
||||
Metrics metrics = new Metrics(this, 12615);
|
||||
|
||||
@@ -2,6 +2,7 @@ package dev.brighten.antivpn.bungee;
|
||||
|
||||
import dev.brighten.antivpn.AntiVPN;
|
||||
import dev.brighten.antivpn.bungee.util.Config;
|
||||
import dev.brighten.antivpn.bungee.util.ConfigDefault;
|
||||
import dev.brighten.antivpn.command.Command;
|
||||
import lombok.Getter;
|
||||
import lombok.val;
|
||||
@@ -27,7 +28,7 @@ public class BungeePlugin extends Plugin {
|
||||
private Config config;
|
||||
private SingleLineChart vpnDetections, ipsChecked;
|
||||
|
||||
private static BaseComponent[] noPermission = new ComponentBuilder("No permission").color(ChatColor.RED)
|
||||
private static final BaseComponent[] noPermission = new ComponentBuilder("No permission").color(ChatColor.RED)
|
||||
.create();
|
||||
|
||||
@Override
|
||||
@@ -38,10 +39,16 @@ public class BungeePlugin extends Plugin {
|
||||
BungeeCord.getInstance().getLogger().info("Loading config...");
|
||||
config = new Config();
|
||||
|
||||
|
||||
//Loading plugin
|
||||
BungeeCord.getInstance().getLogger().info("Starting AntiVPN services...");
|
||||
AntiVPN.start(new BungeeConfig(), new BungeeListener(), new BungeePlayerExecutor());
|
||||
|
||||
BungeeCord.getInstance().getLogger().info("Getting strings...");
|
||||
AntiVPN.getInstance().getMessageHandler().initStrings(vpnString -> new ConfigDefault<>
|
||||
(vpnString.getDefaultMessage(), "messages." + vpnString.getKey(), BungeePlugin.pluginInstance)
|
||||
.get());
|
||||
|
||||
if(AntiVPN.getInstance().getConfig().metrics()) {
|
||||
BungeeCord.getInstance().getLogger().info("Starting bStats metrics...");
|
||||
Metrics metrics = new Metrics(this, 12616);
|
||||
|
||||
@@ -173,7 +173,7 @@ public class MySqlVPN implements VPNDatabase {
|
||||
//We want to make sure there isn't already a uuid inserted to prevent double insertions
|
||||
alertsState(uuid, alreadyEnabled -> { //No need to make another thread execute, already async
|
||||
if(!alreadyEnabled) {
|
||||
Query.prepare("insert into `alerts` (`uuid`) values ?").append(uuid.toString())
|
||||
Query.prepare("insert into `alerts` (`uuid`) values (?)").append(uuid.toString())
|
||||
.execute();
|
||||
} //No need to insert again of already enabled
|
||||
});
|
||||
@@ -200,8 +200,8 @@ public class MySqlVPN implements VPNDatabase {
|
||||
if(set.getObject("DATA_TYPE").toString().contains("varchar")) {
|
||||
System.out.println("Using old database format for storing responses! " +
|
||||
"Dropping table and creating a new one...");
|
||||
if(Query.prepare("drop table `responses`").execute() == 1) {
|
||||
System.out.println("Sucessfully dropped table!");
|
||||
if(Query.prepare("drop table `responses`").execute() > 0) {
|
||||
System.out.println("Successfully dropped table!");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user