mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-01-07 19:28:11 +01:00
Guard logging code because of paper changes
This commit is contained in:
parent
36c6964109
commit
4e2502da1d
@ -28,7 +28,6 @@
|
||||
import io.papermc.paper.plugin.bootstrap.PluginProviderContext;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@SuppressWarnings({ "UnstableApiUsage", "unused" })
|
||||
public class MinepacksBootstrap implements PluginBootstrap
|
||||
@ -75,7 +74,15 @@ private boolean patchPluginMeta(final @NotNull PluginProviderContext context)
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
context.getLogger().log(Level.SEVERE, "Failed to patch main class in PluginMeta! Falling back to Standalone mode!", e);
|
||||
try
|
||||
{
|
||||
context.getLogger().error("Failed to patch main class in PluginMeta! Falling back to Standalone mode!", e);
|
||||
}
|
||||
catch(Throwable ignored)
|
||||
{
|
||||
System.out.println("[Minepacks] Failed to patch main class in PluginMeta! Falling back to Standalone mode!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -87,18 +94,31 @@ private boolean checkPcgfPluginLib(final @NotNull PluginProviderContext context)
|
||||
{
|
||||
if (new Version(version).olderThan(new Version(MagicValues.MIN_PCGF_PLUGIN_LIB_VERSION)))
|
||||
{
|
||||
context.getLogger().info("PCGF-PluginLib to old! Switching to standalone mode!");
|
||||
logInfo("PCGF-PluginLib to old! Switching to standalone mode!", context);
|
||||
}
|
||||
else
|
||||
{
|
||||
context.getLogger().info("PCGF-PluginLib installed. Switching to normal mode!");
|
||||
logInfo("PCGF-PluginLib installed. Switching to normal mode!", context);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
context.getLogger().info("PCGF-PluginLib not installed. Switching to standalone mode!");
|
||||
logInfo("PCGF-PluginLib not installed. Switching to standalone mode!", context);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO remove this stupid code once the paper API stabilizes to a point where once can expect at least the logger class ot not randomly change
|
||||
private void logInfo(final @NotNull String message, final @NotNull PluginProviderContext context)
|
||||
{
|
||||
try
|
||||
{
|
||||
context.getLogger().info(message);
|
||||
}
|
||||
catch(Throwable t)
|
||||
{
|
||||
System.out.println("[Minepacks] Failed to log message: " + message);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user