Commits
BillyGalbreath authored and md_5 committed 0196df734da
1 + | package org.bukkit.event.server; |
2 + | |
3 + | import org.bukkit.command.CommandSender; |
4 + | import org.bukkit.entity.Player; |
5 + | import org.bukkit.event.Cancellable; |
6 + | import org.bukkit.event.HandlerList; |
7 + | |
8 + | import java.util.Set; |
9 + | |
10 + | /** |
11 + | * Event triggered for {@link org.bukkit.Server#broadcast(String, String)} |
12 + | */ |
13 + | public class BroadcastMessageEvent extends ServerEvent implements Cancellable { |
14 + | private static final HandlerList handlers = new HandlerList(); |
15 + | private String message; |
16 + | private final Set<CommandSender> recipients; |
17 + | private boolean cancelled = false; |
18 + | |
19 + | public BroadcastMessageEvent(String message, Set<CommandSender> recipients) { |
20 + | this.message = message; |
21 + | this.recipients = recipients; |
22 + | } |
23 + | |
24 + | /** |
25 + | * Get the message to broadcast |
26 + | * |
27 + | * @return Message to broadcast |
28 + | */ |
29 + | public String getMessage() { |
30 + | return message; |
31 + | } |
32 + | |
33 + | /** |
34 + | * Set the message to broadcast |
35 + | * |
36 + | * @param message Message to broadcast |
37 + | */ |
38 + | public void setMessage(String message) { |
39 + | this.message = message; |
40 + | } |
41 + | |
42 + | /** |
43 + | * Gets a set of recipients that this broadcast message will be displayed to. |
44 + | * |
45 + | * @return All CommandSenders who will see this chat message |
46 + | */ |
47 + | public Set<CommandSender> getRecipients() { |
48 + | return recipients; |
49 + | } |
50 + | |
51 + | |
52 + | public boolean isCancelled() { |
53 + | return cancelled; |
54 + | } |
55 + | |
56 + | |
57 + | public void setCancelled(boolean cancelled) { |
58 + | this.cancelled = cancelled; |
59 + | } |
60 + | |
61 + | |
62 + | public HandlerList getHandlers() { |
63 + | return handlers; |
64 + | } |
65 + | |
66 + | public static HandlerList getHandlerList() { |
67 + | return handlers; |
68 + | } |
69 + | } |