Skip to content

Commit 8e8cf54

Browse files
committed
Fix conflict checking with different plugins folders
Fixes #136
1 parent 5a5cd77 commit 8e8cf54

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolLibrary.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,15 +490,16 @@ private MinecraftVersion verifyMinecraftVersion() {
490490

491491
private void checkConflictingVersions() {
492492
Pattern ourPlugin = Pattern.compile("ProtocolLib-(.*)\\.jar");
493-
MinecraftVersion currentVersion = new MinecraftVersion(this.getDescription().getVersion());
493+
MinecraftVersion currentVersion = new MinecraftVersion(getDescription().getVersion());
494494
MinecraftVersion newestVersion = null;
495495

496496
// Skip the file that contains this current instance however
497497
File loadedFile = getFile();
498498

499499
try {
500500
// Scan the plugin folder for newer versions of ProtocolLib
501-
File pluginFolder = new File("plugins/");
501+
// The plugin folder isn't always plugins/
502+
File pluginFolder = getDataFolder().getParentFile();
502503

503504
for (File candidate : pluginFolder.listFiles()) {
504505
if (candidate.isFile() && !candidate.equals(loadedFile)) {
@@ -516,6 +517,7 @@ private void checkConflictingVersions() {
516517
}
517518
}
518519
} catch (Exception e) {
520+
// TODO This shows [ProtocolLib] and [ProtocolLibrary] in the message
519521
reporter.reportWarning(this, Report.newBuilder(REPORT_CANNOT_DETECT_CONFLICTING_PLUGINS).error(e));
520522
}
521523

0 commit comments

Comments
 (0)