mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-17 23:01:01 +01:00
Added PlayerChatEvent.getRecipients
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
1595230d40
commit
258fa8e21c
1 changed files with 15 additions and 0 deletions
|
@ -1,6 +1,9 @@
|
|||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
|
@ -11,10 +14,13 @@ public class PlayerChatEvent extends PlayerEvent implements Cancellable {
|
|||
private boolean cancel = false;
|
||||
private String message;
|
||||
private String format = "<%1$s> %2$s";
|
||||
private final Set<Player> recipients;
|
||||
|
||||
public PlayerChatEvent(final Type type, final Player player, final String message) {
|
||||
super(type, player);
|
||||
this.message = message;
|
||||
|
||||
recipients = new HashSet<Player>(Arrays.asList(player.getServer().getOnlinePlayers()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,4 +96,13 @@ public class PlayerChatEvent extends PlayerEvent implements Cancellable {
|
|||
|
||||
this.format = format;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a set of recipients that this chat message will be displayed to
|
||||
*
|
||||
* @return All Players who will see this chat message
|
||||
*/
|
||||
public Set<Player> getRecipients() {
|
||||
return recipients;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue