From 8e8cf54ddd12fbad47c63d396663ea16cc7bc83a Mon Sep 17 00:00:00 2001 From: Dan Mulloy Date: Sat, 9 Jan 2016 12:28:05 -0500 Subject: [PATCH] Fix conflict checking with different plugins folders Fixes #136 --- .../main/java/com/comphenix/protocol/ProtocolLibrary.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolLibrary.java b/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolLibrary.java index 4198ace5..1572719a 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolLibrary.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolLibrary.java @@ -490,7 +490,7 @@ public class ProtocolLibrary extends JavaPlugin { private void checkConflictingVersions() { Pattern ourPlugin = Pattern.compile("ProtocolLib-(.*)\\.jar"); - MinecraftVersion currentVersion = new MinecraftVersion(this.getDescription().getVersion()); + MinecraftVersion currentVersion = new MinecraftVersion(getDescription().getVersion()); MinecraftVersion newestVersion = null; // Skip the file that contains this current instance however @@ -498,7 +498,8 @@ public class ProtocolLibrary extends JavaPlugin { try { // Scan the plugin folder for newer versions of ProtocolLib - File pluginFolder = new File("plugins/"); + // The plugin folder isn't always plugins/ + File pluginFolder = getDataFolder().getParentFile(); for (File candidate : pluginFolder.listFiles()) { if (candidate.isFile() && !candidate.equals(loadedFile)) { @@ -516,6 +517,7 @@ public class ProtocolLibrary extends JavaPlugin { } } } catch (Exception e) { + // TODO This shows [ProtocolLib] and [ProtocolLibrary] in the message reporter.reportWarning(this, Report.newBuilder(REPORT_CANNOT_DETECT_CONFLICTING_PLUGINS).error(e)); }