From 9064f47886dddc575fe50e04dda59bfdd13d61f2 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 21 Jan 2024 18:54:49 -0800 Subject: [PATCH] Add debugging related to model providers --- .../bukkit/registry/model/ItemsAdderModelProvider.java | 10 ++++++++++ .../clubobsidian/dynamicgui/core/gui/SimpleSlot.java | 2 ++ 2 files changed, 12 insertions(+) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java index 1d3385471..f34e28943 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java @@ -16,6 +16,7 @@ package com.clubobsidian.dynamicgui.bukkit.registry.model; +import com.clubobsidian.dynamicgui.api.DynamicGui; import com.clubobsidian.dynamicgui.api.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.api.manager.inventory.ItemStackManager; import com.clubobsidian.dynamicgui.api.model.ModelProvider; @@ -74,11 +75,20 @@ public boolean applyModel(ItemStackWrapper itemStack, String data) { .createItemStackWrapper(GET_ITEM_STACK.invoke(customStack)); if (wrappedCustom.hasCustomModel()) { return itemStack.setModel(wrappedCustom.getModelData()); + } else { + DynamicGui.get().getLogger().error("Cannot find model data for %s", data); } + } else { + DynamicGui.get().getLogger().error("No model data found '%s' for provider '%s'", + data, + this.name() + ); } } catch (IllegalAccessException | InvocationTargetException e) { e.printStackTrace(); } + } else { + DynamicGui.get().getLogger().error("Failed applying ItemsAdder model due to an outdated API"); } return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/SimpleSlot.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/SimpleSlot.java index 65f72d66a..0e8dcd1b7 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/SimpleSlot.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/SimpleSlot.java @@ -201,6 +201,8 @@ public ItemStackWrapper buildItemStack(@NotNull PlayerWrapper playerWrappe ModelProvider provider = ModelManager.get().getProvider(this.modelProvider); if (provider != null) { provider.applyModel(builderItem, this.modelData); + } else { + DynamicGui.get().getLogger().error("No model provider found for '%s'", this.modelProvider); } }