wyvern.lib
Interface Broadcaster

All Known Subinterfaces:
Armor, Attackable, Bag, Commandable, CommandEvent, Damageable, GameObject, HitNotify, Inventory, Monster, Openable, Player, Weapon
All Known Implementing Classes:
AbstractCommandable, ArmorImpl, BasicBag, Chest, DiggableWall, Door, DynamicObject, EventImpl, Generator, MapObject, MonsterImpl, MonsterInventory, PlayerImpl, Trenchcoat, WeaponImpl

public interface Broadcaster

Interface shared by objects that can broadcast a message to everyone in the local area. All GameObjects can do this, and CommandEvents can as well. It's useful for issuing general messages to players, but also for wiz debugging.

Version:
1.0, Nov 16, 2003
Author:
Steve Yegge

Method Summary
 java.util.List broadcast(java.lang.String msg)
          Broadcasts a message to every player in sight of this object, not including the player who initiated it (if this is a player).
 java.util.List broadcast(java.lang.String msg, byte style)
          Broadcasts a message to every player in earshot of this object, not including the player who initiated it (if this is a player).
 java.util.List broadcast(java.lang.String msg, Predicate p)
          Sends the specified message to players in earshot of this object, not including the player who initiated it (if this is a player).
 java.util.List broadcast(java.lang.String msg, Predicate p, byte style)
          Sends the specified message to player in sight of this object, not including the player who initiated it (if this is a player).
 java.util.List broadcast(java.lang.String msg, Predicate p, byte style, int radius)
          Sends the specified message to everyone in sight.
 

Method Detail

broadcast

public java.util.List broadcast(java.lang.String msg)
Broadcasts a message to every player in sight of this object, not including the player who initiated it (if this is a player).

Parameters:
msg - the message to broadcast.
Returns:
a list of Players who heard the message. Monsters can heard the message if they have the "hears-broadcasts" property, but they won't be added to the return list.

broadcast

public java.util.List broadcast(java.lang.String msg,
                                Predicate p)
Sends the specified message to players in earshot of this object, not including the player who initiated it (if this is a player).

Parameters:
msg - the message to send
p - an optional predicate used to filter the recipients. If p is false for a potential recipient, the message is not delivered to that recipient.
Returns:
a list of Players who heard the message. Monsters can heard the message if they have the "hears-broadcasts" property, but they won't be added to the return list.

broadcast

public java.util.List broadcast(java.lang.String msg,
                                byte style)
Broadcasts a message to every player in earshot of this object, not including the player who initiated it (if this is a player).

Parameters:
msg - the message to broadcast.
style - the RPCConstants.TextStyle to use
Returns:
a list of Players who heard the message. Monsters can heard the message if they have the "hears-broadcasts" property, but they won't be added to the return list.

broadcast

public java.util.List broadcast(java.lang.String msg,
                                Predicate p,
                                byte style)
Sends the specified message to player in sight of this object, not including the player who initiated it (if this is a player).

Parameters:
msg - the message to send
p - an optional predicate used to filter the recipients. If p is false for a potential recipient, the message is not delivered to that recipient.
style - the RPCConstants.TextStyle to use
Returns:
a list of Players who heard the message. Monsters can heard the message if they have the "hears-broadcasts" property, but they won't be added to the return list.

broadcast

public java.util.List broadcast(java.lang.String msg,
                                Predicate p,
                                byte style,
                                int radius)
Sends the specified message to everyone in sight.

Parameters:
msg - the message to send
p - an optional predicate used to filter the recipients. If p is false for a potential recipient, the message is not delivered to that recipient.
style - the RPCConstants.TextStyle to use
radius - the radius around the player to broadcast to. Includes the player's location, so a radius of 7 would cover their whole view.
Returns:
a list of Players who heard the message. Monsters can heard the message if they have the "hears-broadcasts" property, but they won't be added to the return list.