Fix : %player% jamais remplace dans les commandes VoteParty
CI / build (push) Successful in 12m41s

Les commandes voteparty.commands s'executaient une seule fois cote
console sans substitution de %player%, ce qui envoyait le placeholder
brut aux plugins de recompense (ex. "excellentcrates key give %player%
epic 5" -> "Joueur introuvable"). Les commandes contenant %player% sont
maintenant executees une fois par joueur en ligne ; les commandes sans
placeholder (deja globales, ex. "goldencrates broadcast_give ...")
gardent leur comportement precedent.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
SarTron-NorthBlue
2026-07-25 17:23:46 +04:00
co-authored by Claude Sonnet 5
parent 0a470339f4
commit cdc692d6d2
@@ -62,14 +62,25 @@ public class VoteParty {
save(); save();
} }
/**
* Commands without %player% run once (e.g. a crate plugin's own "give to everyone"
* command). Commands containing %player% are dispatched once per online player, since
* VoteParty rewards the whole server rather than a single voter.
*/
private void trigger() { private void trigger() {
if (config.isVotePartyBroadcastEnabled()) { if (config.isVotePartyBroadcastEnabled()) {
Bukkit.broadcastMessage(config.getVotePartyTriggeredMessage()); Bukkit.broadcastMessage(config.getVotePartyTriggeredMessage());
} }
for (String command : config.getVotePartyCommands()) { for (String command : config.getVotePartyCommands()) {
if (command.contains("%player%")) {
for (org.bukkit.entity.Player player : Bukkit.getOnlinePlayers()) {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replace("%player%", player.getName()));
}
} else {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command); Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
} }
} }
}
public int getCurrentVotes() { public int getCurrentVotes() {
return currentVotes.get(); return currentVotes.get();