From 1696aa4e546dc3ed2910040e04d4e188961b95f3 Mon Sep 17 00:00:00 2001 From: jojo Date: Mon, 8 Feb 2021 21:03:00 +0100 Subject: [PATCH] Add VersionedRunnable to ScriptListener --- .../de/steamwar/bausystem/world/ScriptListener.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/ScriptListener.java b/BauSystem_Main/src/de/steamwar/bausystem/world/ScriptListener.java index 60c3121..07cffe3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/ScriptListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/ScriptListener.java @@ -23,7 +23,7 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.commands.CommandScript; import de.steamwar.bausystem.commands.CommandTNT; import de.steamwar.bausystem.tracer.record.RecordStateMachine; -import de.steamwar.core.Core; +import de.steamwar.core.VersionedCallable; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; @@ -72,13 +72,8 @@ public class ScriptListener implements Listener { } private boolean isNoBook(ItemStack item){ - switch(Core.getVersion()){ - case 12: - return ScriptListener_12.isNoBook(item); - case 15: - default: - return ScriptListener_15.isNoBook(item); - } + return VersionedCallable.call(new VersionedCallable<>(() -> ScriptListener_12.isNoBook(item), 8), + new VersionedCallable<>(() -> ScriptListener_15.isNoBook(item), 15)); } private static class ScriptExecutor {