Skip to content

Commit

Permalink
Cleanup DestinationSelectionGUI#toItem
Browse files Browse the repository at this point in the history
  • Loading branch information
Rollczi committed Sep 8, 2024
1 parent 36d5225 commit 7197215
Showing 1 changed file with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class DestinationSelectionGUI extends GuiView {
private static final int HEIGHT = 4;
private static final Page FIRST_PAGE = new Page(0, WIDTH * HEIGHT);


private final Plugin plugin;
private final BukkitScheduler scheduler;
private final PluginConfiguration config;
Expand Down Expand Up @@ -102,22 +101,16 @@ private Supplier<GuiItem> toItem(Player player, Locker locker, PaginatedGuiRefre
ConfigItem parcelItem = this.config.guiSettings.destinationLockerItem.clone();

return () -> {
List<String> lore;
boolean isLockerSelected = uuid.equals(this.state.getDestinationLocker());
if (isLockerSelected) {
// This lore indicates the receiver is already selected
lore = List.of(this.config.guiSettings.parcelDestinationSetLine);
} else {
// This lore indicates the user can click to select this receiver
lore = List.of(this.config.guiSettings.parcelDestinationNotSetLine);
}

String name = parcelItem.getName().replace("{DESCRIPTION}", locker.description());
boolean isLockerSelected = uuid.equals(this.state.getDestinationLocker());
String oneLineLore = isLockerSelected
? this.config.guiSettings.parcelDestinationSetLine
: this.config.guiSettings.parcelDestinationNotSetLine;

return parcelItem
.setName(name)
.setGlow(isLockerSelected)
.setLore(lore)
.setLore(List.of(oneLineLore))
.toGuiItem(event -> {
if (isLockerSelected) {
this.state.setDestinationLocker(null);
Expand Down

0 comments on commit 7197215

Please sign in to comment.