Skip to content

If the plugin not able to mkdir for the LocalExpansionManager, plugin fails to load (instead of logging it) #1132

@rinsuki

Description

@rinsuki

Confirmation

  • My issue isn't already found on the Issue tracker.
  • My issue is about PlaceholderAPI and not any expansion or external plugin
  • The issue isn't already fixed in a Spigot Release or Development Build.
  • The Common Issues page doesn't mention this issue.

Type

Plugin Bug

What happens?

I got this error (and plugin refuses to load):

[09:54:19 ERROR]: [ModernPluginLoadingStrategy] Could not load plugin 'PlaceholderAPI-2.11.6.jar' in folder 'plugins/.paper-remapped'
org.bukkit.plugin.InvalidPluginException: Exception initializing main class `me.clip.placeholderapi.PlaceholderAPIPlugin'
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:114) ~[paper-api-1.21.8-R0.1-SNAPSHOT.jar:?]
        at io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider.createInstance(SpigotPluginProvider.java:125) ~[paper-1.21.8.jar:1.21.8-40-f866a5f]
        at io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider.createInstance(SpigotPluginProvider.java:35) ~[paper-1.21.8.jar:1.21.8-40-f866a5f]
        at io.papermc.paper.plugin.entrypoint.strategy.modern.ModernPluginLoadingStrategy.loadProviders(ModernPluginLoadingStrategy.java:116) ~[paper-1.21.8.jar:1.21.8-40-f866a5f]
        at io.papermc.paper.plugin.storage.SimpleProviderStorage.enter(SimpleProviderStorage.java:38) ~[paper-1.21.8.jar:1.21.8-40-f866a5f]
        at io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.enter(LaunchEntryPointHandler.java:39) ~[paper-1.21.8.jar:1.21.8-40-f866a5f]
        at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:567) ~[paper-1.21.8.jar:1.21.8-40-f866a5f]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:235) ~[paper-1.21.8.jar:1.21.8-40-f866a5f]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1164) ~[paper-1.21.8.jar:1.21.8-40-f866a5f]
        at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:310) ~[paper-1.21.8.jar:1.21.8-40-f866a5f]
        at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:72) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[?:?]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:106) ~[paper-api-1.21.8-R0.1-SNAPSHOT.jar:?]
        ... 10 more
Caused by: java.lang.NullPointerException: Cannot invoke "me.clip.placeholderapi.PlaceholderAPIPlugin.getLogger()" because the return value of "me.clip.placeholderapi.PlaceholderAPIPlugin.getInstance()" is null
        at PlaceholderAPI-2.11.6.jar/me.clip.placeholderapi.util.Msg.log(Msg.java:35) ~[PlaceholderAPI-2.11.6.jar:?]
        at PlaceholderAPI-2.11.6.jar/me.clip.placeholderapi.util.Msg.warn(Msg.java:43) ~[PlaceholderAPI-2.11.6.jar:?]
        at PlaceholderAPI-2.11.6.jar/me.clip.placeholderapi.expansion.manager.LocalExpansionManager.<init>(LocalExpansionManager.java:95) ~[PlaceholderAPI-2.11.6.jar:?]
        at PlaceholderAPI-2.11.6.jar/me.clip.placeholderapi.PlaceholderAPIPlugin.<init>(PlaceholderAPIPlugin.java:85) ~[PlaceholderAPI-2.11.6.jar:?]
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[?:?]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:106) ~[paper-api-1.21.8-R0.1-SNAPSHOT.jar:?]
        ... 10 more

Expected Behaviour

It should show Failed to create expansions folder! warning message instead of fails to load plugin.

How to Reproduce

setting server to fail on here (by e.g. marking plugins/PlaceholderAPI/ read-only):

/papi dump Output

N/A

Console Log

No response

Errors

No response

Additional Info

Server: Paper 1.21.8-40.

We shouldn't use me.clip.placeholderapi.util.Msg.* methods from functions called from the PlaceholderAPIPlugin initialization process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: Issue (Unconfirmed)Issue is not reproducable and therefore not confirmed to exist.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions