com.google.common.io.ByteArrayDataOutput#writeUTF ( )源码实例Demo

下面列出了com.google.common.io.ByteArrayDataOutput#writeUTF ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: TAB   文件: PluginMessenger.java
public void onPluginMessageReceived(String channel, Player player, byte[] bytes){
	if (!channel.equalsIgnoreCase(Shared.CHANNEL_NAME)) return;
	ByteArrayDataInput in = ByteStreams.newDataInput(bytes);
	String subChannel = in.readUTF();
	if (subChannel.equalsIgnoreCase("Placeholder")){
		String placeholder = in.readUTF();
		long start = System.nanoTime();
		String output = PluginHooks.PlaceholderAPI_setPlaceholders(player, placeholder);
		long time = System.nanoTime() - start;

		ByteArrayDataOutput out = ByteStreams.newDataOutput();
		out.writeUTF("Placeholder");
		out.writeUTF(placeholder);
		out.writeUTF(output);
		out.writeLong(time);
		player.sendPluginMessage(plugin, Shared.CHANNEL_NAME, out.toByteArray());
	}
}
 
源代码2 项目: HubBasics   文件: LobbyCommand.java
@Override
public void execute(CommandSender commandSender, String[] strings) {
    ServerInfo serverInfo = this.getLobby();
    if (serverInfo != null && commandSender instanceof ProxiedPlayer) {
        ProxiedPlayer player = (ProxiedPlayer) commandSender;
        if (!player.getServer().getInfo().getName().equals(serverInfo.getName())) {
            player.connect(getLobby());
        } else {
            ByteArrayDataOutput out = ByteStreams.newDataOutput();
            out.writeUTF("HubBasics");
            out.writeUTF("Lobby");
            player.sendData("BungeeCord", out.toByteArray());
        }
    } else if (serverInfo == null) {
        commandSender.sendMessage(new TextComponent(Messages.get(commandSender, "LOBBY_NOT_DEFINED")));
    } else {
        commandSender.sendMessage(new TextComponent(Messages.get(commandSender, "COMMAND_PLAYER")));
    }
}
 
源代码3 项目: CloudNet   文件: MobSelector.java
@EventHandler
public void handleInventoryClick(InventoryClickEvent e) {
    if (!(e.getWhoClicked() instanceof Player)) {
        return;
    }

    if (inventories().contains(e.getInventory()) && e.getCurrentItem() != null && e.getSlot() == e.getRawSlot()) {
        e.setCancelled(true);
        if (ItemStackBuilder.getMaterialIgnoreVersion(mobConfig.getItemLayout().getItemName(),
                                                      mobConfig.getItemLayout().getItemId()) == e.getCurrentItem().getType()) {
            MobImpl mob = find(e.getInventory());
            if (mob.getServerPosition().containsKey(e.getSlot())) {
                if (CloudAPI.getInstance().getServerId().equalsIgnoreCase(mob.getServerPosition().get(e.getSlot()))) {
                    return;
                }
                ByteArrayDataOutput byteArrayDataOutput = ByteStreams.newDataOutput();
                byteArrayDataOutput.writeUTF("Connect");
                byteArrayDataOutput.writeUTF(mob.getServerPosition().get(e.getSlot()));
                ((Player) e.getWhoClicked()).sendPluginMessage(CloudServer.getInstance().getPlugin(),
                                                               "BungeeCord",
                                                               byteArrayDataOutput.toByteArray());
            }
        }
    }
}
 
源代码4 项目: SkyWarsReloaded   文件: SkyWarsReloaded.java
public void sendSWRMessage(Player player, String server, ArrayList<String> messages) {
	ByteArrayDataOutput out = ByteStreams.newDataOutput();
	out.writeUTF("Forward"); 
	out.writeUTF(server);
	out.writeUTF("SWRMessaging");

	ByteArrayOutputStream msgbytes = new ByteArrayOutputStream();
	DataOutputStream msgout = new DataOutputStream(msgbytes);
	try {
		for (String msg: messages) {
			msgout.writeUTF(msg);
		}
	} catch (IOException e) {
		e.printStackTrace();
	}

	out.writeShort(msgbytes.toByteArray().length);
	out.write(msgbytes.toByteArray());
	player.sendPluginMessage(this, "BungeeCord", out.toByteArray());
}
 
源代码5 项目: BedWars   文件: BungeeUtils.java
private static void internalMove(Player player) {
    String server = Main.getConfigurator().config.getString("bungee.server");
    ByteArrayDataOutput out = ByteStreams.newDataOutput();

    out.writeUTF("Connect");
    out.writeUTF(server);

    player.sendPluginMessage(Main.getInstance(), "BungeeCord", out.toByteArray());
}
 
源代码6 项目: LuckPerms   文件: PluginMessageMessenger.java
@Override
public void sendOutgoingMessage(@NonNull OutgoingMessage outgoingMessage) {
    ByteArrayDataOutput out = ByteStreams.newDataOutput();
    out.writeUTF(outgoingMessage.asEncodedString());

    byte[] message = out.toByteArray();
    dispatchMessage(message);
}
 
