22
33import com .tcoded .folialib .enums .ImplementationType ;
44import com .tcoded .folialib .impl .PlatformScheduler ;
5+ import com .tcoded .folialib .util .FoliaLibOptions ;
56import com .tcoded .folialib .util .InvalidTickDelayNotifier ;
67import org .bukkit .plugin .Plugin ;
78
@@ -14,10 +15,22 @@ public class FoliaLib {
1415
1516 private final ImplementationType implementationType ;
1617 private final PlatformScheduler scheduler ;
18+ private FoliaLibOptions options ;
19+ private InvalidTickDelayNotifier invalidTickDelayNotifier ;
1720
1821 public FoliaLib (Plugin plugin ) {
22+ this (plugin , new FoliaLibOptions ());
23+ }
24+
25+ public FoliaLib (Plugin plugin , FoliaLibOptions customOptions ) {
1926 this .plugin = plugin ;
2027
28+ // Initialize options
29+ this .options = customOptions ;
30+
31+ // Initialize the invalid tick delay notifier
32+ this .invalidTickDelayNotifier = new InvalidTickDelayNotifier (plugin .getLogger (), this .options );
33+
2134 // Find the implementation type based on the class names
2235 ImplementationType foundType = ImplementationType .UNKNOWN ;
2336
@@ -48,7 +61,7 @@ public FoliaLib(Plugin plugin) {
4861 if (this .getClass ().getName ().startsWith (originalLocation )) {
4962 Logger logger = this .plugin .getLogger ();
5063 logger .severe ("****************************************************************" );
51- logger .severe ("FoliaLib is not be relocated correctly! This will cause conflicts" );
64+ logger .severe ("FoliaLib is not relocated correctly! This will cause conflicts" );
5265 logger .severe ("with other plugins using FoliaLib. Please contact the developers" );
5366 logger .severe (String .format ("of '%s' and inform them of this issue immediately!" , this .plugin .getDescription ().getName ()));
5467 logger .severe ("****************************************************************" );
@@ -101,18 +114,40 @@ public Plugin getPlugin() {
101114
102115 // Public Options
103116
117+ /**
118+ * Use {@link FoliaLib#getOptions()} instead.
119+ */
104120 @ SuppressWarnings ("unused" )
121+ @ Deprecated
105122 public void disableInvalidTickValueWarning () {
106- InvalidTickDelayNotifier .disableNotifications = true ;
123+ getOptions () .disableNotifications () ;
107124 }
108125
126+ /**
127+ * Use {@link FoliaLib#getOptions()} instead.
128+ */
109129 @ SuppressWarnings ("unused" )
130+ @ Deprecated
110131 public void enableInvalidTickValueDebug () {
111- InvalidTickDelayNotifier .debugMode = true ;
132+ getOptions ().enableInvalidTickDebugMode ();
133+ }
134+
135+ public FoliaLibOptions getOptions () {
136+ return this .options ;
112137 }
113138
114139 // Internal Utils
115140
141+ /**
142+ * This is an internal tool, do NOT use!
143+ * You're probably looking for {@link FoliaLib#getOptions()} instead.
144+ * **/
145+ @ Deprecated
146+ @ SuppressWarnings ("DeprecatedIsStillUsed" )
147+ public InvalidTickDelayNotifier getInvalidTickDelayNotifier () {
148+ return this .invalidTickDelayNotifier ;
149+ }
150+
116151 private PlatformScheduler createServerImpl (String implName ) {
117152 String basePackage = this .getClass ().getPackage ().getName () + ".impl." ;
118153
0 commit comments