Skip to content

Commit c83a0ef

Browse files
committed
Throw exception early if server version is unsupported
Addresses #1822
1 parent d1debb7 commit c83a0ef

File tree

1 file changed

+6
-0
lines changed
  • IF/src/main/java/com/github/stefvanschie/inventoryframework/gui/type/util

1 file changed

+6
-0
lines changed

IF/src/main/java/com/github/stefvanschie/inventoryframework/gui/type/util/Gui.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.github.stefvanschie.inventoryframework.pane.component.*;
99
import com.github.stefvanschie.inventoryframework.util.TriFunction;
1010
import com.github.stefvanschie.inventoryframework.util.XMLUtil;
11+
import com.github.stefvanschie.inventoryframework.util.version.Version;
1112
import org.bukkit.Bukkit;
1213
import org.bukkit.Material;
1314
import org.bukkit.entity.HumanEntity;
@@ -157,6 +158,11 @@ public Gui(@NotNull Plugin plugin) {
157158
this.plugin = plugin;
158159

159160
if (!hasRegisteredListeners) {
161+
/*This throws an exception if the version is unsupported. We want this thrown if our version is unsupported,
162+
to prevent people opening guis that do not behave correctly. */
163+
//noinspection ResultOfMethodCallIgnored
164+
Version.getVersion();
165+
160166
Bukkit.getPluginManager().registerEvents(new GuiListener(plugin), plugin);
161167

162168
hasRegisteredListeners = true;

0 commit comments

Comments
 (0)