源代码7 项目: ChangeSkin   文件: PermResultMessage.java
@Override
public void writeTo(ByteArrayDataOutput out) {
    out.writeBoolean(allowed);

    out.writeInt(skin.getRowId());
    out.writeUTF(skin.getEncodedValue());
    out.writeUTF(skin.getSignature());
    out.writeUTF(receiverUUID.toString());
}
 
源代码8 项目: ChangeSkin   文件: ForwardMessage.java
@Override
public void writeTo(ByteArrayDataOutput out) {
    out.writeUTF(commandName);
    out.writeUTF(args);

    out.writeBoolean(isSource);
    out.writeBoolean(isOP);
}
 
源代码9 项目: RedisBungee   文件: RedisBungeeListener.java
private void serializeMultimap(Multimap<String, String> collection, boolean includeNames, ByteArrayDataOutput output) {
    output.writeInt(collection.keySet().size());
    for (Map.Entry<String, Collection<String>> entry : collection.asMap().entrySet()) {
        output.writeUTF(entry.getKey());
        if (includeNames) {
            serializeCollection(entry.getValue(), output);
        } else {
            output.writeInt(entry.getValue().size());
        }
    }
}
 
源代码10 项目: helper   文件: BungeeCordImpl.java
@Override
public void appendPayload(ByteArrayDataOutput out) {
    out.writeUTF(this.playerName);
    out.writeUTF(this.channelName);
    out.writeShort(this.data.length);
    out.write(this.data);
}
 
源代码11 项目: turbine   文件: ClassWriter.java
static void writeConstantPool(ConstantPool constantPool, ByteArrayDataOutput output) {
  output.writeShort(constantPool.nextEntry);
  for (ConstantPool.Entry e : constantPool.constants()) {
    output.writeByte(e.kind().tag());
    Value value = e.value();
    switch (e.kind()) {
      case CLASS_INFO:
      case STRING:
      case MODULE:
      case PACKAGE:
        output.writeShort(((IntValue) value).value());
        break;
      case INTEGER:
        output.writeInt(((IntValue) value).value());
        break;
      case DOUBLE:
        output.writeDouble(((DoubleValue) value).value());
        break;
      case FLOAT:
        output.writeFloat(((FloatValue) value).value());
        break;
      case LONG:
        output.writeLong(((LongValue) value).value());
        break;
      case UTF8:
        output.writeUTF(((StringValue) value).value());
        break;
    }
  }
}
 
源代码12 项目: RedisBungee   文件: RedisBungeeListener.java
private void serializeMultiset(Multiset<String> collection, ByteArrayDataOutput output) {
    output.writeInt(collection.elementSet().size());
    for (Multiset.Entry<String> entry : collection.entrySet()) {
        output.writeUTF(entry.getElement());
        output.writeInt(entry.getCount());
    }
}
 
源代码13 项目: HubBasics   文件: HLocation.java
public void teleport(Player player) {
    if (this.server != null) {
        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        out.writeUTF("Connect");
        out.writeUTF(this.server);
        player.sendPluginMessage(HubBasics.getInstance(), "BungeeCord", out.toByteArray());
    } else {
        player.teleport(this.toBukkitLocation());
    }
}
 
源代码14 项目: SkyWarsReloaded   文件: SkyWarsReloaded.java
public void sendBungeeMsg(Player player, String subchannel, String message) {
	ByteArrayDataOutput out = ByteStreams.newDataOutput();
	out.writeUTF(subchannel);
	if (!message.equalsIgnoreCase("none")) {
		out.writeUTF(message);
	}
	player.sendPluginMessage(this, "BungeeCord", out.toByteArray());
}
 
源代码15 项目: AuthMeReloaded   文件: BungeeSender.java
private void sendForwardedBungeecordMessage(final String subChannel, final String... data) {
    final ByteArrayDataOutput out = ByteStreams.newDataOutput();
    out.writeUTF("Forward");
    out.writeUTF("ONLINE");
    out.writeUTF(subChannel);
    final ByteArrayDataOutput dataOut = ByteStreams.newDataOutput();
    for (final String element : data) {
        dataOut.writeUTF(element);
    }
    final byte[] dataBytes = dataOut.toByteArray();
    out.writeShort(dataBytes.length);
    out.write(dataBytes);
    bukkitService.sendBungeeMessage(out.toByteArray());
}
 
源代码16 项目: ExtraCells1   文件: PacketBusFluidImport.java
@Override
public void write(ByteArrayDataOutput out)
{
	out.writeInt(world.provider.dimensionId);
	out.writeInt(x);
	out.writeInt(y);
	out.writeInt(z);
	out.writeUTF(playername);
	out.writeInt(action);
}
 
源代码17 项目: helper   文件: BungeeCordImpl.java
@Override
public void appendPayload(ByteArrayDataOutput out) {
    out.writeUTF(this.serverName);
}
 
源代码18 项目: helper   文件: BungeeCordImpl.java
@Override
public void appendPayload(ByteArrayDataOutput out) {
    out.writeUTF(this.serverName);
}
 
源代码19 项目: helper   文件: BungeeCordImpl.java
@Override
public void appendPayload(ByteArrayDataOutput out) {
    out.writeUTF(this.playerName);
    out.writeUTF(this.message);
}
 
源代码20 项目: ChangeSkin   文件: SkinUpdateMessage.java
@Override
public void writeTo(ByteArrayDataOutput out) {
    out.writeUTF(playerName);
}