Skip to content

Commit 0ebc293

Browse files
committed
1.5.1
1 parent aba16d2 commit 0ebc293

File tree

5 files changed

+29
-12
lines changed

5 files changed

+29
-12
lines changed

pom.xml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
<groupId>lol.hyper</groupId>
2525
<artifactId>anarchystats</artifactId>
26-
<version>1.5</version>
26+
<version>1.5.1</version>
2727
<packaging>jar</packaging>
2828

2929
<name>AnarchyStats</name>
@@ -75,6 +75,10 @@
7575
<pattern>lol.hyper.githubreleaseapi</pattern>
7676
<shadedPattern>lol.hyper.anarchystats.updater</shadedPattern>
7777
</relocation>
78+
<relocation>
79+
<pattern>space.arim.morepaperlib</pattern>
80+
<shadedPattern>lol.hyper.anarchystats.morepaperlib</shadedPattern>
81+
</relocation>
7882
</relocations>
7983
</configuration>
8084
<executions>
@@ -100,13 +104,17 @@
100104
<id>spigotmc-repo</id>
101105
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
102106
</repository>
107+
<repository>
108+
<id>arim-mvn-lgpl3</id>
109+
<url>https://mvn-repo.arim.space/lesser-gpl3/</url>
110+
</repository>
103111
</repositories>
104112

105113
<dependencies>
106114
<dependency>
107115
<groupId>org.spigotmc</groupId>
108116
<artifactId>spigot-api</artifactId>
109-
<version>1.19-R0.1-SNAPSHOT</version>
117+
<version>1.20.1-R0.1-SNAPSHOT</version>
110118
<scope>provided</scope>
111119
</dependency>
112120
<dependency>
@@ -133,5 +141,11 @@
133141
<version>4.3.0</version>
134142
<scope>compile</scope>
135143
</dependency>
144+
<dependency>
145+
<groupId>space.arim.morepaperlib</groupId>
146+
<artifactId>morepaperlib</artifactId>
147+
<version>0.4.3</version>
148+
<scope>compile</scope>
149+
</dependency>
136150
</dependencies>
137151
</project>

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
2828
import net.kyori.adventure.text.minimessage.MiniMessage;
2929
import org.bstats.bukkit.Metrics;
30-
import org.bukkit.Bukkit;
3130
import org.bukkit.configuration.file.FileConfiguration;
3231
import org.bukkit.configuration.file.YamlConfiguration;
3332
import org.bukkit.plugin.java.JavaPlugin;
33+
import space.arim.morepaperlib.MorePaperLib;
3434

3535
import java.io.File;
3636
import java.io.IOException;
@@ -51,10 +51,12 @@ public final class AnarchyStats extends JavaPlugin {
5151
public FileConfiguration config;
5252
public CommandReload commandReload;
5353
public MessageParser messageParser;
54+
public MorePaperLib morePaperLib;
5455

5556
@Override
5657
public void onEnable() {
5758
this.adventure = BukkitAudiences.create(this);
59+
morePaperLib = new MorePaperLib(this);
5860
messageParser = new MessageParser(this);
5961
commandReload = new CommandReload(this);
6062
if (!configFile.exists()) {
@@ -67,11 +69,11 @@ public void onEnable() {
6769
infoCommand.register();
6870

6971
this.getCommand("anarchystats").setExecutor(commandReload);
70-
Bukkit.getScheduler().runTaskAsynchronously(this, this::updateWorldSize);
72+
morePaperLib.scheduling().asyncScheduler().run(this::updateWorldSize);
7173

7274
new Metrics(this, 6877);
7375

74-
Bukkit.getScheduler().runTaskAsynchronously(this, this::checkForUpdates);
76+
morePaperLib.scheduling().asyncScheduler().run(this::checkForUpdates);
7577
}
7678

7779
public void updateWorldSize() {
@@ -83,12 +85,12 @@ public void loadConfig() {
8385
if (worldPaths.size() > 0) {
8486
worldPaths.clear();
8587
}
86-
for (String x : config.getStringList("worlds-to-use")) {
87-
Path currentPath =
88-
Paths.get(Paths.get(".").toAbsolutePath().normalize() + File.separator + x);
88+
for (String worldFolder : config.getStringList("worlds-to-use")) {
89+
Path currentPath = Paths.get(Paths.get(".").toAbsolutePath().normalize() + File.separator + worldFolder);
8990
if (!currentPath.toFile().exists()) {
90-
logger.warning("World folder \"" + x + "\" does not exist! Excluding from size calculation.");
91+
logger.warning("World folder \"" + worldFolder + "\" does not exist! Excluding from size calculation.");
9192
} else {
93+
logger.info("Adding " + worldFolder);
9294
worldPaths.add(currentPath);
9395
}
9496
}
@@ -123,8 +125,7 @@ public void checkForUpdates() {
123125

124126
public BukkitAudiences getAdventure() {
125127
if (this.adventure == null) {
126-
throw new IllegalStateException(
127-
"Tried to access Adventure when the plugin was disabled!");
128+
throw new IllegalStateException("Tried to access Adventure when the plugin was disabled!");
128129
}
129130
return this.adventure;
130131
}

src/main/java/lol/hyper/anarchystats/commands/CommandInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
5151
return true;
5252
}
5353
}
54-
Bukkit.getScheduler().runTaskAsynchronously(anarchyStats, anarchyStats::updateWorldSize);
54+
anarchyStats.morePaperLib.scheduling().asyncScheduler().run(anarchyStats::updateWorldSize);
5555
Component infoCommand = anarchyStats.messageParser.infoCommand();
5656
if (infoCommand != null) {
5757
audiences.sender(sender).sendMessage(infoCommand);

src/main/java/lol/hyper/anarchystats/tools/MessageParser.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public Component infoCommand() {
5656
try {
5757
originalDate = originalFormat.parse(configDate);
5858
} catch (ParseException e) {
59+
anarchyStats.logger.severe("The date in the config is invalid.");
5960
e.printStackTrace();
6061
}
6162
String finalDate;

src/main/resources/plugin.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ load: STARTUP
66
author: hyperdefined
77
website: https://www.spigotmc.org/resources/anarchystats.66089/
88
description: Get server age, total players, and world size in a nice little command.
9+
folia-supported: true
910
permissions:
1011
anarchystats.reload:
1112
default: op

0 commit comments

Comments
 (0)