File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
bukkit/src/main/java/dev/faststats/bukkit Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 99import org .jetbrains .annotations .Contract ;
1010import org .jspecify .annotations .Nullable ;
1111
12+ import java .io .File ;
1213import java .nio .file .Path ;
1314import java .util .Optional ;
1415import java .util .function .Supplier ;
@@ -93,9 +94,17 @@ private <T> Optional<T> tryOrEmpty(Supplier<T> supplier) {
9394 static final class Factory extends SimpleMetrics .Factory <Plugin > {
9495 @ Override
9596 public Metrics create (Plugin plugin ) throws IllegalStateException {
96- var dataFolder = plugin . getServer (). getPluginsFolder (). toPath ( ).resolve ("faststats" );
97+ var dataFolder = getPluginsFolder (plugin ).resolve ("faststats" );
9798 var config = dataFolder .resolve ("config.properties" );
9899 return new BukkitMetricsImpl (this , plugin , config );
99100 }
101+
102+ private static Path getPluginsFolder (Plugin plugin ) {
103+ try {
104+ return plugin .getServer ().getPluginsFolder ().toPath ();
105+ } catch (NoSuchMethodError e ) {
106+ return plugin .getDataFolder ().getParentFile ().toPath ();
107+ }
108+ }
100109 }
101110}
You can’t perform that action at this time.
0 commit comments