Skip to content

Commit e3a99a7

Browse files
committed
don't hardcode the world paths location
1 parent 5c454e1 commit e3a99a7

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/main/java/lol/hyper/anarchystats/AnarchyStats.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import java.io.File;
1212
import java.nio.file.Path;
13+
import java.nio.file.Paths;
1314
import java.util.logging.Logger;
1415

1516
public final class AnarchyStats extends JavaPlugin {
@@ -57,5 +58,8 @@ public void updateWorldSize(Path world, Path nether, Path end) {
5758

5859
public void loadConfig() {
5960
config = YamlConfiguration.loadConfiguration(configFile);
61+
WorldSize.world = Paths.get(Paths.get(".").toAbsolutePath().normalize().toString() + File.separator + config.getString("world-files.overworld"));
62+
WorldSize.nether = Paths.get(Paths.get(".").toAbsolutePath().normalize().toString() + File.separator + config.getString("world-files.nether"));
63+
WorldSize.end = Paths.get(Paths.get(".").toAbsolutePath().normalize().toString() + File.separator + config.getString("world-files.end"));
6064
}
6165
}

src/main/java/lol/hyper/anarchystats/WorldSize.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
public class WorldSize {
1111

1212

13-
public static final Path world = Paths.get(Paths.get(".").toAbsolutePath().normalize().toString() + File.separator + "/world");
14-
public static final Path nether = Paths.get(Paths.get(".").toAbsolutePath().normalize().toString() +File.separator + "/world_nether");
15-
public static final Path end = Paths.get(Paths.get(".").toAbsolutePath().normalize().toString() + File.separator + "world_the_end");
13+
public static Path world = null;
14+
public static Path nether= null;
15+
public static Path end= null;
1616

1717
/**
1818
* Attempts to calculate the size of a file or directory.

src/main/resources/config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
# Format: MM/DD/YYYY. You must put zeros for single digits. Example: 06, 02, 01, etc.
33
date: 05/27/2019 # This date is May 27th, 2019.
44

5+
# Some servers have different folder names for the worlds. Please update these to match yours.
6+
# Leave default if you didn't change the names.
7+
world-files:
8+
overworld: "world"
9+
nether: "world_nether"
10+
end: "world_the_end"
511

612
# This is where you can change what message is on the command.
713
# {{STARTDATE}} - Displays the start date for the server. Uses the date above.

0 commit comments

Comments
 (0)