From c70c2283a220ed315fd76eae3db0a0514c2aaa50 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sat, 14 May 2016 23:50:35 +1000 Subject: [PATCH] Recover from failed event registration --- .../com/plotsquared/bukkit/BukkitMain.java | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java index 3a51307c2..0ad458e1a 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java @@ -72,6 +72,12 @@ import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper; import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper; import com.plotsquared.bukkit.uuid.SQLUUIDHandler; import com.sk89q.worldedit.bukkit.WorldEditPlugin; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Chunk; @@ -87,13 +93,6 @@ import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.UUID; - public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain { public static WorldEditPlugin worldEdit; @@ -345,13 +344,25 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain PlayerEvents main = new PlayerEvents(); getServer().getPluginManager().registerEvents(main, this); if (PS.get().checkVersion(getServerVersion(), 1, 8, 0)) { - getServer().getPluginManager().registerEvents(new PlayerEvents_1_8(), this); + try { + getServer().getPluginManager().registerEvents(new PlayerEvents_1_8(), this); + } catch (Throwable e) { + e.printStackTrace(); + } } if (PS.get().checkVersion(getServerVersion(), 1, 8, 3)) { - getServer().getPluginManager().registerEvents(new PlayerEvents183(), this); + try { + getServer().getPluginManager().registerEvents(new PlayerEvents183(), this); + } catch (Throwable e) { + e.printStackTrace(); + } } if (PS.get().checkVersion(getServerVersion(), 1, 9, 0)) { - getServer().getPluginManager().registerEvents(new PlayerEvents_1_9(main), this); + try { + getServer().getPluginManager().registerEvents(new PlayerEvents_1_9(main), this); + } catch (Throwable e) { + e.printStackTrace(); + } } }