Skip to content

Commit 25020d6

Browse files
committed
Fix icon types not being properly replaced
1 parent c000dc4 commit 25020d6

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

core/src/main/java/com/clubobsidian/dynamicgui/core/gui/SimpleSlot.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.clubobsidian.dynamicgui.api.inventory.ItemStackWrapper;
2525
import com.clubobsidian.dynamicgui.api.manager.ModelManager;
2626
import com.clubobsidian.dynamicgui.api.manager.inventory.ItemStackManager;
27+
import com.clubobsidian.dynamicgui.api.manager.material.MaterialManager;
2728
import com.clubobsidian.dynamicgui.api.manager.replacer.AnimationReplacerManager;
2829
import com.clubobsidian.dynamicgui.api.manager.replacer.ReplacerManager;
2930
import com.clubobsidian.dynamicgui.api.model.ModelProvider;
@@ -184,23 +185,26 @@ public FunctionTree getFunctions() {
184185
public ItemStackWrapper<?> buildItemStack(@NotNull PlayerWrapper<?> playerWrapper) {
185186
Objects.requireNonNull(playerWrapper);
186187
ItemStackWrapper<?> builderItem = this.itemStack;
188+
String updatedIcon = MaterialManager
189+
.get()
190+
.normalizeMaterial(ReplacerManager.get().replace(this.icon, playerWrapper));
187191
if (builderItem == null) {
188-
builderItem = ItemStackManager.get().createItemStackWrapper(this.icon, this.amount);
192+
builderItem = ItemStackManager.get().createItemStackWrapper(updatedIcon, this.amount);
189193
} else {
190-
builderItem.setType(this.icon);
194+
builderItem.setType(updatedIcon);
191195
builderItem.setAmount(this.amount);
192196
}
193197
if (builderItem == null) {
194198
DynamicGui.get().getLogger().error(
195199
"Invalid material type '%s' for slot '%d' in gui '%s'",
196-
this.icon,
200+
updatedIcon,
197201
this.index,
198202
this.getOwner().getName()
199203
);
200204
return null;
201205
}
202206

203-
if (!this.icon.equalsIgnoreCase(IGNORE_MATERIAL)) {
207+
if (!updatedIcon.equalsIgnoreCase(IGNORE_MATERIAL)) {
204208
if (this.data != 0) {
205209
builderItem.setDurability(this.data);
206210
}

core/src/main/java/com/clubobsidian/dynamicgui/core/manager/GuiManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ private List<Slot> createSlots(GuiToken guiToken) {
451451
int index = next.getKey();
452452
SlotToken slotToken = next.getValue();
453453

454-
String icon = MaterialManager.get().normalizeMaterial(slotToken.getIcon());
454+
String icon = slotToken.getIcon();
455455
String name = slotToken.getName();
456456

457457
if (name != null) {

0 commit comments

Comments
 (0)