mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-19 15:09:19 +00:00
fix: menu type not defaulting to empty when not provided
This commit is contained in:
@@ -109,8 +109,7 @@ public class Menu {
|
|||||||
|
|
||||||
int priority = config.node("priority").getInt(1);
|
int priority = config.node("priority").getInt(1);
|
||||||
|
|
||||||
Type type = null;
|
Type type = Types.getDefaultType();
|
||||||
|
|
||||||
if (!config.node("type").virtual()) {
|
if (!config.node("type").virtual()) {
|
||||||
String typeId = config.node("type").getString("");
|
String typeId = config.node("type").getString("");
|
||||||
if (Types.isType(typeId)) type = Types.getType(typeId);
|
if (Types.isType(typeId)) type = Types.getType(typeId);
|
||||||
@@ -124,7 +123,7 @@ public class Menu {
|
|||||||
menuItems.sort(priorityCompare);
|
menuItems.sort(priorityCompare);
|
||||||
items.put(slot, menuItems);
|
items.put(slot, menuItems);
|
||||||
} else {
|
} else {
|
||||||
items.put(slot, new ArrayList<>(Arrays.asList(menuItem)));
|
items.put(slot, new ArrayList<>(List.of(menuItem)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,10 @@ package com.hibiscusmc.hmccosmetics.gui;
|
|||||||
import com.hibiscusmc.hmccosmetics.gui.type.Type;
|
import com.hibiscusmc.hmccosmetics.gui.type.Type;
|
||||||
import me.lojosho.shaded.configurate.ConfigurationNode;
|
import me.lojosho.shaded.configurate.ConfigurationNode;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public record MenuItem(List<Integer> slots, ItemStack item, Type type, int priority, ConfigurationNode itemConfig) {
|
public record MenuItem(@NotNull List<Integer> slots, @NotNull ItemStack item, Type type, int priority, ConfigurationNode itemConfig) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,4 +24,8 @@ public class Types {
|
|||||||
public static void addType(Type type) {
|
public static void addType(Type type) {
|
||||||
types.put(type.getId().toUpperCase(), type);
|
types.put(type.getId().toUpperCase(), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TypeEmpty getDefaultType() {
|
||||||
|
return TYPE_EMPTY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user