Archiviert
13
0

Fix conflict checking with different plugins folders

Fixes #136
Dieser Commit ist enthalten in:
Dan Mulloy 2016-01-09 12:28:05 -05:00
Ursprung 5a5cd77bac
Commit 8e8cf54ddd

Datei anzeigen

@ -490,7 +490,7 @@ public class ProtocolLibrary extends JavaPlugin {
private void checkConflictingVersions() { private void checkConflictingVersions() {
Pattern ourPlugin = Pattern.compile("ProtocolLib-(.*)\\.jar"); Pattern ourPlugin = Pattern.compile("ProtocolLib-(.*)\\.jar");
MinecraftVersion currentVersion = new MinecraftVersion(this.getDescription().getVersion()); MinecraftVersion currentVersion = new MinecraftVersion(getDescription().getVersion());
MinecraftVersion newestVersion = null; MinecraftVersion newestVersion = null;
// Skip the file that contains this current instance however // Skip the file that contains this current instance however
@ -498,7 +498,8 @@ public class ProtocolLibrary extends JavaPlugin {
try { try {
// Scan the plugin folder for newer versions of ProtocolLib // 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()) { for (File candidate : pluginFolder.listFiles()) {
if (candidate.isFile() && !candidate.equals(loadedFile)) { if (candidate.isFile() && !candidate.equals(loadedFile)) {
@ -516,6 +517,7 @@ public class ProtocolLibrary extends JavaPlugin {
} }
} }
} catch (Exception e) { } catch (Exception e) {
// TODO This shows [ProtocolLib] and [ProtocolLibrary] in the message
reporter.reportWarning(this, Report.newBuilder(REPORT_CANNOT_DETECT_CONFLICTING_PLUGINS).error(e)); reporter.reportWarning(this, Report.newBuilder(REPORT_CANNOT_DETECT_CONFLICTING_PLUGINS).error(e));
} }