List of usage examples for com.google.common.io ByteArrayDataOutput writeUTF
@Override
void writeUTF(String s);
From source file:com.minestein.novauniverse.util.bungee.ServerConnection.java
public static void connect(Player playerToSend, String serverName) { ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("Connect"); out.writeUTF(serverName);//w ww .j a v a 2 s . com playerToSend.sendPluginMessage(Main.plugin, "BungeeCord", out.toByteArray()); }
From source file:com.minestein.novacore.util.general.ServerConnection.java
/** * Connects the toSend player to the server via BungeeCord. * * @param toSend The player to send.//from w w w .j ava 2 s. c o m * @param server The server's display name to send the player to. */ public static void connect(Player toSend, String server) { ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("Connect"); out.writeUTF(server); toSend.sendPluginMessage(Core.plugin, "BungeeCord", out.toByteArray()); }
From source file:tk.playerforcehd.networklib.bungee.packets.pluginmessage.MSG_sendCommand.java
/** * Let's a player execute a command on his subserver * * @param player the player who execute it * @param command the command which get executed *///from w w w . ja v a2 s. c o m public static void sendCommandToPlayer(ProxiedPlayer player, String command) { ByteArrayDataOutput stream = ByteStreams.newDataOutput(); stream.writeUTF("executeCommand"); stream.writeUTF(player.getName() + ":" + command); player.sendData("BungeeCord", stream.toByteArray()); }
From source file:tk.playerforcehd.networklib.bungee.packets.pluginmessage.MSG_sendCommand.java
/** * Let's a server execute a command in his console * * @param server the server who executes it * @param command the command which get executed *///from w w w .j av a 2s . com public static void sendCommandToServer(ServerInfo server, String command) { ByteArrayDataOutput stream = ByteStreams.newDataOutput(); stream.writeUTF("executeCommand"); stream.writeUTF("Server:" + command); server.sendData("BungeeCord", stream.toByteArray()); }
From source file:info.minestein.compassnav.util.ServerSender.java
public static void sendToServer(Player player, String server) { ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("Connect"); out.writeUTF(server);//from w ww. ja v a2 s. co m player.sendPluginMessage(Core.plugin, "BungeeCord", out.toByteArray()); }
From source file:com.spleefleague.core.utils.PlayerUtil.java
public static void sendToServer(Player player, String server) { Bukkit.getScheduler().runTaskAsynchronously(SpleefLeague.getInstance(), () -> { CorePlugin.syncSaveAll(player);// www.j a v a2 s .c om ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("Connect"); out.writeUTF(server); player.sendPluginMessage(SpleefLeague.getInstance(), "BungeeCord", out.toByteArray()); }); }
From source file:net.caseif.ttt.util.helper.platform.BungeeHelper.java
private static void sendPluginMessage(String subchannel, String content, Player player) { assert player != null; ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF(subchannel); if (content != null) { out.writeUTF(content);/*from w ww . j a va 2 s. c om*/ } player.sendPluginMessage(TTTCore.getPlugin(), "BungeeCord", out.toByteArray()); }
From source file:de.bl4ckskull666.mu1ti1ingu41.commands.MainField.java
public static void useCommand(CommandSender s, String[] a) { if (a.length > 0) { if (a[0].equalsIgnoreCase("reload")) { if (!s.hasPermission("mu1ti1ing41.admin")) { Language.sendMessage(Mu1ti1ingu41.getPlugin(), s, "command.reload.no-permission", "You dont have permission to use this command."); return; }// www . ja v a 2 s . c o m Language.loadLanguage(); ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("Mu1ti1ingu41"); out.writeUTF("reload"); for (Map.Entry<String, ServerInfo> me : ProxyServer.getInstance().getServers().entrySet()) me.getValue().sendData("BungeeCord", out.toByteArray(), true); Language.sendMessage(Mu1ti1ingu41.getPlugin(), s, "command.reload.successful", "Language files has been reloaded."); return; } else if (a[0].equalsIgnoreCase("test")) { } } if (!(s instanceof ProxiedPlayer)) { s.sendMessage(Mu1ti1ingu41.castMessage("This command can only run by a player.")); return; } ProxiedPlayer p = (ProxiedPlayer) s; if (a.length < 1) { Language.sendMessage(Mu1ti1ingu41.getPlugin(), p, "command.need-language", "Please select one of the following language :"); String ava = ""; for (String str : Mu1ti1ingu41.getPlugin().getConfig().getConfigurationSection("short-language") .getKeys(false)) ava += (ava.isEmpty() ? "e" : "9, e") + str; p.sendMessage(Mu1ti1ingu41.castMessage(ava)); return; } if (Mu1ti1ingu41.getPlugin().getConfig().getString("short-language." + a[0].toLowerCase(), "").isEmpty()) { Language.sendMessage(Mu1ti1ingu41.getPlugin(), p, "command.unknown-language", "Can't find the wished language."); return; } UUIDLanguages._players.put(p.getUniqueId(), Mu1ti1ingu41.getPlugin().getConfig().getString("short-language." + a[0].toLowerCase())); ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("Mu1ti1ingu41"); out.writeUTF("player"); out.writeUTF(p.getUniqueId().toString()); out.writeUTF(Mu1ti1ingu41.getPlugin().getConfig().getString("short-language." + a[0].toLowerCase())); for (Map.Entry<String, ServerInfo> me : ProxyServer.getInstance().getServers().entrySet()) { me.getValue().sendData("BungeeCord", out.toByteArray(), true); } Language.sendMessage(Mu1ti1ingu41.getPlugin(), p, "command.changed-language", "The Wished Language has been changed."); }
From source file:org.tyrannyofheaven.bukkit.util.ToHMessageUtils.java
/** * Sends a plugin message to BungeeCord, signing it with zPermissions as * the channel and any information to write to it. * /*from w ww . j a v a 2s. com*/ * @param plugin plugin to send with * @param channel sub channel to send to * @param objects objects to write */ public static void sendPluginMessage(Plugin plugin, String channel, String... objects) { ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("zPermissions"); out.writeUTF(channel); try (ByteArrayOutputStream msgbytes = new ByteArrayOutputStream(); DataOutputStream msgout = new DataOutputStream(msgbytes)) { for (String s : objects) { msgout.writeUTF(s); } byte[] byteArray = msgbytes.toByteArray(); out.writeShort(byteArray.length); out.write(byteArray); for (Player player : Bukkit.getOnlinePlayers()) { player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray()); return; } } catch (IOException e) { throw new RuntimeException(e); } }
From source file:com.funergy.bedwars.gamemanager.InGameHandler.java
public static void connect(Player p) { ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("Connect"); out.writeUTF("LO01"); p.sendPluginMessage(Bedwars.getPlugin(Bedwars.class), "BungeeCord", out.toByteArray()); }