Skip to content

Commit 1ab7109

Browse files
author
MagicTeaMC
committed
no more useless deprecation message
1 parent 13efdd0 commit 1ab7109

4 files changed

Lines changed: 17 additions & 4 deletions

File tree

src/main/java/org/milkteamc/autotreechop/AutoTreeChop.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.bstats.bukkit.Metrics;
2929
import org.bukkit.Bukkit;
3030
import org.bukkit.command.CommandSender;
31+
import org.bukkit.plugin.PluginDescriptionFile;
3132
import org.bukkit.plugin.java.JavaPlugin;
3233
import org.milkteamc.autotreechop.command.AboutCommand;
3334
import org.milkteamc.autotreechop.command.ConfirmCommand;
@@ -66,6 +67,7 @@ public class AutoTreeChop extends JavaPlugin {
6667
private TranslationManager translationManager;
6768
private ConfirmationManager confirmationManager;
6869
private ModrinthUpdateChecker updateChecker;
70+
private PluginDescriptionFile description;
6971

7072
private boolean worldGuardEnabled = false;
7173
private boolean residenceEnabled = false;
@@ -101,6 +103,13 @@ public static boolean isFolia() {
101103
}
102104
}
103105

106+
@Override
107+
public void onLoad() {
108+
@SuppressWarnings("deprecation")
109+
PluginDescriptionFile desc = getDescription();
110+
this.description = desc;
111+
}
112+
104113
@Override
105114
public void onEnable() {
106115
instance = this;
@@ -336,6 +345,10 @@ public ModrinthUpdateChecker getUpdateChecker() {
336345
return updateChecker;
337346
}
338347

348+
public PluginDescriptionFile getPluginDescription() {
349+
return description;
350+
}
351+
339352
public CooldownManager getCooldownManager() {
340353
return cooldownManager;
341354
}

src/main/java/org/milkteamc/autotreechop/AutoTreeChopExpansion.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ public AutoTreeChopExpansion(AutoTreeChop plugin) {
3737

3838
@Override
3939
public @NotNull String getAuthor() {
40-
return plugin.getDescription().getAuthors().get(0);
40+
return plugin.getPluginDescription().getAuthors().get(0);
4141
}
4242

4343
@Override
4444
public @NotNull String getVersion() {
45-
return plugin.getDescription().getVersion();
45+
return plugin.getPluginDescription().getVersion();
4646
}
4747

4848
@Override

src/main/java/org/milkteamc/autotreechop/command/AboutCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void about(BukkitCommandActor actor) {
4141
AutoTreeChop.sendMessage(
4242
sender,
4343
MessageKeys.ABOUT_HEADER,
44-
Placeholder.parsed("version", plugin.getDescription().getVersion()));
44+
Placeholder.parsed("version", plugin.getPluginDescription().getVersion()));
4545

4646
AutoTreeChop.sendMessage(sender, MessageKeys.ABOUT_LICENSE);
4747
AutoTreeChop.sendMessage(sender, MessageKeys.ABOUT_GITHUB);

src/main/java/org/milkteamc/autotreechop/updater/ModrinthUpdateChecker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public enum UpdateCheckResult {
9393
public ModrinthUpdateChecker(@NotNull AutoTreeChop plugin, @NotNull String projectId, @NotNull String loader) {
9494
this.plugin = plugin;
9595
this.projectId = projectId;
96-
this.currentVersion = plugin.getDescription().getVersion();
96+
this.currentVersion = plugin.getPluginDescription().getVersion();
9797
this.loader = loader;
9898
this.minecraftVersion = plugin.getServer().getBukkitVersion().split("-")[0];
9999
}

0 commit comments

Comments
 (0)