diff options
author | BillyGalbreath <Blake.Galbreath@GMail.com> | 2017-07-16 18:44:44 -0500 |
---|---|---|
committer | md_5 <git@md-5.net> | 2017-07-28 16:56:48 +1000 |
commit | 0196df734da5a305e5e744179a238cdda5e8f96c (patch) | |
tree | 0ea7547d2279ac7f245e4426dad50b765bc4da9a /src/main/java/org/bukkit | |
parent | 6ed0a976e5e8da5599c95eb7e92976f1c839acf1 (diff) | |
download | bukkit-0196df734da5a305e5e744179a238cdda5e8f96c.tar bukkit-0196df734da5a305e5e744179a238cdda5e8f96c.tar.gz bukkit-0196df734da5a305e5e744179a238cdda5e8f96c.tar.lz bukkit-0196df734da5a305e5e744179a238cdda5e8f96c.tar.xz bukkit-0196df734da5a305e5e744179a238cdda5e8f96c.zip |
Add BroadcastMessageEvent
Diffstat (limited to 'src/main/java/org/bukkit')
-rw-r--r-- | src/main/java/org/bukkit/event/server/BroadcastMessageEvent.java | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/event/server/BroadcastMessageEvent.java b/src/main/java/org/bukkit/event/server/BroadcastMessageEvent.java new file mode 100644 index 00000000..4ddf7ecc --- /dev/null +++ b/src/main/java/org/bukkit/event/server/BroadcastMessageEvent.java @@ -0,0 +1,69 @@ +package org.bukkit.event.server; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; + +import java.util.Set; + +/** + * Event triggered for {@link org.bukkit.Server#broadcast(String, String)} + */ +public class BroadcastMessageEvent extends ServerEvent implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private String message; + private final Set<CommandSender> recipients; + private boolean cancelled = false; + + public BroadcastMessageEvent(String message, Set<CommandSender> recipients) { + this.message = message; + this.recipients = recipients; + } + + /** + * Get the message to broadcast + * + * @return Message to broadcast + */ + public String getMessage() { + return message; + } + + /** + * Set the message to broadcast + * + * @param message Message to broadcast + */ + public void setMessage(String message) { + this.message = message; + } + + /** + * Gets a set of recipients that this broadcast message will be displayed to. + * + * @return All CommandSenders who will see this chat message + */ + public Set<CommandSender> getRecipients() { + return recipients; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @Override + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } +} |