Commits
md_5 authored 650f5090d6d
1 1 | package org.bukkit.event.server; |
2 2 | |
3 + | import java.util.Set; |
3 4 | import org.bukkit.command.CommandSender; |
4 - | import org.bukkit.entity.Player; |
5 5 | import org.bukkit.event.Cancellable; |
6 6 | import org.bukkit.event.HandlerList; |
7 7 | |
8 - | import java.util.Set; |
9 - | |
10 8 | /** |
11 - | * Event triggered for {@link org.bukkit.Server#broadcast(String, String)} |
9 + | * Event triggered for server broadcast messages such as from |
10 + | * {@link org.bukkit.Server#broadcast(String, String)}. |
12 11 | */ |
13 12 | public class BroadcastMessageEvent extends ServerEvent implements Cancellable { |
13 + | |
14 14 | private static final HandlerList handlers = new HandlerList(); |
15 15 | private String message; |
16 16 | private final Set<CommandSender> recipients; |
17 17 | private boolean cancelled = false; |
18 18 | |
19 19 | public BroadcastMessageEvent(String message, Set<CommandSender> recipients) { |
20 20 | this.message = message; |
21 21 | this.recipients = recipients; |
22 22 | } |
23 23 | |
24 24 | /** |
25 - | * Get the message to broadcast |
25 + | * Get the message to broadcast. |
26 26 | * |
27 27 | * @return Message to broadcast |
28 28 | */ |
29 29 | public String getMessage() { |
30 30 | return message; |
31 31 | } |
32 32 | |
33 33 | /** |
34 - | * Set the message to broadcast |
34 + | * Set the message to broadcast. |
35 35 | * |
36 - | * @param message Message to broadcast |
36 + | * @param message New message to broadcast |
37 37 | */ |
38 38 | public void setMessage(String message) { |
39 39 | this.message = message; |
40 40 | } |
41 41 | |
42 42 | /** |
43 - | * Gets a set of recipients that this broadcast message will be displayed to. |
43 + | * Gets a set of recipients that this chat message will be displayed to. |
44 + | * <p> |
45 + | * The set returned is not guaranteed to be mutable and may auto-populate |
46 + | * on access. Any listener accessing the returned set should be aware that |
47 + | * it may reduce performance for a lazy set implementation. |
48 + | * <p> |
49 + | * Listeners should be aware that modifying the list may throw {@link |
50 + | * UnsupportedOperationException} if the event caller provides an |
51 + | * unmodifiable set. |
44 52 | * |
45 53 | * @return All CommandSenders who will see this chat message |
46 54 | */ |
47 55 | public Set<CommandSender> getRecipients() { |
48 56 | return recipients; |
49 57 | } |
50 58 | |
51 59 | |
52 60 | public boolean isCancelled() { |
53 61 | return cancelled; |