Skip to content

Commit

Permalink
Cache who got the vault waring shown when placing join signs
Browse files Browse the repository at this point in the history
  • Loading branch information
FireInstall committed Jun 11, 2024
1 parent d1f778f commit fa78281
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.inventory.ItemStack;

public class JoinSign implements MinigameSign {
import java.util.HashSet;
import java.util.UUID;

public class JoinSign implements MinigameSign {
private static final HashSet<UUID> shownWarning = new HashSet<>();
private static final Minigames plugin = Minigames.getPlugin();

@Override
Expand Down Expand Up @@ -54,8 +57,12 @@ public boolean signCreate(SignChangeEvent event) {
event.setLine(3, "$" + event.getLine(3));
}
} else {
event.setLine(3, "");
event.getPlayer().sendMessage(ChatColor.RED + MinigameUtils.getLang("minigame.error.noVault"));
if (!shownWarning.contains(event.getPlayer().getUniqueId())) {
event.setLine(3, "");
event.getPlayer().sendMessage(ChatColor.RED + MinigameUtils.getLang("minigame.error.noVault"));

shownWarning.add(event.getPlayer().getUniqueId());
}
}
return true;
}
Expand Down

0 comments on commit fa78281

Please sign in to comment.