Search in sources :

Example 36 with ByteArrayDataOutput

use of com.google.common.io.ByteArrayDataOutput in project SpaciousLib by anhcraft.

the class BungeeManager method getPlayerAmount.

/**
 * Gets the player amount of another server
 * @param server the server
 * @param response BungeePlayerAmountResponse object
 */
public static void getPlayerAmount(String server, BungeePlayerAmountResponse response) {
    if (Bukkit.getServer().getOnlinePlayers().size() == 0) {
        return;
    }
    ByteArrayDataOutput out = ByteStreams.newDataOutput();
    out.writeUTF("PlayerCount");
    out.writeUTF(server);
    Bukkit.getServer().getOnlinePlayers().iterator().next().sendPluginMessage(SpaciousLib.instance, CHANNEL, out.toByteArray());
    queue.add(response);
}
Also used : ByteArrayDataOutput(com.google.common.io.ByteArrayDataOutput)

Example 37 with ByteArrayDataOutput

use of com.google.common.io.ByteArrayDataOutput in project SpaciousLib by anhcraft.

the class BungeeManager method kickPlayer.

/**
 * Sends a kick request
 * @param player the player who you want to kick
 * @param reason the reason
 */
public static void kickPlayer(String player, String reason) {
    if (Bukkit.getServer().getOnlinePlayers().size() == 0) {
        return;
    }
    ByteArrayDataOutput out = ByteStreams.newDataOutput();
    out.writeUTF("KickPlayer");
    out.writeUTF(player);
    out.writeUTF(Strings.color(reason));
    Bukkit.getServer().getOnlinePlayers().iterator().next().sendPluginMessage(SpaciousLib.instance, CHANNEL, out.toByteArray());
}
Also used : ByteArrayDataOutput(com.google.common.io.ByteArrayDataOutput)

Example 38 with ByteArrayDataOutput

use of com.google.common.io.ByteArrayDataOutput in project SpaciousLib by anhcraft.

the class BungeeManager method sendMessage.

/**
 * Sends a message to a specific player who is in another server
 * @param player the name of that player
 * @param message the message
 */
public static void sendMessage(String player, String message) {
    if (Bukkit.getServer().getOnlinePlayers().size() == 0) {
        return;
    }
    ByteArrayDataOutput out = ByteStreams.newDataOutput();
    out.writeUTF("Message");
    out.writeUTF(player);
    out.writeUTF(Strings.color(message));
    Bukkit.getServer().getOnlinePlayers().iterator().next().sendPluginMessage(SpaciousLib.instance, CHANNEL, out.toByteArray());
}
Also used : ByteArrayDataOutput(com.google.common.io.ByteArrayDataOutput)

Example 39 with ByteArrayDataOutput

use of com.google.common.io.ByteArrayDataOutput in project Network-depr by Mas281.

the class UtilServer method writeBungee.

/**
 * Forwards a message to BungeeCord through the plugin messaging channel
 *
 * @param args The data to send
 * @return Whether the data was sent
 */
public static boolean writeBungee(String... args) {
    assert args.length > 0 : "Args length must be at least 1";
    Player player = Iterables.getFirst(UtilServer.getPlayers(), null);
    if (player == null) {
        return false;
    }
    ByteArrayDataOutput out = ByteStreams.newDataOutput();
    for (String arg : args) {
        out.writeUTF(arg);
    }
    player.sendPluginMessage(PLUGIN, "BungeeCord", out.toByteArray());
    return true;
}
Also used : Player(org.bukkit.entity.Player) ByteArrayDataOutput(com.google.common.io.ByteArrayDataOutput)

Aggregations

ByteArrayDataOutput (com.google.common.io.ByteArrayDataOutput)39 IOException (java.io.IOException)3 ConnectorTableHandle (com.facebook.presto.spi.ConnectorTableHandle)2 Test (org.testng.annotations.Test)2 Split (co.cask.cdap.api.data.batch.Split)1 RaptorColumnHandle (com.facebook.presto.raptor.RaptorColumnHandle)1 RaptorColumnIdentity (com.facebook.presto.raptor.RaptorColumnIdentity)1 RaptorTableIdentity (com.facebook.presto.raptor.RaptorTableIdentity)1 ColumnHandle (com.facebook.presto.spi.ColumnHandle)1 ColumnIdentity (com.facebook.presto.spi.ColumnIdentity)1 TableIdentity (com.facebook.presto.spi.TableIdentity)1 JsonValue (com.fasterxml.jackson.annotation.JsonValue)1 Supplier (com.google.common.base.Supplier)1 ByteString (com.google.protobuf.ByteString)1 ServiceException (com.google.protobuf.ServiceException)1 InputRow (io.druid.data.input.InputRow)1 MapBasedInputRow (io.druid.data.input.MapBasedInputRow)1 ParseException (io.druid.java.util.common.parsers.ParseException)1 Aggregator (io.druid.query.aggregation.Aggregator)1 AggregatorFactory (io.druid.query.aggregation.AggregatorFactory)1