This commit is contained in:
NichtStudioCode 2024-03-06 10:06:03 +01:00
parent 51aff8fe96
commit 2d790314d3

@ -31,7 +31,7 @@ public class InvUI implements Listener {
public @NotNull Plugin getPlugin() { public @NotNull Plugin getPlugin() {
if (plugin == null) { if (plugin == null) {
plugin = tryFindPlugin(); setPlugin(tryFindPlugin());
if (plugin == null) if (plugin == null)
throw new IllegalStateException("Plugin is not set. Set it using InvUI.getInstance().setPlugin(plugin);"); throw new IllegalStateException("Plugin is not set. Set it using InvUI.getInstance().setPlugin(plugin);");
@ -60,6 +60,9 @@ public class InvUI implements Listener {
if (this.plugin != null) if (this.plugin != null)
throw new IllegalStateException("Plugin is already set"); throw new IllegalStateException("Plugin is already set");
if (plugin == null)
return;
Bukkit.getPluginManager().registerEvents(this, plugin); Bukkit.getPluginManager().registerEvents(this, plugin);
this.plugin = plugin; this.plugin = plugin;
} }