Skip to content

Commit 2d79031

Browse files
Fix #65
1 parent 51aff8f commit 2d79031

File tree

1 file changed

+4
-1
lines changed
  • invui-core/src/main/java/xyz/xenondevs/invui

1 file changed

+4
-1
lines changed

invui-core/src/main/java/xyz/xenondevs/invui/InvUI.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private InvUI() {
3131

3232
public @NotNull Plugin getPlugin() {
3333
if (plugin == null) {
34-
plugin = tryFindPlugin();
34+
setPlugin(tryFindPlugin());
3535

3636
if (plugin == null)
3737
throw new IllegalStateException("Plugin is not set. Set it using InvUI.getInstance().setPlugin(plugin);");
@@ -60,6 +60,9 @@ public void setPlugin(@NotNull Plugin plugin) {
6060
if (this.plugin != null)
6161
throw new IllegalStateException("Plugin is already set");
6262

63+
if (plugin == null)
64+
return;
65+
6366
Bukkit.getPluginManager().registerEvents(this, plugin);
6467
this.plugin = plugin;
6568
}

0 commit comments

Comments
 (0)