Skip to content

Commit a4e3e4d

Browse files
committed
refactor: use logger() method
1 parent 54b26f5 commit a4e3e4d

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/main/java/cc/happyareabean/sjm/SimpleJoinMessage.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ public void onEnable() {
7777

7878
checkUpdate();
7979

80-
getLogger().info("SimpleJoinMessage version " + getDescription().getVersion() + " has been successfully enabled!");
80+
logger().info("SimpleJoinMessage version " + getDescription().getVersion() + " has been successfully enabled!");
8181
}
8282

8383
private void loadLibraries() {
84-
getLogger().info("Loading libraries...");
84+
logger().info("Loading libraries...");
8585

8686
BukkitLibraryManager libraryManager = new BukkitLibraryManager(this);
8787

@@ -94,21 +94,21 @@ private void loadLibraries() {
9494
}
9595

9696
private void loadSettings() {
97-
getLogger().info("Loading settings...");
97+
logger().info("Loading settings...");
9898
SJMConfig = new SJMConfig(new File(getDataFolder(), "settings.yml").toPath());
9999
miscConfig = new SJMMisc(new File(getDataFolder(), "misc.yml").toPath());
100100
syncConfig = new SJMSync(new File(getDataFolder(), "sync.yml").toPath());
101101
}
102102

103103
private void loadDatabase() {
104-
getLogger().info("Loading database...");
104+
logger().info("Loading database...");
105105
database = new DatabaseManager();
106106
}
107107

108108
private void loadSync() {
109109
if (!syncConfig.isEnabled()) return;
110110

111-
getLogger().info("Loading sync...");
111+
logger().info("Loading sync...");
112112
String collection = syncConfig.getCollectionName();
113113

114114
if (collection.isEmpty()) {
@@ -117,46 +117,46 @@ private void loadSync() {
117117
}
118118

119119
database.getContent(collection).ifPresentOrElse(data -> {
120-
getLogger().info("Updating join message from collection [%s]...".formatted(collection));
120+
logger().info("Updating join message from collection [%s]...".formatted(collection));
121121

122122
String content = new String(Util.BASE64_DECODER.decode(data.getContent()));
123123
SJMConfig.setJoinMessage(Arrays.stream(content.split("\n")).toList());
124124

125125
if (syncConfig.isSaveJoinMessage()) {
126-
getLogger().info("Saving config...");
126+
logger().info("Saving config...");
127127
SJMConfig.save();
128-
getLogger().info("Config has been successfully saved.");
128+
logger().info("Config has been successfully saved.");
129129
}
130130

131-
getLogger().info("Sync completed!");
131+
logger().info("Sync completed!");
132132
}, () -> {
133133

134134
if (syncConfig.isDisablePluginIfFailed()) {
135135
Bukkit.getPluginManager().disablePlugin(this);
136136
return;
137137
}
138138

139-
getLogger().warning("The collection [%s] does not exist, skipping sync process.".formatted(collection));
139+
logger().warn("The collection [%s] does not exist, skipping sync process.".formatted(collection));
140140
});
141141
}
142142

143143
private void loadMisc() {
144-
getLogger().info("Loading misc...");
144+
logger().info("Loading misc...");
145145
adventureWebEditorAPI = new AdventureWebEditorAPI(URI.create(this.SJMConfig.getAdventureWebURL()));
146146
new Metrics(this, 15462);
147147

148-
getLogger().info("Checking supported plugins...");
148+
logger().info("Checking supported plugins...");
149149
checkSupportedPlugin();
150150
}
151151

152152
private void registerListeners() {
153-
getLogger().info("Registering listener...");
153+
logger().info("Registering listener...");
154154
getServer().getPluginManager().registerEvents(new PlayerJoinListener(), this);
155155
getServer().getPluginManager().registerEvents(new UpdateNotifyListener(), this);
156156
}
157157

158158
private void registerCommands() {
159-
getLogger().info("Registering commands...");
159+
logger().info("Registering commands...");
160160
commandHandler = BukkitCommandHandler.create(this);
161161
commandHandler.enableAdventure(adventure);
162162
commandHandler.setMessagePrefix(LEGACY_SERIALIZER.serialize(Constants.PREFIX));
@@ -185,7 +185,7 @@ public void checkUpdate() {
185185
"You are currently using development build of SimpleJoinMessage!",
186186
"Please report issues here: https://go.happyareabean.cc/sjm/issues",
187187
"******************************************"
188-
).forEach(s -> getLogger().warning(s));
188+
).forEach(s -> logger().warn(s));
189189
return;
190190
}
191191

@@ -207,19 +207,19 @@ public void updateAvailable(String newVersion, String downloadUrl, boolean hasDi
207207
"Download at " + downloadUrl,
208208
"",
209209
"******************************************"
210-
).forEach(s -> getLogger().warning(s));
210+
).forEach(s -> logger().warn(s));
211211
}
212212

213213
@Override
214214
public void upToDate() {
215-
getLogger().info(String.format("SimpleJoinMessage is up to date! (%s)", version));
215+
logger().info(String.format("SimpleJoinMessage is up to date! (%s)", version));
216216
}
217217
});
218218
}
219219

220220
public void checkSupportedPlugin() {
221221
if (!isPAPISupported()) {
222-
getLogger().warning("PlaceholderAPI is not enabled, you will not be able to use any placeholder from PlaceholderAPI.");
222+
logger().warn("PlaceholderAPI is not enabled, you will not be able to use any placeholder from PlaceholderAPI.");
223223
}
224224
}
225225

0 commit comments

Comments
 (0)