18
18
package lol .hyper .timebar ;
19
19
20
20
import lol .hyper .hyperlib .HyperLib ;
21
- import lol .hyper .hyperlib .bstats .bStats ;
22
- import lol .hyper .hyperlib .releases .modrinth .ModrinthPlugin ;
23
- import lol .hyper .hyperlib .releases .modrinth .ModrinthRelease ;
21
+ import lol .hyper .hyperlib .bstats .HyperStats ;
22
+ import lol .hyper .hyperlib .releases .HyperUpdater ;
24
23
import lol .hyper .hyperlib .utils .TextUtils ;
25
24
import lol .hyper .timebar .commands .CommandTimeBar ;
26
25
import lol .hyper .timebar .events .PlayerJoinLeave ;
27
26
import lol .hyper .timebar .events .WorldChange ;
28
27
import lol .hyper .timebar .papi .TimeBarExpansion ;
29
28
import lol .hyper .timebar .tracker .WorldTimeTracker ;
30
29
import net .kyori .adventure .bossbar .BossBar ;
30
+ import net .kyori .adventure .text .logger .slf4j .ComponentLogger ;
31
31
import org .bukkit .Bukkit ;
32
32
import org .bukkit .World ;
33
33
import org .bukkit .configuration .ConfigurationSection ;
38
38
39
39
import java .io .File ;
40
40
import java .util .*;
41
- import java .util .logging .Logger ;
42
41
43
42
public final class TimeBar extends JavaPlugin {
44
43
45
44
public final File configFile = new File (this .getDataFolder (), "config.yml" );
46
45
public final File realisticSeasonsConfigFile = new File (this .getDataFolder (), "realisticseasons.yml" );
47
46
public final File advancedSeasonsConfigFile = new File (this .getDataFolder (), "advancedseasons.yml" );
48
- public final Logger logger = this .getLogger ();
47
+ public final ComponentLogger logger = this .getComponentLogger ();
49
48
public FileConfiguration config ;
50
49
public FileConfiguration realisticSeasonsConfig ;
51
50
public FileConfiguration advancedSeasonsConfig ;
@@ -68,7 +67,7 @@ public void onEnable() {
68
67
hyperLib = new HyperLib (this );
69
68
hyperLib .setup ();
70
69
71
- bStats bstats = new bStats (hyperLib , 10674 );
70
+ HyperStats bstats = new HyperStats (hyperLib , 10674 );
72
71
bstats .setup ();
73
72
74
73
textUtils = new TextUtils (hyperLib );
@@ -80,7 +79,7 @@ public void onEnable() {
80
79
if (expansion .register ()) {
81
80
logger .info ("Successfully registered placeholders!" );
82
81
} else {
83
- logger .warning ("Unable to register placeholders!" );
82
+ logger .warn ("Unable to register placeholders!" );
84
83
}
85
84
}
86
85
if (Bukkit .getPluginManager ().getPlugin ("RealisticSeasons" ) != null ) {
@@ -102,27 +101,11 @@ public void onEnable() {
102
101
Bukkit .getServer ().getPluginManager ().registerEvents (playerJoinLeave , this );
103
102
Bukkit .getServer ().getPluginManager ().registerEvents (worldChange , this );
104
103
105
- Bukkit .getAsyncScheduler ().runNow (this , scheduledTask -> {
106
- ModrinthPlugin modrinthPlugin = new ModrinthPlugin ("3w9zYjq5" );
107
- modrinthPlugin .get ();
108
-
109
- ModrinthRelease release = modrinthPlugin .getReleaseByVersion (this .getPluginMeta ().getVersion ());
110
- if (release == null ) {
111
- logger .warning ("You are running a version not published." );
112
- } else {
113
- int buildsBehind = modrinthPlugin .buildsVersionsBehind (release );
114
- if (buildsBehind > 0 ) {
115
- ModrinthRelease latest = modrinthPlugin .getLatestRelease ();
116
- if (latest != null ) {
117
- logger .info ("You are " + buildsBehind + " versions behind. Please update!" );
118
- logger .info ("The latest version is " + latest .getVersion ());
119
- logger .info (latest .getVersionPage ());
120
- }
121
- } else {
122
- logger .info ("Yay! You are running the latest version." );
123
- }
124
- }
125
- });
104
+ HyperUpdater updater = new HyperUpdater (hyperLib );
105
+ updater .setGitHub ("hyperdefined" , "TimeBar" );
106
+ updater .setModrinth ("3w9zYjq5" );
107
+ updater .setHangar ("TimeBar" , "paper" );
108
+ updater .check ();
126
109
127
110
for (WorldTimeTracker worldTimeTracker : worldTimeTrackers ) {
128
111
worldTimeTracker .startTimer ();
@@ -136,17 +119,17 @@ public void loadConfig() {
136
119
config = YamlConfiguration .loadConfiguration (configFile );
137
120
int CONFIG_VERSION = 5 ;
138
121
if (config .getInt ("config-version" ) != CONFIG_VERSION ) {
139
- logger .warning ("You configuration is out of date! Some features may not work!" );
122
+ logger .warn ("You configuration is out of date! Some features may not work!" );
140
123
// don't feel like adding a config updater
141
124
if (config .getInt ("config-version" ) == 3 ) {
142
- logger .warning ("The configuration system has changed for this version. Please delete your configs and restart the server." );
125
+ logger .warn ("The configuration system has changed for this version. Please delete your configs and restart the server." );
143
126
}
144
127
}
145
128
146
129
// make sure there are worlds on the list
147
130
ConfigurationSection worldsSection = config .getConfigurationSection ("worlds" );
148
131
if (worldsSection == null ) {
149
- logger .severe ("No worlds section found in config! Plugin is unable to function." );
132
+ logger .error ("No worlds section found in config! Plugin is unable to function." );
150
133
Bukkit .getPluginManager ().disablePlugin (this );
151
134
return ;
152
135
}
@@ -157,7 +140,7 @@ public void loadConfig() {
157
140
World mainWorld = Bukkit .getWorld (worldName );
158
141
// skip if the world is invalid
159
142
if (mainWorld == null ) {
160
- logger .warning ( worldName + " is not a valid world, skipping. If it is a valid world, wait for your server to load then try '/timebar reload'" );
143
+ logger .warn ( "{} is not a valid world, skipping. If it is a valid world, wait for your server to load then try '/timebar reload'", worldName );
161
144
continue ;
162
145
}
163
146
// these are the worlds to display the timebar based on this world
@@ -168,7 +151,7 @@ public void loadConfig() {
168
151
if (world != null ) {
169
152
displayWorlds .add (world );
170
153
} else {
171
- logger .warning ( worldName + " is not a valid world, skipping. If it is a valid world, wait for your server to load then try '/timebar reload'" );
154
+ logger .warn ( "{} is not a valid world, skipping. If it is a valid world, wait for your server to load then try '/timebar reload'", worldName );
172
155
}
173
156
}
174
157
@@ -186,7 +169,7 @@ public void loadConfig() {
186
169
try {
187
170
bossBarColor = BossBar .Color .valueOf (color );
188
171
} catch (IllegalArgumentException exception ) {
189
- logger .warning ( color + " is not a valid bossbar color. Defaulting to blue." );
172
+ logger .warn ( "{} is not a valid bossbar color. Defaulting to blue.", color );
190
173
bossBarColor = BossBar .Color .BLUE ;
191
174
}
192
175
}
@@ -198,7 +181,7 @@ public void loadConfig() {
198
181
realisticSeasonsConfig = YamlConfiguration .loadConfiguration (realisticSeasonsConfigFile );
199
182
int REALISTIC_SEASONS_CONFIG_VERSION = 4 ;
200
183
if (realisticSeasonsConfig .getInt ("config-version" ) != REALISTIC_SEASONS_CONFIG_VERSION ) {
201
- logger .warning ("Your /plugins/TimeBar/realisticseasons.yml configuration is out of date! Some features may not work!" );
184
+ logger .warn ("Your /plugins/TimeBar/realisticseasons.yml configuration is out of date! Some features may not work!" );
202
185
}
203
186
}
204
187
if (advancedSeasons ) {
@@ -208,7 +191,7 @@ public void loadConfig() {
208
191
advancedSeasonsConfig = YamlConfiguration .loadConfiguration (advancedSeasonsConfigFile );
209
192
int ADVANCED_SEASONS_CONFIG_VERSION = 1 ;
210
193
if (advancedSeasonsConfig .getInt ("config-version" ) != ADVANCED_SEASONS_CONFIG_VERSION ) {
211
- logger .warning ("Your /plugins/TimeBar/advancedseasons.yml configuration is out of date! Some features may not work!" );
194
+ logger .warn ("Your /plugins/TimeBar/advancedseasons.yml configuration is out of date! Some features may not work!" );
212
195
}
213
196
}
214
197
}
0 commit comments