Skip to content

Commit c997cf2

Browse files
committed
📝 Add name in line
1 parent 8bd594d commit c997cf2

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242

4343
# Unreleased
4444

45+
- The inventory name can now have several lines, will be used to simplify the configuration of inventory names with zTextGenerator.
46+
4547
# 1.1.0.7
4648

4749
- Fixed NMS compatibility for **1.21.10**.

src/main/java/fr/maxlego08/menu/loader/InventoryLoader.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,15 @@ public InventoryLoader(ZMenuPlugin plugin) {
4242
public Inventory load(YamlConfiguration configuration, String path, Object... objects) throws InventoryException {
4343

4444
File file = (File) objects[0];
45-
String name = configuration.getString("name", configuration.getString("title"));
46-
name = name == null ? "" : name;
45+
var nameObject = configuration.get("name", configuration.get("title"));
46+
String name = "";
47+
48+
if (nameObject instanceof List<?> list){
49+
name = String.join("", (List<String>) list);
50+
} else if (nameObject instanceof String string){
51+
name = string;
52+
}
53+
4754
InventoryType inventoryType;
4855
int size;
4956
String nameType = configuration.getString("type", "CHEST").toUpperCase();

0 commit comments

Comments
 (0)