Skip to content

Commit

Permalink
fix display of wrong jar version error
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Aug 17, 2024
1 parent 9e9d659 commit 0675ec8
Showing 1 changed file with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ public final class AnarchyExploitFixes extends JavaPlugin {
@Override
public void onLoad() {
PlatformUtil.load();
prefixedLogger = ComponentLogger.logger(getLogger().getName());
unPrefixedLogger = ComponentLogger.logger("");
// Disable logging for some shaded libraries as those can get very verbose
String shadedLibs = getClass().getPackageName() + ".libs";
Configurator.setLevel(shadedLibs + ".reflections.Reflections", Level.OFF);
Expand All @@ -70,6 +68,22 @@ public void onLoad() {

@Override
public void onEnable() {
if (!PlatformUtil.isPaper()) {
getLogger().severe("This plugin depends on Paper's API, which is not present on your server.");
getServer().getPluginManager().disablePlugin(this);
return;
}

if (PlatformUtil.getMinecraftVersion() < 19) {
getLogger().severe("The Folia jar is intended for Paper and Folia servers running 1.19 and above.");
getLogger().severe("Please replace it with the Legacy jar.");
getServer().getPluginManager().disablePlugin(this);
return;
}

prefixedLogger = ComponentLogger.logger(getLogger().getName());
unPrefixedLogger = ComponentLogger.logger("");

if (!isPacketEventsInstalled) {
Stream.of(" ",
" _ _ _ _ _ ",
Expand Down Expand Up @@ -104,21 +118,8 @@ public void onEnable() {
" "
).map(str -> Component.text(str).color(KyoriUtil.AEF_WHITE)).forEach(prefixedLogger::info);

if (!PlatformUtil.isPaper()) {
prefixedLogger.error("This plugin depends on Paper's API, which is not present on your server.");
getServer().getPluginManager().disablePlugin(this);
return;
}

prefixedLogger.info("Detected Version 1.{}.{}", PlatformUtil.getMinecraftVersion(), PlatformUtil.getMinecraftPatchVersion());

if (PlatformUtil.getMinecraftVersion() < 19) {
prefixedLogger.error("The Folia jar is intended for Paper and Folia servers running 1.19 and above.");
prefixedLogger.error("Please replace it with the Legacy jar.");
getServer().getPluginManager().disablePlugin(this);
return;
}

if (PlatformUtil.isFolia()) {
prefixedLogger.info("Detected Folia server.");
}
Expand Down

0 comments on commit 0675ec8

Please sign in to comment.