@@ -45,22 +45,19 @@ public static MenuInventory createNationMenu(@NotNull Player player) {
45
45
.title (Component .text ("Nation Menu" ))
46
46
.rows (6 )
47
47
.addItem (MenuHelper .backButton ().build ())
48
- .addItem (MenuItem .builder (Material .WRITABLE_BOOK )
49
- .name (Component .text ("Transaction History " , NamedTextColor .GREEN ))
50
- .slot (SlotAnchor .anchor (VerticalAnchor .fromBottom (1 ), HorizontalAnchor .fromLeft (4 )))
48
+ .addItem (MenuItem .builder (Material .EMERALD_BLOCK )
49
+ .name (Component .text ("Nation Bank " , NamedTextColor .GREEN ))
50
+ .slot (SlotAnchor .anchor (VerticalAnchor .fromBottom (1 ), HorizontalAnchor .fromLeft (3 )))
51
51
.lore (() -> {
52
52
if (nation == null )
53
53
return Component .text ("You are not part of a nation." , NamedTextColor .GRAY );
54
- else if (!player .hasPermission (PermissionNodes .TOWNY_COMMAND_NATION_BANKHISTORY .getNode ()))
55
- return Component .text ("You do not have permission to view the nations's transaction history." , NamedTextColor .GRAY );
56
54
else
57
- return Component .text ("Click to view the nations's transaction history ." , NamedTextColor .GRAY );
55
+ return Component .text ("Click to view the nation bank menu ." , NamedTextColor .GRAY );
58
56
})
59
- .action (nation == null || !player .hasPermission (PermissionNodes .TOWNY_COMMAND_NATION_BANKHISTORY .getNode ()) ? ClickAction .NONE :
60
- ClickAction .openInventory (() -> TownMenu .createBankHistoryMenu (nation )))
57
+ .action (nation == null ? ClickAction .NONE : ClickAction .openInventory (() -> formatNationBankMenu (player )))
61
58
.build ())
62
59
.addItem (MenuItem .builder (Material .RED_BED )
63
- .slot (SlotAnchor .anchor (VerticalAnchor .fromTop (1 ), HorizontalAnchor .fromLeft (2 )))
60
+ .slot (SlotAnchor .anchor (VerticalAnchor .fromTop (1 ), HorizontalAnchor .fromLeft (1 )))
64
61
.name (Component .text ("Nation Spawn" , NamedTextColor .GREEN ))
65
62
.lore (() -> {
66
63
if (nation == null )
@@ -85,7 +82,7 @@ else if (!player.hasPermission("towny.nation.spawn.nation"))
85
82
.build ())
86
83
.addItem (MenuItem .builder (Material .LEVER )
87
84
.name (Component .text ("Nation Toggle" , NamedTextColor .GREEN ))
88
- .slot (SlotAnchor .anchor (VerticalAnchor .fromTop (1 ), HorizontalAnchor .fromRight (2 )))
85
+ .slot (SlotAnchor .anchor (VerticalAnchor .fromTop (1 ), HorizontalAnchor .fromRight (1 )))
89
86
.lore (() -> {
90
87
if (nation == null )
91
88
return Component .text ("You must be in a nation in order to view the toggle menu." , NamedTextColor .GRAY );
@@ -96,13 +93,13 @@ else if (!player.hasPermission("towny.nation.spawn.nation"))
96
93
.build ())
97
94
.addItem (MenuItem .builder (Material .GRASS_BLOCK )
98
95
.name (Component .text ("Nation Set" , NamedTextColor .GREEN ))
99
- .slot (SlotAnchor .anchor (VerticalAnchor .fromBottom (2 ), HorizontalAnchor .fromRight (2 )))
96
+ .slot (SlotAnchor .anchor (VerticalAnchor .fromBottom (1 ), HorizontalAnchor .fromRight (3 )))
100
97
.lore (Component .text ("Click to open the nation set menu." , NamedTextColor .GRAY ))
101
98
.action (ClickAction .openInventory (() -> formatNationSetMenu (player )))
102
99
.build ())
103
100
.addItem (MenuItem .builder (Material .ENDER_EYE )
104
101
.name (Component .text ("Online in Nation" , NamedTextColor .GREEN ))
105
- .slot (SlotAnchor .anchor (VerticalAnchor .fromBottom (2 ), HorizontalAnchor .fromLeft (2 )))
102
+ .slot (SlotAnchor .anchor (VerticalAnchor .fromBottom (2 ), HorizontalAnchor .fromLeft (1 )))
106
103
.lore (() -> {
107
104
if (nation == null )
108
105
return Component .text ("You are not part of a nation." , NamedTextColor .GRAY );
@@ -129,6 +126,7 @@ else if (!player.hasPermission(PermissionNodes.TOWNY_COMMAND_NATION_ONLINE.getNo
129
126
.build ())
130
127
.addItem (MenuItem .builder (Material .PLAYER_HEAD )
131
128
.name (Component .text ("Nation Resident Overview" , NamedTextColor .GREEN ))
129
+ .slot (SlotAnchor .anchor (VerticalAnchor .fromBottom (2 ), HorizontalAnchor .fromRight (1 )))
132
130
.lore (() -> {
133
131
if (nation == null )
134
132
return Component .text ("You are not part of a nation." , NamedTextColor .GRAY );
@@ -137,19 +135,6 @@ else if (!player.hasPermission(PermissionNodes.TOWNY_COMMAND_NATION_ONLINE.getNo
137
135
})
138
136
.action (nation == null ? ClickAction .NONE : ClickAction .openInventory (() -> createResidentOverview (player )))
139
137
.build ())
140
- .addItem (MenuItem .builder (Material .EMERALD_BLOCK )
141
- .name (Component .text ("Deposit or Withdraw" , NamedTextColor .GREEN ))
142
- .slot (1 )
143
- .lore (() -> {
144
- if (nation == null )
145
- return Component .text ("You are not part of a nation." , NamedTextColor .GRAY );
146
- else if (!TownyEconomyHandler .isActive ())
147
- return Translatable .of ("msg_err_no_economy" ).locale (player ).component ().color (NamedTextColor .GRAY );
148
- else
149
- return Component .text ("Click to deposit to or withdraw from the nation bank." , NamedTextColor .GRAY );
150
- })
151
- .action (nation == null || !TownyEconomyHandler .isActive () ? ClickAction .NONE : ClickAction .openInventory (() -> GovernmentMenus .createDepositWithdrawMenu (player , nation )))
152
- .build ())
153
138
.build ();
154
139
}
155
140
@@ -460,4 +445,48 @@ public static MenuInventory formatRankManagementMenu(Player player, Nation natio
460
445
461
446
return paginator .build ();
462
447
}
448
+
449
+ public static MenuInventory formatNationBankMenu (final Player player ) {
450
+ final Nation nation = TownyAPI .getInstance ().getNation (player );
451
+
452
+ final MenuInventory .Builder builder = MenuInventory .builder ()
453
+ .title (Component .text ("Nation Bank" ))
454
+ .rows (3 )
455
+ .addItem (MenuHelper .backButton ().build ())
456
+ .addItem (MenuItem .builder (Material .EMERALD_BLOCK )
457
+ .name (Component .text ("Deposit or Withdraw" , NamedTextColor .GREEN ))
458
+ .slot (SlotAnchor .anchor (VerticalAnchor .fromTop (1 ), HorizontalAnchor .fromLeft (2 )))
459
+ .lore (() -> {
460
+ if (nation == null )
461
+ return Component .text ("You are not part of a nation." , NamedTextColor .GRAY );
462
+ else if (!TownyEconomyHandler .isActive ())
463
+ return Translatable .of ("msg_err_no_economy" ).locale (player ).component ().color (NamedTextColor .GRAY );
464
+ else
465
+ return Component .text ("Click to deposit to or withdraw from the nation bank." , NamedTextColor .GRAY );
466
+ })
467
+ .action (nation == null || !TownyEconomyHandler .isActive () ? ClickAction .NONE : ClickAction .openInventory (() -> GovernmentMenus .createDepositWithdrawMenu (player , nation )))
468
+ .build ())
469
+ .addItem (MenuItem .builder (Material .WRITABLE_BOOK )
470
+ .name (Component .text ("Transaction History" , NamedTextColor .GREEN ))
471
+ .slot (SlotAnchor .anchor (VerticalAnchor .fromTop (1 ), HorizontalAnchor .fromRight (2 )))
472
+ .lore (() -> {
473
+ if (nation == null )
474
+ return Component .text ("You are not part of a nation." , NamedTextColor .GRAY );
475
+ else if (!player .hasPermission (PermissionNodes .TOWNY_COMMAND_NATION_BANKHISTORY .getNode ()))
476
+ return Component .text ("You do not have permission to view the nations's transaction history." , NamedTextColor .GRAY );
477
+ else
478
+ return Component .text ("Click to view the nations's transaction history." , NamedTextColor .GRAY );
479
+ })
480
+ .action (nation == null || !player .hasPermission (PermissionNodes .TOWNY_COMMAND_NATION_BANKHISTORY .getNode ()) ? ClickAction .NONE :
481
+ ClickAction .openInventory (() -> TownMenu .createBankHistoryMenu (nation )))
482
+ .build ());
483
+
484
+ if (nation != null && TownyEconomyHandler .isActive ()) {
485
+ builder .addItem (TownMenu .formatBankStatus (player , nation .getAccount (), false )
486
+ .slot (SlotAnchor .anchor (VerticalAnchor .fromTop (0 ), HorizontalAnchor .fromLeft (4 )))
487
+ .build ());
488
+ }
489
+
490
+ return builder .build ();
491
+ }
463
492
}
0 commit comments