Skip to content

Commit

Permalink
Add tooltips for Visit Island Icon.
Browse files Browse the repository at this point in the history
  • Loading branch information
BONNe committed Aug 20, 2021
1 parent 4bc1d7a commit 80fc391
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
34 changes: 31 additions & 3 deletions src/main/java/world/bentobox/visit/panels/player/VisitPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,38 @@ private PanelItem createIslandButton(Island island)
split("\n")).
collect(Collectors.toList());

// Add tooltips.
if (canVisit)
if (this.clickedIsland != null)
{
this.user.getTranslationOrNothing(Constants.TIPS + "click-to-visit");
String confirm = this.user.getTranslationOrNothing(Constants.TIPS + "left-click-to-confirm");

if (!confirm.isBlank())
{
description.add("");
description.add(confirm);
}

String cancel = this.user.getTranslationOrNothing(Constants.TIPS + "right-click-to-cancel");

if (!cancel.isBlank())
{
if (confirm.isBlank())
{
// If confirm was blank, add empty line.
description.add("");
}

description.add(cancel);
}
}
else if (canVisit)
{
String toolTip = this.user.getTranslationOrNothing(Constants.TIPS + "click-to-visit");

if (!toolTip.isBlank())
{
description.add("");
description.add(toolTip);
}
}

builder.description(description);
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ visit:
right-click-to-clear: "&e Right Click &7 to clear."
click-to-select: "&e Click &7 to select."
click-to-deselect: "&e Click &7 to deselect."
left-click-to-confirm: "&e Left Click &7 to confirm."
right-click-to-cancel: "&e Right Click &7 to cancel."
errors:
noone-is-online: '&r&c Noone from this island is online!'
not-enough-credits: '&r&c You do not have enough credits to visit this island. Necessary [number] credits.'
Expand Down

0 comments on commit 80fc391

Please sign in to comment.