add assertPluginPresent to AbstractHook
This commit is contained in:
parent
40f7057744
commit
53e8b24740
|
@ -1,5 +1,6 @@
|
||||||
package me.asofold.bukkit.cncp.hooks;
|
package me.asofold.bukkit.cncp.hooks;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,5 +23,13 @@ public abstract class AbstractHook implements Hook{
|
||||||
// No listeners (improbable).
|
// No listeners (improbable).
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Throw a runtime exception if the plugin is not present.
|
||||||
|
* @param pluginName
|
||||||
|
*/
|
||||||
|
protected void assertPluginPresent(String pluginName){
|
||||||
|
if (Bukkit.getPluginManager().getPlugin(pluginName) == null) throw new RuntimeException("Assertion, " + getHookName() + ": Plugin " + pluginName + " is not present.");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue