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:
co-authored by
Claude Sonnet 5
parent
0a470339f4
commit
cdc692d6d2
@@ -62,12 +62,23 @@ public class VoteParty {
|
||||
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() {
|
||||
if (config.isVotePartyBroadcastEnabled()) {
|
||||
Bukkit.broadcastMessage(config.getVotePartyTriggeredMessage());
|
||||
}
|
||||
for (String command : config.getVotePartyCommands()) {
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user