From 45ecc68a2a18124e9456325a4b2090ec4cda6066 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Thu, 19 Mar 2020 16:05:47 +1300 Subject: [PATCH] Save the IP checked against for bisect hosting --- .../disguise/utilities/plugin/BisectHosting.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/utilities/plugin/BisectHosting.java b/src/main/java/me/libraryaddict/disguise/utilities/plugin/BisectHosting.java index f5036f2a..1c5c9ad6 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/plugin/BisectHosting.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/plugin/BisectHosting.java @@ -15,14 +15,16 @@ public class BisectHosting { public boolean isBisectHosted(String pluginName) { File configFile = new File("plugins/" + pluginName + "/internal.yml"); boolean claimedHosted = false; + String serverIp = Bukkit.getIp().replaceAll("[^:0-9.]", ""); if (configFile.exists()) { YamlConfiguration configuration = YamlConfiguration.loadConfiguration(configFile); - if (configuration.contains("Bisect-Hosted")) { + if (configuration.contains("Bisect-Hosted") && configuration.contains("Server-IP")) { claimedHosted = configuration.getBoolean("Bisect-Hosted"); + // If not hosted by bisect - if (!claimedHosted) { + if (!claimedHosted && configuration.getString("Server-IP").equals(serverIp)) { return false; } } @@ -45,7 +47,6 @@ public class BisectHosting { // If config doesn't exist, or it's not a bisect server if (!configFile.exists()) { - if (!configFile.getParentFile().exists()) { configFile.getParentFile().mkdirs(); } @@ -59,6 +60,7 @@ public class BisectHosting { "\n# Coupon 'libraryaddict' for 25% off your first invoice on any of their gaming servers"); writer.write("\n# Be sure to visit through this link! https://bisecthosting.com/libraryaddict"); writer.write("\nBisect-Hosted: " + hostedBy); + writer.write("\nServer-IP: " + serverIp); } catch (FileNotFoundException | UnsupportedEncodingException e) { e.printStackTrace();