1.5.1 KauriVPN plugin.yml rename and System print fix

This commit is contained in:
Dawson Hessler
2021-11-04 08:27:32 -04:00
parent 2082ad6d8e
commit 5ba19b42f9
18 changed files with 49 additions and 32 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
<parent>
<artifactId>AntiVPN</artifactId>
<groupId>dev.brighten.antivpn</groupId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>Assembly</artifactId>
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>AntiVPN</artifactId>
<groupId>dev.brighten.antivpn</groupId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
+2 -2
View File
@@ -3,7 +3,7 @@
<parent>
<artifactId>AntiVPN</artifactId>
<groupId>dev.brighten.antivpn</groupId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>Bukkit</artifactId>
@@ -56,7 +56,7 @@
<dependency>
<groupId>dev.brighten.antivpn</groupId>
<artifactId>Common</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
<scope>provided</scope>
</dependency>
<dependency>
+2 -2
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>AntiVPN</artifactId>
<groupId>dev.brighten.antivpn</groupId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -69,7 +69,7 @@
<dependency>
<groupId>dev.brighten.antivpn</groupId>
<artifactId>Common</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -47,18 +47,23 @@ public class BukkitListener extends VPNExecutor implements Listener {
if(cacheResetTask != null && !cacheResetTask.isCancelled()) cacheResetTask.cancel();
}
@Override
public void log(String log, Object... objects) {
Bukkit.getLogger().log(Level.INFO, String.format(log, objects));
}
@EventHandler
public void onJoin(final PlayerJoinEvent event) {
AntiVPN.getInstance().getPlayerExecutor().getPlayer(event.getPlayer().getUniqueId())
.ifPresent(player -> {
AntiVPN.getInstance().getDatabase().alertsState(player.getUuid(), enabled -> {
if(enabled) {
System.out.println("Enabled");
AntiVPN.getInstance().getExecutor().log("Enabled");
player.setAlertsEnabled(true);
player.sendMessage(AntiVPN.getInstance().getMessageHandler()
.getString("command-alerts-toggled")
.getFormattedMessage(new VpnString.Var<>("state", true)));
} else System.out.println("Not enabled");
} else AntiVPN.getInstance().getExecutor().log("Not enabled");
});
});
}
+1 -1
View File
@@ -1,4 +1,4 @@
name: AntiVPN
name: KauriVPN
main: dev.brighten.antivpn.bukkit.BukkitPlugin
version: ${project.version}
author: funkemunky
+2 -2
View File
@@ -3,7 +3,7 @@
<parent>
<artifactId>AntiVPN</artifactId>
<groupId>dev.brighten.antivpn</groupId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>Bungee</artifactId>
@@ -50,7 +50,7 @@
<dependency>
<groupId>dev.brighten.antivpn</groupId>
<artifactId>Common</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
<scope>provided</scope>
</dependency>
<dependency>
+2 -2
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>AntiVPN</artifactId>
<groupId>dev.brighten.antivpn</groupId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -63,7 +63,7 @@
<dependency>
<groupId>dev.brighten.antivpn</groupId>
<artifactId>Common</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -40,6 +40,11 @@ public class BungeeListener extends VPNExecutor implements Listener {
BungeePlugin.pluginInstance.getProxy().getPluginManager().unregisterListener(this);
}
@Override
public void log(String log, Object... objects) {
BungeeCord.getInstance().getLogger().log(Level.INFO, String.format(log, objects));
}
@EventHandler
public void onListener(final PostLoginEvent event) {
if(event.getPlayer().hasPermission("antivpn.bypass") //Has bypass permission
+1 -1
View File
@@ -1,4 +1,4 @@
name: AntiVPN
name: KauriVPN
main: dev.brighten.antivpn.bungee.BungeePlugin
description: A simple and fast antivpn plugin.
version: ${project.version}
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>AntiVPN</artifactId>
<groupId>dev.brighten.antivpn</groupId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -50,7 +50,7 @@ public class AntiVPN {
switch(INSTANCE.config.getDatabaseType().toLowerCase()) {
case "mysql":
case "sql":{
System.out.println("Using databaseType MySQL...");
AntiVPN.getInstance().getExecutor().log("Using databaseType MySQL...");
INSTANCE.database = new MySqlVPN();
INSTANCE.database.init();
break;
@@ -58,11 +58,11 @@ public class AntiVPN {
case "mongo":
case "mongodb":
case "mongod": {
System.out.println("We currently do not support Mongo, but this is coming in future updates.");
AntiVPN.getInstance().getExecutor().log("We currently do not support Mongo, but this is coming in future updates.");
break;
}
default: {
System.out.println("Could not find database type \"" + INSTANCE.config.getDatabaseType() + "\". " +
AntiVPN.getInstance().getExecutor().log("Could not find database type \"" + INSTANCE.config.getDatabaseType() + "\". " +
"Options: [MySQL]");
break;
}
@@ -29,6 +29,8 @@ public abstract class VPNExecutor {
public abstract void shutdown();
public abstract void log(String log, Object... objects);
public boolean isWhitelisted(UUID uuid) {
return whitelisted.contains(uuid);
}
@@ -47,12 +49,12 @@ public abstract class VPNExecutor {
if(response.isSuccess()) {
AntiVPN.getInstance().getDatabase().cacheResponse(response);
} else {
System.out.println("Query to VPN API failed! Reason: " + response.getFailureReason());
log("Query to VPN API failed! Reason: " + response.getFailureReason());
}
return response;
} catch (JSONException | IOException e) {
System.out.println("Query to VPN API failed! Reason: Java Exception");
log("Query to VPN API failed! Reason: Java Exception");
e.printStackTrace();
}
}
@@ -76,12 +78,12 @@ public abstract class VPNExecutor {
if(response.isSuccess()) {
threadExecutor.execute(() -> AntiVPN.getInstance().getDatabase().cacheResponse(response));
} else {
System.out.println("Query to VPN API failed! Reason: " + response.getFailureReason());
log("Query to VPN API failed! Reason: " + response.getFailureReason());
}
return response;
} catch (JSONException | IOException e) {
System.out.println("Query to VPN API failed! Reason: Java Exception");
log("Query to VPN API failed! Reason: Java Exception");
e.printStackTrace();
}
}
@@ -188,20 +188,20 @@ public class MySqlVPN implements VPNDatabase {
public void init() {
if (!AntiVPN.getInstance().getConfig().isDatabaseEnabled())
return;
System.out.println("Initializing MySQL...");
AntiVPN.getInstance().getExecutor().log("Initializing MySQL...");
MySQL.init();
System.out.println("Creating tables...");
AntiVPN.getInstance().getExecutor().log("Creating tables...");
//Running check for old table types to update
oldTableCheck: {
Query.prepare("select `DATA_TYPE` from INFORMATION_SCHEMA.COLUMNS " +
"WHERE table_name = 'responses' AND COLUMN_NAME = 'isp';").execute(set -> {
if(set.getObject("DATA_TYPE").toString().contains("varchar")) {
System.out.println("Using old database format for storing responses! " +
AntiVPN.getInstance().getExecutor().log("Using old database format for storing responses! " +
"Dropping table and creating a new one...");
if(Query.prepare("drop table `responses`").execute() > 0) {
System.out.println("Successfully dropped table!");
AntiVPN.getInstance().getExecutor().log("Successfully dropped table!");
}
}
});
@@ -214,7 +214,7 @@ public class MySqlVPN implements VPNDatabase {
+ "`latitude` double, `longitude` double)").execute();
Query.prepare("create table if not exists `alerts` (`uuid` varchar(36) not null)").execute();
System.out.println("Creating indexes...");
AntiVPN.getInstance().getExecutor().log("Creating indexes...");
try {
// Ref:
// https://dba.stackexchange.com/questions/24531/mysql-create-index-if-not-exists
@@ -22,10 +22,10 @@ public class MySQL {
Query.prepare("CREATE DATABASE IF NOT EXISTS `"
+ AntiVPN.getInstance().getConfig().getDatabaseName() + "`").execute();
Query.prepare("USE `" + AntiVPN.getInstance().getConfig().getDatabaseName() + "`").execute();
System.out.println("Connection to MySQL has been established.");
AntiVPN.getInstance().getExecutor().log("Connection to MySQL has been established.");
}
} catch (Exception e) {
System.out.println("Failed to load mysql: " + e.getMessage());
AntiVPN.getInstance().getExecutor().log("Failed to load mysql: " + e.getMessage());
e.printStackTrace();
}
}
+2 -2
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>AntiVPN</artifactId>
<groupId>dev.brighten.antivpn</groupId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -33,7 +33,7 @@
<dependency>
<groupId>dev.brighten.antivpn</groupId>
<artifactId>Common</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -88,4 +88,9 @@ public class VelocityListener extends VPNExecutor {
threadExecutor.shutdown();
VelocityPlugin.INSTANCE.getServer().getEventManager().unregisterListener(VelocityPlugin.INSTANCE, this);
}
@Override
public void log(String log, Object... objects) {
VelocityPlugin.INSTANCE.getLogger().log(Level.INFO, String.format(log, objects));
}
}
+1 -1
View File
@@ -7,7 +7,7 @@
<groupId>dev.brighten.antivpn</groupId>
<artifactId>AntiVPN</artifactId>
<packaging>pom</packaging>
<version>1.5.0</version>
<version>1.5.1</version>
<modules>
<module>Common</module>