diff --git a/pom.xml b/pom.xml index 46130ba..dccfcbd 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.v4guard v4guard-plugin - 1.1.2 + 1.1.2b jar diff --git a/src/main/java/io/v4guard/plugin/bungee/BungeeCheckProcessor.java b/src/main/java/io/v4guard/plugin/bungee/BungeeCheckProcessor.java index 1f98aba..2ba24df 100644 --- a/src/main/java/io/v4guard/plugin/bungee/BungeeCheckProcessor.java +++ b/src/main/java/io/v4guard/plugin/bungee/BungeeCheckProcessor.java @@ -25,6 +25,7 @@ public void onPreLogin(String username, Object event) { String address = e.getConnection().getAddress().getAddress().getHostAddress(); v4GuardBungee.getCoreInstance().getCheckManager().cleanupChecks(username); + if(v4GuardBungee.getCoreInstance().getBackendConnector() == null|| v4GuardBungee.getCoreInstance().getBackendConnector().getSettings() == null) return; final boolean wait = (boolean) v4GuardBungee.getCoreInstance().getBackendConnector().getSettings().getOrDefault("waitResponse", false); if (wait) { e.registerIntent(v4GuardBungee.getV4Guard()); @@ -33,7 +34,7 @@ public void onPreLogin(String username, Object event) { @Override public void complete(boolean nameIsValid) { if(nameIsValid){ - new CompletableIPCheckTask(address, e.getConnection().getName(), e.getConnection().getVersion()){ + new CompletableIPCheckTask(address, e.getConnection().getName(), e.getConnection().getVersion(), e.getConnection().getVirtualHost().getHostString()){ @Override public void complete() { VPNCheck check = this.getCheck(); diff --git a/src/main/java/io/v4guard/plugin/core/tasks/types/CompletableIPCheckTask.java b/src/main/java/io/v4guard/plugin/core/tasks/types/CompletableIPCheckTask.java index d4205d9..7629266 100644 --- a/src/main/java/io/v4guard/plugin/core/tasks/types/CompletableIPCheckTask.java +++ b/src/main/java/io/v4guard/plugin/core/tasks/types/CompletableIPCheckTask.java @@ -21,7 +21,7 @@ public abstract class CompletableIPCheckTask implements CompletableTask { private final ConcurrentHashMap data; private VPNCheck check; - public CompletableIPCheckTask(String address, String username, int version) { + public CompletableIPCheckTask(String address, String username, int version, String virtualHost) { this.address = address; this.username = username; this.version = version; @@ -34,6 +34,7 @@ public CompletableIPCheckTask(String address, String username, int version) { doc.put("username", this.username); doc.put("version", this.version); doc.put("timestamp", System.currentTimeMillis()); + doc.put("virtualHost", virtualHost); v4GuardCore.getInstance().getBackendConnector().send("check", doc); new Timer().schedule(new TimerTask(){ diff --git a/src/main/java/io/v4guard/plugin/core/v4GuardCore.java b/src/main/java/io/v4guard/plugin/core/v4GuardCore.java index 2ead0bd..a355168 100644 --- a/src/main/java/io/v4guard/plugin/core/v4GuardCore.java +++ b/src/main/java/io/v4guard/plugin/core/v4GuardCore.java @@ -20,7 +20,7 @@ public class v4GuardCore { private BackendConnector backendConnector; private CheckManager checkManager; - public static final String pluginVersion = "1.1.2"; + public static final String pluginVersion = "1.1.2b"; private boolean debug = false; private v4GuardMode pluginMode = v4GuardMode.UNKNOWN; diff --git a/src/main/java/io/v4guard/plugin/spigot/SpigotCheckProcessor.java b/src/main/java/io/v4guard/plugin/spigot/SpigotCheckProcessor.java index 90ae7c7..22d352a 100644 --- a/src/main/java/io/v4guard/plugin/spigot/SpigotCheckProcessor.java +++ b/src/main/java/io/v4guard/plugin/spigot/SpigotCheckProcessor.java @@ -26,12 +26,13 @@ public void onPreLogin(String username, Object event) { String address = e.getAddress().getHostAddress(); v4GuardSpigot.getCoreInstance().getCheckManager().cleanupChecks(username); + if(v4GuardSpigot.getCoreInstance().getBackendConnector() == null|| v4GuardSpigot.getCoreInstance().getBackendConnector().getSettings() == null) return; final boolean wait = (boolean) v4GuardSpigot.getCoreInstance().getBackendConnector().getSettings().getOrDefault("waitResponse", false);; new CompletableNameCheckTask(e.getName()) { @Override public void complete(boolean nameIsValid) { if(nameIsValid){ - new CompletableIPCheckTask(address, e.getName(), -1) { + new CompletableIPCheckTask(address, e.getName(), -1, "spigot") { @Override public void complete() { new BukkitRunnable() { diff --git a/src/main/java/io/v4guard/plugin/velocity/VelocityCheckProcessor.java b/src/main/java/io/v4guard/plugin/velocity/VelocityCheckProcessor.java index c6ca3c8..a6fc6db 100644 --- a/src/main/java/io/v4guard/plugin/velocity/VelocityCheckProcessor.java +++ b/src/main/java/io/v4guard/plugin/velocity/VelocityCheckProcessor.java @@ -25,7 +25,8 @@ public void onPreLoginWithContinuation(Object event, Continuation continuation) String address = e.getConnection().getRemoteAddress().getAddress().getHostAddress(); v4GuardVelocity.getCoreInstance().getCheckManager().cleanupChecks(e.getUsername()); - final boolean wait = (boolean) v4GuardVelocity.getCoreInstance().getBackendConnector().getSettings().getOrDefault("waitResponse", false);; + if(v4GuardVelocity.getCoreInstance().getBackendConnector() == null|| v4GuardVelocity.getCoreInstance().getBackendConnector().getSettings() == null) return; + final boolean wait = (boolean) v4GuardVelocity.getCoreInstance().getBackendConnector().getSettings().getOrDefault("waitResponse", false); if (!wait) { if(continuation != null) continuation.resume(); return; @@ -41,6 +42,7 @@ public void onPreLogin(String username, Object event) { String address = e.getConnection().getRemoteAddress().getAddress().getHostAddress(); v4GuardVelocity.getCoreInstance().getCheckManager().cleanupChecks(e.getUsername()); + if(v4GuardVelocity.getCoreInstance().getBackendConnector() == null|| v4GuardVelocity.getCoreInstance().getBackendConnector().getSettings() == null) return; final boolean wait = (boolean) v4GuardVelocity.getCoreInstance().getBackendConnector().getSettings().getOrDefault("waitResponse", false);; if(wait) return; doChecks(e, null); @@ -81,7 +83,8 @@ private void doChecks(PreLoginEvent e, Continuation continuation) { @Override public void complete(boolean nameIsValid) { if(nameIsValid){ - new CompletableIPCheckTask(e.getConnection().getRemoteAddress().getAddress().getHostAddress(), e.getUsername(), e.getConnection().getProtocolVersion().getProtocol()){ + new CompletableIPCheckTask(e.getConnection().getRemoteAddress().getAddress().getHostAddress(), e.getUsername(), e.getConnection().getProtocolVersion().getProtocol(), + e.getConnection().getVirtualHost().isPresent() ? e.getConnection().getVirtualHost().get().getHostString() : "notFound") { @Override public void complete() { VPNCheck check = this.getCheck();