From 776c523bde38bbd176345429212386ac6c11a565 Mon Sep 17 00:00:00 2001 From: Tobias Ottenweller Date: Fri, 7 Feb 2014 10:54:33 +0100 Subject: [PATCH] Better handling on missing plugins. --- plugin.yml | 4 ++-- src/de/craftinc/gates/dynmap/Plugin.java | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/plugin.yml b/plugin.yml index 205899d..6be050c 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,8 +1,8 @@ name: ${project.name} version: ${project.version} description: A plugin to create gates for fast traveling. -depend: [Craft Inc. Gates, dynmap] +softdepend: [Craft Inc. Gates, dynmap] author: tomco -website: FIXME +website: http://dev.bukkit.org/bukkit-plugins/craftinc-gates/ main: de.craftinc.gates.dynmap.Plugin database: false diff --git a/src/de/craftinc/gates/dynmap/Plugin.java b/src/de/craftinc/gates/dynmap/Plugin.java index 1a1c91e..ff51bea 100644 --- a/src/de/craftinc/gates/dynmap/Plugin.java +++ b/src/de/craftinc/gates/dynmap/Plugin.java @@ -57,6 +57,7 @@ public class Plugin extends JavaPlugin implements GateChangeListener super.onEnable(); if (!loadAPI()) { + Logger.log(Level.SEVERE, "Error while enabling! Stopping now!"); return; } @@ -69,7 +70,10 @@ public class Plugin extends JavaPlugin implements GateChangeListener @Override public void onDisable() { - this.gatesPlugin.getGatesManager().removeGateChangeListener(this); + if (this.gatesPlugin != null) { + this.gatesPlugin.getGatesManager().removeGateChangeListener(this); + } + super.onDisable(); }