Skip to content

Commit

Permalink
Add debugging related to model providers
Browse files Browse the repository at this point in the history
  • Loading branch information
virustotalop committed Jan 22, 2024
1 parent b9f1f42 commit 9064f47
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 9064f47

Please sign in to comment.