Search in sources :

Example 1 with CommandSource

use of com.earth2me.essentials.CommandSource in project Essentials by drtshock.

the class Commandbroadcastworld method sendToWorld.

private void sendToWorld(World world, String message) {
    IText broadcast = new SimpleTextInput(message);
    final Collection<Player> players = ess.getOnlinePlayers();
    for (Player player : players) {
        if (player.getWorld().equals(world)) {
            final User user = ess.getUser(player);
            broadcast = new KeywordReplacer(broadcast, new CommandSource(player), ess, false);
            for (String messageText : broadcast.getLines()) {
                user.sendMessage(messageText);
            }
        }
    }
}
Also used : KeywordReplacer(com.earth2me.essentials.textreader.KeywordReplacer) Player(org.bukkit.entity.Player) User(com.earth2me.essentials.User) SimpleTextInput(com.earth2me.essentials.textreader.SimpleTextInput) IText(com.earth2me.essentials.textreader.IText) CommandSource(com.earth2me.essentials.CommandSource)

Aggregations

CommandSource (com.earth2me.essentials.CommandSource)1 User (com.earth2me.essentials.User)1 IText (com.earth2me.essentials.textreader.IText)1 KeywordReplacer (com.earth2me.essentials.textreader.KeywordReplacer)1 SimpleTextInput (com.earth2me.essentials.textreader.SimpleTextInput)1 Player (org.bukkit.entity.Player)1