2727import net .kyori .adventure .platform .bukkit .BukkitAudiences ;
2828import net .kyori .adventure .text .minimessage .MiniMessage ;
2929import org .bstats .bukkit .Metrics ;
30- import org .bukkit .Bukkit ;
3130import org .bukkit .configuration .file .FileConfiguration ;
3231import org .bukkit .configuration .file .YamlConfiguration ;
3332import org .bukkit .plugin .java .JavaPlugin ;
33+ import space .arim .morepaperlib .MorePaperLib ;
3434
3535import java .io .File ;
3636import 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 }
0 commit comments