9
0
mirror of https://github.com/HibiscusMC/HibiscusCommons.git synced 2025-12-19 15:09:26 +00:00

fix: check if hook is active before getString methods for hooks

This commit is contained in:
LoJoSho
2024-01-05 11:23:43 -06:00
parent 680d5a9757
commit 82f13bf631

View File

@@ -93,7 +93,7 @@ public class Hooks {
public static String getStringItem(ItemStack itemStack) {
for (Hook hook : hooks.values()) {
if (hook.hasEnabledItemHook()) {
if (hook.isActive() && hook.hasEnabledItemHook()) {
String stringyItem = hook.getItemString(itemStack);
if (stringyItem == null) continue;
return hook.getId() + ":" + stringyItem;
@@ -104,7 +104,7 @@ public class Hooks {
public static String getStringEntity(Entity entity) {
for (Hook hook : hooks.values()) {
if (Bukkit.getPluginManager().getPlugin(hook.getId()) != null && hook.hasEnabledEntityHook()) {
if (hook.isActive() && hook.hasEnabledEntityHook()) {
String stringyEntity = hook.getEntityString(entity);
if (stringyEntity != null) return hook.getId() + ":" + stringyEntity;
}