Skip to content

Commit d50469c

Browse files
Copilotptthanh02
andcommitted
Complete SpawnerMenuFormUI enhancement with all requested features
Co-authored-by: ptthanh02 <73684260+ptthanh02@users.noreply.github.com>
1 parent e9aae89 commit d50469c

5 files changed

Lines changed: 129 additions & 36 deletions

File tree

core/src/main/java/github/nighter/smartspawner/spawner/gui/main/SpawnerMenuFormUI.java

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,8 @@ private GuiButton getSpawnerInfoButton(GuiLayout layout, boolean hasShopPermissi
154154
}
155155

156156
private String createInfoContent(Player player, SpawnerData spawner) {
157-
// Get configured info content from language file
158-
List<String> headerList = languageManager.getConfig().getStringList("bedrock_gui.info_content.header");
159-
String header = headerList.isEmpty() ? "INFORMATION:" : String.join(" ", headerList);
157+
// Get configured info content from language file - use hardcoded header as fallback
158+
String header = "INFORMATION:";
160159

161160
StringBuilder content = new StringBuilder();
162161
content.append(header).append("\n\n");
@@ -218,10 +217,39 @@ private Map<String, String> createContentPlaceholders(Player player, SpawnerData
218217
}
219218

220219
private void addConfiguredSection(StringBuilder content, String sectionName, Map<String, String> placeholders) {
221-
List<String> sectionLines = languageManager.getConfig().getStringList("bedrock_gui.info_content.sections." + sectionName);
220+
// Use the GUI item lore method which can access configuration
221+
List<String> sectionLines = languageManager.getGuiItemLoreList("bedrock_gui.info_content.sections." + sectionName, placeholders);
222+
223+
// If the configuration key doesn't exist, add default content
224+
if (sectionLines.isEmpty()) {
225+
addDefaultSection(content, sectionName, placeholders);
226+
return;
227+
}
228+
222229
for (String line : sectionLines) {
223-
String processedLine = languageManager.replacePlaceholders(line, placeholders);
224-
content.append(processedLine).append("\n");
230+
content.append(line).append("\n");
231+
}
232+
}
233+
234+
private void addDefaultSection(StringBuilder content, String sectionName, Map<String, String> placeholders) {
235+
// Default fallback content if configuration is missing
236+
switch (sectionName) {
237+
case "spawner_info":
238+
content.append("Stack: ").append(placeholders.get("stack_size")).append("\n");
239+
content.append("Range: ").append(placeholders.get("range")).append(" blocks\n");
240+
content.append("Mobs: ").append(placeholders.get("min_mobs")).append(" - ").append(placeholders.get("max_mobs")).append("\n");
241+
content.append("Delay: ").append(placeholders.get("delay")).append("s\n\n");
242+
break;
243+
case "storage_info":
244+
content.append("STORAGE:\n");
245+
content.append("Slots: ").append(placeholders.get("current_items")).append("/").append(placeholders.get("max_items")).append("\n");
246+
content.append("Status: ").append(placeholders.get("storage_status")).append("\n\n");
247+
break;
248+
case "experience_info":
249+
content.append("EXPERIENCE:\n");
250+
content.append("Current: ").append(placeholders.get("current_exp")).append("/").append(placeholders.get("max_exp")).append(" XP\n");
251+
content.append("Status: ").append(placeholders.get("exp_status")).append("\n");
252+
break;
225253
}
226254
}
227255

core/src/main/resources/gui_layouts/DonutSMP/main_gui.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ buttons:
2323
condition: "shop_integration"
2424
actions:
2525
left_click: "sell_inventory" # Collect EXP and sell items in storage
26-
right_click: "sell_inventory" # Open stacker GUI
26+
right_click: "open_stacker" # Open stacker GUI
2727

2828
# Spawner information display without shop integration
2929
# Without shop integration: Both clicks open stacker GUI
@@ -32,6 +32,9 @@ buttons:
3232
material: PLAYER_HEAD
3333
enabled: true
3434
condition: "no_shop_integration"
35+
actions:
36+
left_click: "open_stacker" # Open stacker GUI
37+
right_click: "open_stacker" # Open stacker GUI
3538

3639
# Experience collection button
3740
exp:
@@ -40,4 +43,14 @@ buttons:
4043
enabled: true
4144
actions:
4245
left_click: "collect_exp"
43-
right_click: "collect_exp"
46+
right_click: "collect_exp"
47+
48+
# Sell all items button (only items, no experience)
49+
sell_all:
50+
slot: 10
51+
material: GOLD_INGOT
52+
enabled: true
53+
condition: "shop_integration"
54+
actions:
55+
left_click: "sell_all"
56+
right_click: "sell_all"

core/src/main/resources/language/DonutSMP/gui.yml

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,55 @@ bedrock_gui:
3333
# Button text configuration for Bedrock forms
3434
buttons:
3535
# Storage button - opens spawner loot storage
36-
storage: '&#F97603Open Storage'
36+
storage: 'Open Storage'
3737

3838
# Info/Stack button - opens spawner stacking menu
39-
stack_info: '&#FCE300Open Stack Menu'
39+
stack_info: 'Open Stack Menu'
4040

4141
# Experience button - collects stored experience
42-
experience: '&#FCE300Collect Experience'
42+
experience: 'Collect Experience'
43+
44+
# Sell inventory button - collects XP and sells all items
45+
sell_inventory: 'Claim XP & Sell All'
46+
47+
# Sell all button - sells all items only
48+
sell_all: 'Sell All Items'
4349

4450
# Status text for storage and experience displays
4551
status:
4652
storage:
47-
empty: '&#aEmpty'
48-
plenty_space: '&#aPlenty of Space'
49-
half_full: '&#eHalf Full'
50-
filling_up: '&#F97603Filling Up'
51-
nearly_full: '&#cNearly Full'
53+
empty: 'Empty'
54+
plenty_space: 'Plenty of Space'
55+
half_full: 'Half Full'
56+
filling_up: 'Filling Up'
57+
nearly_full: 'Nearly Full'
5258

5359
experience:
54-
empty: '&#aEmpty'
55-
small_amount: '&#aSmall Amount'
56-
medium_amount: '&#FCE300Medium Amount'
57-
large_amount: '&#F97603Large Amount'
58-
almost_full: '&#cAlmost Full'
60+
empty: 'Empty'
61+
small_amount: 'Small Amount'
62+
medium_amount: 'Medium Amount'
63+
large_amount: 'Large Amount'
64+
almost_full: 'Almost Full'
65+
66+
# Configurable spawner info content for Bedrock forms (displayed at bottom)
67+
info_content:
68+
header: 'INFORMATION:'
69+
sections:
70+
spawner_info:
71+
- 'Stack: %stack_size%'
72+
- 'Range: %range% blocks'
73+
- 'Mobs: %min_mobs% - %max_mobs%'
74+
- 'Delay: %delay%s'
75+
- ''
76+
storage_info:
77+
- 'STORAGE:'
78+
- 'Slots: %current_items%/%max_items%'
79+
- 'Status: %storage_status%'
80+
- ''
81+
experience_info:
82+
- 'EXPERIENCE:'
83+
- 'Current: %current_exp%/%max_exp% XP'
84+
- 'Status: %exp_status%'
5985

6086
spawner_storage_item:
6187
name: '&#F97603sᴘᴀᴡɴᴇʀ sᴛᴏʀᴀɢᴇ'

core/src/main/resources/language/en_US/gui.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ bedrock_gui:
7474
- 'Range: %range% blocks'
7575
- 'Mobs: %min_mobs% - %max_mobs%'
7676
- 'Delay: %delay%s'
77-
storage_info:
7877
- ''
78+
storage_info:
7979
- 'STORAGE:'
8080
- 'Slots: %current_items%/%max_items%'
8181
- 'Status: %storage_status%'
82-
experience_info:
8382
- ''
83+
experience_info:
8484
- 'EXPERIENCE:'
8585
- 'Current: %current_exp%/%max_exp% XP'
8686
- 'Status: %exp_status%'

core/src/main/resources/language/vi_VN/gui.yml

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,55 @@ bedrock_gui:
3333
# Button text configuration for Bedrock forms
3434
buttons:
3535
# Storage button - opens spawner loot storage
36-
storage: '&#fce96aᴍở ᴋʜᴏ ᴄʜứᴀ'
36+
storage: 'Mở Kho Chứa'
3737

3838
# Info/Stack button - opens spawner stacking menu
39-
stack_info: '&#ab7afdᴍở ᴍᴇɴᴜ xếᴘ ᴄʜồɴɢ'
39+
stack_info: 'Mở Menu Xếp Chồng'
4040

4141
# Experience button - collects stored experience
42-
experience: '&#37eb9aThu thập ᴋɪɴʜ ɴɢʜɪệᴍ'
42+
experience: 'Thu Thập Kinh Nghiệm'
43+
44+
# Sell inventory button - collects XP and sells all items
45+
sell_inventory: 'Nhận XP & Bán Tất Cả'
46+
47+
# Sell all button - sells all items only
48+
sell_all: 'Bán Tất Cả Vật Phẩm'
4349

4450
# Status text for storage and experience displays
4551
status:
4652
storage:
47-
empty: '&#aTrống'
48-
plenty_space: '&#aCòn ɴʜɪềᴜ ᴄʜỗ'
49-
half_full: '&#eNửᴀ đầʏ'
50-
filling_up: '&#6Đang đầʏ dần'
51-
nearly_full: '&#cGầɴ đầʏ'
53+
empty: 'Trống'
54+
plenty_space: 'Còn nhiều chỗ'
55+
half_full: 'Nửa đầy'
56+
filling_up: 'Đang đầy dần'
57+
nearly_full: 'Gần đầy'
5258

5359
experience:
54-
empty: '&#aTrống'
55-
small_amount: '&#aSố ʟượɴɢ ɪ́ᴛ'
56-
medium_amount: '&#eSố ʟượɴɢ ᴛrung bình'
57-
large_amount: '&#6Số ʟượɴɢ ʟớɴ'
58-
almost_full: '&#cGầɴ đầʏ'
60+
empty: 'Trống'
61+
small_amount: 'Số lượng ít'
62+
medium_amount: 'Số lượng trung bình'
63+
large_amount: 'Số lượng lớn'
64+
almost_full: 'Gần đầy'
65+
66+
# Configurable spawner info content for Bedrock forms (displayed at bottom)
67+
info_content:
68+
header: 'THÔNG TIN:'
69+
sections:
70+
spawner_info:
71+
- 'Chồng: %stack_size%'
72+
- 'Phạm vi: %range% khối'
73+
- 'Quái vật: %min_mobs% - %max_mobs%'
74+
- 'Độ trễ: %delay%s'
75+
- ''
76+
storage_info:
77+
- 'KHO CHỨA:'
78+
- 'Ô: %current_items%/%max_items%'
79+
- 'Trạng thái: %storage_status%'
80+
- ''
81+
experience_info:
82+
- 'KINH NGHIỆM:'
83+
- 'Hiện tại: %current_exp%/%max_exp% XP'
84+
- 'Trạng thái: %exp_status%'
5985

6086
spawner_storage_item:
6187
name: '&#fce96aᴋʜᴏ ᴄʜứᴀ'

0 commit comments

Comments
 (0)