mirror of
https://github.com/HibiscusMC/HibiscusCommons.git
synced 2025-12-20 15:39:17 +00:00
fix: check if hook is active before getString methods for hooks
This commit is contained in:
@@ -93,7 +93,7 @@ public class Hooks {
|
|||||||
|
|
||||||
public static String getStringItem(ItemStack itemStack) {
|
public static String getStringItem(ItemStack itemStack) {
|
||||||
for (Hook hook : hooks.values()) {
|
for (Hook hook : hooks.values()) {
|
||||||
if (hook.hasEnabledItemHook()) {
|
if (hook.isActive() && hook.hasEnabledItemHook()) {
|
||||||
String stringyItem = hook.getItemString(itemStack);
|
String stringyItem = hook.getItemString(itemStack);
|
||||||
if (stringyItem == null) continue;
|
if (stringyItem == null) continue;
|
||||||
return hook.getId() + ":" + stringyItem;
|
return hook.getId() + ":" + stringyItem;
|
||||||
@@ -104,7 +104,7 @@ public class Hooks {
|
|||||||
|
|
||||||
public static String getStringEntity(Entity entity) {
|
public static String getStringEntity(Entity entity) {
|
||||||
for (Hook hook : hooks.values()) {
|
for (Hook hook : hooks.values()) {
|
||||||
if (Bukkit.getPluginManager().getPlugin(hook.getId()) != null && hook.hasEnabledEntityHook()) {
|
if (hook.isActive() && hook.hasEnabledEntityHook()) {
|
||||||
String stringyEntity = hook.getEntityString(entity);
|
String stringyEntity = hook.getEntityString(entity);
|
||||||
if (stringyEntity != null) return hook.getId() + ":" + stringyEntity;
|
if (stringyEntity != null) return hook.getId() + ":" + stringyEntity;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user