55import net .minestom .server .item .Material ;
66import net .swofty .commons .ServerType ;
77import net .swofty .commons .StringUtility ;
8+ import net .swofty .type .generic .data .datapoints .DatapointToggles ;
89import net .swofty .type .generic .gui .inventory .ItemStackCreator ;
9- import net .swofty .type .generic .gui .v2 .*;
10+ import net .swofty .type .generic .gui .v2 .Components ;
11+ import net .swofty .type .generic .gui .v2 .DefaultState ;
12+ import net .swofty .type .generic .gui .v2 .StatelessView ;
13+ import net .swofty .type .generic .gui .v2 .ViewConfiguration ;
14+ import net .swofty .type .generic .gui .v2 .ViewLayout ;
1015import net .swofty .type .generic .gui .v2 .context .ViewContext ;
1116import net .swofty .type .generic .user .HypixelPlayer ;
1217import net .swofty .type .skyblockgeneric .calendar .CalendarEvent ;
1823import net .swofty .type .skyblockgeneric .gui .inventories .sbmenu .levels .GUISkyBlockLevels ;
1924import net .swofty .type .skyblockgeneric .gui .inventories .sbmenu .profiles .GUIProfileManagement ;
2025import net .swofty .type .skyblockgeneric .gui .inventories .sbmenu .questlog .GUIMissionLog ;
21- import net .swofty .type .skyblockgeneric .gui .inventories .sbmenu .recipe .GUIRecipe ;
2226import net .swofty .type .skyblockgeneric .gui .inventories .sbmenu .recipe .GUIRecipeBook ;
2327import net .swofty .type .skyblockgeneric .gui .inventories .sbmenu .skills .GUISkills ;
2428import net .swofty .type .skyblockgeneric .gui .inventories .sbmenu .storage .GUIStorage ;
3034
3135import java .time .Duration ;
3236import java .util .ArrayList ;
37+ import java .util .Collections ;
3338import java .util .List ;
3439import java .util .Map ;
3540
@@ -50,21 +55,21 @@ public void layout(ViewLayout<DefaultState> layout, DefaultState state, ViewCont
5055 PlayerStatistics statistics = player .getStatistics ();
5156 List <String > lore = new ArrayList <>(List .of ("§7View your equipment, stats, and more!" , "§e " ));
5257 List <String > stats = new ArrayList <>(List .of ("Health" , "Defense" , "Speed" , "Strength" , "Intelligence" ,
53- "Crit Chance" , "Crit Damage" , "Swing Range"
58+ "Crit Chance" , "Crit Damage" , "Swing Range"
5459 ));
5560 statistics .allStatistics ().getOverall ().forEach ((statistic , value ) -> {
5661 if (!value .equals (statistic .getBaseAdditiveValue ()) || stats .contains (statistic .getDisplayName ())) {
5762 lore .add (" " + statistic .getFullDisplayName () + " §f" +
58- StringUtility .decimalify (value , 2 ) + statistic .getSuffix ());
63+ StringUtility .decimalify (value , 2 ) + statistic .getSuffix ());
5964 }
6065 });
6166
6267 lore .add ("§e " );
6368 lore .add ("§eClick to view!" );
6469
6570 return ItemStackCreator .getStackHead ("§aYour SkyBlock Profile" ,
66- player .getPlayerSkin (), 1 ,
67- lore
71+ player .getPlayerSkin (), 1 ,
72+ lore
6873 );
6974 }, (click , c ) -> {
7075 SkyBlockPlayer player = (SkyBlockPlayer ) c .player ();
@@ -77,53 +82,53 @@ public void layout(ViewLayout<DefaultState> layout, DefaultState state, ViewCont
7782 SkyBlockLevelRequirement nextLevel = levelRequirement .getNextLevel ();
7883
7984 return ItemStackCreator .getStackHead ("§aSkyBlock Leveling" , "3255327dd8e90afad681a19231665bea2bd06065a09d77ac1408837f9e0b242" , 1 ,
80- "§7Your SkyBlock Level: §8[" + levelRequirement .getColor () + levelRequirement + "§8]" ,
81- " " ,
82- "§7Determine how far you've" ,
83- "§7progressed in SkyBlock and earn" ,
84- "§7rewards from completing unique" ,
85- "§7tasks." ,
86- " " ,
87- "§7Progress to Level " + (nextLevel == null ? "§cMAX" : nextLevel ),
88- player .getSkyBlockExperience ().getNextLevelDisplay (),
89- " " ,
90- "§eClick to view!"
85+ "§7Your SkyBlock Level: §8[" + levelRequirement .getColor () + levelRequirement + "§8]" ,
86+ " " ,
87+ "§7Determine how far you've" ,
88+ "§7progressed in SkyBlock and earn" ,
89+ "§7rewards from completing unique" ,
90+ "§7tasks." ,
91+ " " ,
92+ "§7Progress to Level " + (nextLevel == null ? "§cMAX" : nextLevel ),
93+ player .getSkyBlockExperience ().getNextLevelDisplay (),
94+ " " ,
95+ "§eClick to view!"
9196 );
9297 }, (click , c ) -> c .push (new GUISkyBlockLevels ()));
9398
9499 layout .slot (29 , (s , c ) -> ItemStackCreator .getStackHead ("§aYour Bags" , "961a918c0c49ba8d053e522cb91abc74689367b4d8aa06bfc1ba9154730985ff" , 1 ,
95- "§7Different bags allow you to store" ,
96- "§7many different items inside!" ,
97- " " ,
98- "§eClick to view!"
100+ "§7Different bags allow you to store" ,
101+ "§7many different items inside!" ,
102+ " " ,
103+ "§eClick to view!"
99104 ), (click , c ) -> {
100105 c .push (new GUIYourBags ());
101106 });
102107
103108 layout .slot (30 , (s , c ) -> {
104109 SkyBlockPlayer player = (SkyBlockPlayer ) c .player ();
105110 return ItemStackCreator .getStack ("§aPets" , Material .BONE , 1 ,
106- "§7View and manage all of your" ,
107- "§7Pets." ,
108- " " ,
109- "§7Level up your pets faster by" ,
110- "§7gaining XP in their favourite" ,
111- "§7skill!" ,
112- " " ,
113- "§7Selected pet: " + (player .getPetData ().getEnabledPet () == null ? "§cNone" : player .getPetData ().getEnabledPet ().getDisplayName ()),
114- " " ,
115- "§eClick to view!"
111+ "§7View and manage all of your" ,
112+ "§7Pets." ,
113+ " " ,
114+ "§7Level up your pets faster by" ,
115+ "§7gaining XP in their favourite" ,
116+ "§7skill!" ,
117+ " " ,
118+ "§7Selected pet: " + (player .getPetData ().getEnabledPet () == null ? "§cNone" : player .getPetData ().getEnabledPet ().getDisplayName ()),
119+ " " ,
120+ "§eClick to view!"
116121 );
117122 }, (click , c ) -> c .push (new GUIPets (), GUIPets .createInitialState ((SkyBlockPlayer ) c .player ())));
118123
119124 layout .slot (21 , (s , c ) -> {
120125 SkyBlockPlayer player = (SkyBlockPlayer ) c .player ();
121126 List <String > lore = new ArrayList <>(List .of (
122- "§7Through your adventure, you will" ,
123- "§7unlock recipes for all kinds of" ,
124- "§7special items! You can view how to" ,
125- "§7craft these items here." ,
126- " "
127+ "§7Through your adventure, you will" ,
128+ "§7unlock recipes for all kinds of" ,
129+ "§7special items! You can view how to" ,
130+ "§7craft these items here." ,
131+ " "
127132 ));
128133
129134 SkyBlockRecipe .getMissionDisplay (lore , player .getUuid ());
@@ -136,46 +141,46 @@ public void layout(ViewLayout<DefaultState> layout, DefaultState state, ViewCont
136141 });
137142
138143 layout .slot (25 , (s , c ) -> ItemStackCreator .getStack ("§aStorage" , Material .CHEST , 1 ,
139- "§7Store global items that you" ,
140- "§7want to access at any time" ,
141- "§7from anywhere here." ,
142- " " ,
143- "§eClick to view!"
144+ "§7Store global items that you" ,
145+ "§7want to access at any time" ,
146+ "§7from anywhere here." ,
147+ " " ,
148+ "§eClick to view!"
144149 ), (click , c ) -> c .push (new GUIStorage ()));
145150
146151 layout .slot (23 , (s , c ) -> ItemStackCreator .getStack ("§aQuests & Chapters" , Material .WRITABLE_BOOK , 1 ,
147- "§7Each island has its own series of" ,
148- "§bChapters §7for you to complete!" ,
149- " " ,
150- "§7Complete tasks within a Chapter to" ,
151- "§7earn small §6rewards§7, or complete" ,
152- "§7entire Chapters to earn big ones!" ,
153- " " ,
154- "§7Some islands also have §aQuests §7for" ,
155- "§7you to complete! Some items can only" ,
156- "§7be obtained through Quests." ,
157- " " ,
158- "§eClick to view!"
152+ "§7Each island has its own series of" ,
153+ "§bChapters §7for you to complete!" ,
154+ " " ,
155+ "§7Complete tasks within a Chapter to" ,
156+ "§7earn small §6rewards§7, or complete" ,
157+ "§7entire Chapters to earn big ones!" ,
158+ " " ,
159+ "§7Some islands also have §aQuests §7for" ,
160+ "§7you to complete! Some items can only" ,
161+ "§7be obtained through Quests." ,
162+ " " ,
163+ "§eClick to view!"
159164 ), (click , c ) -> c .push (new GUIMissionLog ()));
160165
161- layout .autoUpdating (24 , (s , c ) -> ItemStackCreator .getStack ("§aCalendar and Events" , Material .CLOCK , 1 , getCalendarLore ()),
162- ( click , c ) -> c .push (new GUICalendar ()), Duration .ofSeconds (1 ));
166+ layout .autoUpdating (24 , (s , c ) -> ItemStackCreator .getStack ("§aCalendar and Events" , Material .CLOCK , 1 , getCalendarLore (ctx )),
167+ ( _ , c ) -> c .push (new GUICalendar ()), Duration .ofSeconds (1 ));
163168
164169 layout .slot (19 , (s , c ) -> ItemStackCreator .getStack ("§aYour Skills" , Material .DIAMOND_SWORD , 1 ,
165- "§7View your Skill progression and" ,
166- "§7rewards." ,
167- " " ,
168- "§eClick to view!"
170+ "§7View your Skill progression and" ,
171+ "§7rewards." ,
172+ " " ,
173+ "§eClick to view!"
169174 ), (click , c ) -> c .push (new GUISkills ()));
170175
171176 layout .slot (20 , (s , c ) -> {
172177 SkyBlockPlayer player = (SkyBlockPlayer ) c .player ();
173178 List <String > lore = new ArrayList <>(List .of (
174- "§7View all of the items available in" ,
175- "§7SkyBlock. Collect more of an item to" ,
176- "§7unlock rewards on your way to" ,
177- "§7becoming a master of SkyBlock!" ,
178- " "
179+ "§7View all of the items available in" ,
180+ "§7SkyBlock. Collect more of an item to" ,
181+ "§7unlock rewards on your way to" ,
182+ "§7becoming a master of SkyBlock!" ,
183+ " "
179184 ));
180185
181186 player .getCollection ().getDisplay (lore );
@@ -189,17 +194,17 @@ public void layout(ViewLayout<DefaultState> layout, DefaultState state, ViewCont
189194 });
190195
191196 layout .slot (31 , (s , c ) -> ItemStackCreator .getStack ("§aCrafting Table" , Material .CRAFTING_TABLE , 1 ,
192- "§7Opens the crafting grid." ,
193- " " ,
194- "§eClick to open!"
197+ "§7Opens the crafting grid." ,
198+ " " ,
199+ "§eClick to open!"
195200 ), (click , c ) -> c .push (new GUICrafting ()));
196201
197202 layout .slot (47 , (s , c ) -> ItemStackCreator .getStackHead ("§bFast Travel" , "f151cffdaf303673531a7651b36637cad912ba485643158e548d59b2ead5011" , 1 ,
198- "§7Teleport to islands you've already" ,
199- "§7visited." ,
200- " " ,
201- "§8Right-click to warp home!" ,
202- "§eClick to pick location!"
203+ "§7Teleport to islands you've already" ,
204+ "§7visited." ,
205+ " " ,
206+ "§8Right-click to warp home!" ,
207+ "§eClick to pick location!"
203208 ), (click , c ) -> {
204209 SkyBlockPlayer player = (SkyBlockPlayer ) c .player ();
205210 if (click .click () instanceof Click .Right ) {
@@ -213,29 +218,29 @@ public void layout(ViewLayout<DefaultState> layout, DefaultState state, ViewCont
213218 layout .slot (48 , (s , c ) -> {
214219 HypixelPlayer player = c .player ();
215220 return ItemStackCreator .getStack ("§aProfile Management" , Material .NAME_TAG , 1 ,
216- "§7You can have multiple SkyBlock" ,
217- "§7profiles at the same time." ,
218- " " ,
219- "§7Each profile has its own island," ,
220- "§7inventory, quest log..." ,
221- " " ,
222- "§7Profiles: §e" + ((SkyBlockPlayer ) player ).getProfiles ().getProfiles ().size () + "§6/§e4" ,
223- " " ,
224- "§eClick to manage!"
221+ "§7You can have multiple SkyBlock" ,
222+ "§7profiles at the same time." ,
223+ " " ,
224+ "§7Each profile has its own island," ,
225+ "§7inventory, quest log..." ,
226+ " " ,
227+ "§7Profiles: §e" + ((SkyBlockPlayer ) player ).getProfiles ().getProfiles ().size () + "§6/§e4" ,
228+ " " ,
229+ "§eClick to manage!"
225230 );
226231 }, (click , c ) -> c .push (new GUIProfileManagement ()));
227232 }
228233
229- private static @ NonNull List <String > getCalendarLore () {
234+ private static @ NonNull List <String > getCalendarLore (ViewContext ctx ) {
230235 List <CalendarEvent > currentEvents = SkyBlockCalendar .getCurrentEvents ();
231236 boolean multipleEvents = currentEvents .size () > 1 ;
232237
233238 List <String > lore = new ArrayList <>(List .of ("§7View the SkyBlock Calendar, upcoming" ,
234- "§7events, and event rewards!" ,
235- " " ,
236- "§7Date: §a" + StringUtility .ntify (SkyBlockCalendar .getDay ()) + " " + SkyBlockCalendar .getMonthName () + " " + SkyBlockCalendar .getYear (),
237- "" ));
238- if (multipleEvents ) {
239+ "§7events, and event rewards!" ,
240+ " " ,
241+ "§7Date: §a" + StringUtility .ntify (SkyBlockCalendar .getDay ()) + " " + SkyBlockCalendar .getMonthName () + " " + SkyBlockCalendar .getYear (),
242+ "" ));
243+ if (multipleEvents ) {
239244 lore .add ("§7Current events: " );
240245 for (CalendarEvent event : currentEvents ) {
241246 lore .add (event .getDisplayName (SkyBlockCalendar .getYear ()));
@@ -251,7 +256,13 @@ public void layout(ViewLayout<DefaultState> layout, DefaultState state, ViewCont
251256
252257 lore .add (" " );
253258
254- Map <SkyBlockCalendar .EventInfo , CalendarEvent > upcomingEvents = SkyBlockCalendar .getEventsWithDurationUntil (1 );
259+ Map <SkyBlockCalendar .EventInfo , CalendarEvent > upcomingEvents ;
260+ if (ctx .player ().getToggles ().get (DatapointToggles .Toggles .ToggleType .HAS_VISITED_DARK_AUCTION )) {
261+ upcomingEvents = SkyBlockCalendar .getEventsWithDurationUntil (1 );
262+ } else {
263+ upcomingEvents = SkyBlockCalendar .getEventsWithDurationUntilSkipSpecific (1 , Collections .singletonList (CalendarEvent .DARK_AUCTION ));
264+ }
265+
255266 if (!upcomingEvents .isEmpty ()) {
256267 Map .Entry <SkyBlockCalendar .EventInfo , CalendarEvent > entry = upcomingEvents .entrySet ().iterator ().next ();
257268 SkyBlockCalendar .EventInfo info = entry .getKey ();
@@ -264,26 +275,26 @@ public void layout(ViewLayout<DefaultState> layout, DefaultState state, ViewCont
264275 }
265276
266277 lore .addAll (
267- List .of (
268- " " ,
269- "§8Also accessible via /calendar" ,
270- " " ,
271- "§eClick to view!"
272- )
278+ List .of (
279+ " " ,
280+ "§8Also accessible via /calendar" ,
281+ " " ,
282+ "§eClick to view!"
283+ )
273284 );
274285 return lore ;
275286 }
276287
277- private static long getTicksRemaining (CalendarEvent currentEvent ) {
278- long currentElapsedInYear = SkyBlockCalendar .getElapsed () % SkyBlockCalendar .YEAR ;
279- long eventEndTime = 0 ;
280- for (Long eventStartTime : currentEvent .times ()) {
281- if (currentElapsedInYear >= eventStartTime && currentElapsedInYear < eventStartTime + currentEvent .duration ().toMillis () / 50 ) {
282- eventEndTime = eventStartTime + currentEvent .duration ().toMillis () / 50 ;
283- break ;
284- }
285- }
286- return eventEndTime - currentElapsedInYear ;
287- }
288+ private static long getTicksRemaining (CalendarEvent currentEvent ) {
289+ long currentElapsedInYear = SkyBlockCalendar .getElapsed () % SkyBlockCalendar .YEAR ;
290+ long eventEndTime = 0 ;
291+ for (Long eventStartTime : currentEvent .times ()) {
292+ if (currentElapsedInYear >= eventStartTime && currentElapsedInYear < eventStartTime + currentEvent .duration ().toMillis () / 50 ) {
293+ eventEndTime = eventStartTime + currentEvent .duration ().toMillis () / 50 ;
294+ break ;
295+ }
296+ }
297+ return eventEndTime - currentElapsedInYear ;
298+ }
288299
289300}
0 commit comments