mirror of
https://github.com/asofold/CompatNoCheatPlus.git
synced 2024-11-28 12:55:25 +01:00
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,4 +24,12 @@ public abstract class AbstractHook implements Hook{
|
|||||||
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
Block a user