Java Code Examples for com.google.common.io.ByteArrayDataOutput#writeBoolean()

The following examples show how to use com.google.common.io.ByteArrayDataOutput#writeBoolean() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RedisPlayerManager.java    From BungeeTabListPlus with GNU General Public License v3.0 6 votes vote down vote up
private <T> void updateData(UUID uuid, DataKey<T> key, T value) {
    try {
        ByteArrayDataOutput data = ByteStreams.newDataOutput();
        DataStreamUtils.writeUUID(data, uuid);
        DataStreamUtils.writeDataKey(data, key);
        data.writeBoolean(value == null);
        if (value != null) {
            typeRegistry.getTypeAdapter(key.getType()).write(data, value);
        }
        RedisBungee.getApi().sendChannelMessage(CHANNEL_DATA_UPDATE, Base64.getEncoder().encodeToString(data.toByteArray()));
    } catch (RuntimeException ex) {
        BungeeTabListPlus.getInstance().getLogger().log(Level.WARNING, "RedisBungee Error", ex);
    } catch (Throwable th) {
        BungeeTabListPlus.getInstance().getLogger().log(Level.SEVERE, "Failed to send data", th);
    }
}
 
Example 2
Source File: PacketOutLoginPluginResponse.java    From FishingBot with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void write(ByteArrayDataOutput out, int protocolId) {
    writeVarInt(msgId, out);
    out.writeBoolean(hasResponse);
    if (hasResponse)
        out.write(data);
}
 
Example 3
Source File: PacketOutPosition.java    From FishingBot with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void write(ByteArrayDataOutput out, int protocolId) {
    out.writeDouble(getX());
    out.writeDouble(getY());
    out.writeDouble(getZ());
    out.writeBoolean(isOnGround());
}
 
Example 4
Source File: PacketOutPosLook.java    From FishingBot with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void write(ByteArrayDataOutput out, int protocolId) throws IOException {
    out.writeDouble(getX());
    out.writeDouble(getY());
    out.writeDouble(getZ());
    out.writeFloat(getYaw());
    out.writeFloat(getPitch());
    out.writeBoolean(isOnGround());
}
 
Example 5
Source File: PacketOutClientSettings.java    From FishingBot with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void write(ByteArrayDataOutput out, int protocolId) {
    switch (protocolId) {
        case ProtocolConstants.MINECRAFT_1_8: {
            writeString("en_7s", out);  //use speach "Pirate Speak", arrr
            out.writeByte(1);           //render-distance
            out.writeByte(0);           //chat enabled
            out.writeBoolean(true);     //support colors
            out.writeByte(128);         //skin bitmask
            break;
        }
        case ProtocolConstants.MINECRAFT_1_13_2:
        case ProtocolConstants.MINECRAFT_1_13_1:
        case ProtocolConstants.MINECRAFT_1_13:
        case ProtocolConstants.MINECRAFT_1_12_2:
        case ProtocolConstants.MINECRAFT_1_12_1:
        case ProtocolConstants.MINECRAFT_1_12:
        case ProtocolConstants.MINECRAFT_1_11_1:
        case ProtocolConstants.MINECRAFT_1_11:
        case ProtocolConstants.MINECRAFT_1_10:
        case ProtocolConstants.MINECRAFT_1_9_4:
        case ProtocolConstants.MINECRAFT_1_9_2:
        case ProtocolConstants.MINECRAFT_1_9_1:
        case ProtocolConstants.MINECRAFT_1_9:
        case ProtocolConstants.MINECRAFT_1_14:
        case ProtocolConstants.MINECRAFT_1_14_1:
        case ProtocolConstants.MINECRAFT_1_14_2:
        case ProtocolConstants.MINECRAFT_1_14_3:
        case ProtocolConstants.MINECRAFT_1_14_4:
        default: {
            writeString("lol_aa", out); //use speach "LOLCAT", lol
            out.writeByte(1);           //render-distance
            writeVarInt(0, out);        //chat enabled
            out.writeBoolean(true);     //support colors
            out.writeByte(128);         //skin bitmask
            writeVarInt(1, out);        //right = main hand
            break;
        }
    }
}
 
Example 6
Source File: ModListener.java    From RedProtect with GNU General Public License v3.0 5 votes vote down vote up
private static byte[] getSchematicaPayload() {
    final ByteArrayDataOutput output = ByteStreams.newDataOutput();
    output.writeByte(0);
    output.writeBoolean(false);
    output.writeBoolean(false);
    output.writeBoolean(false);
    return output.toByteArray();
}
 
Example 7
Source File: ModListener.java    From RedProtect with GNU General Public License v3.0 5 votes vote down vote up
public static byte[] createWDLPacket1() {
    ByteArrayDataOutput output = ByteStreams.newDataOutput();
    output.writeInt(1);

    output.writeBoolean(false);
    output.writeInt(0);
    output.writeBoolean(false);
    output.writeBoolean(false);
    output.writeBoolean(false);
    output.writeBoolean(false);
    return output.toByteArray();
}
 
Example 8
Source File: AccumuloRdfCountTool.java    From rya with Apache License 2.0 5 votes vote down vote up
@Override
        protected void map(final Key key, final Value value, final Context context) throws IOException, InterruptedException {
            try {
                final RyaStatement statement = ryaContext.deserializeTriple(tableLayout, new TripleRow(key.getRow().getBytes(), key.getColumnFamily().getBytes(), key.getColumnQualifier().getBytes()));
                //count each piece subject, pred, object

                final String subj = statement.getSubject().getData();
                final String pred = statement.getPredicate().getData();
//                byte[] objBytes = tripleFormat.getValueFormat().serialize(statement.getObject());
                final RyaIRI scontext = statement.getContext();
                final boolean includesContext = scontext != null;
                final String scontext_str = (includesContext) ? scontext.getData() : null;

                ByteArrayDataOutput output = ByteStreams.newDataOutput();
                output.writeUTF(subj);
                output.writeUTF(RdfCloudTripleStoreConstants.SUBJECT_CF);
                output.writeBoolean(includesContext);
                if (includesContext) {
                    output.writeUTF(scontext_str);
                }
                keyOut.set(output.toByteArray());
                context.write(keyOut, valOut);

                output = ByteStreams.newDataOutput();
                output.writeUTF(pred);
                output.writeUTF(RdfCloudTripleStoreConstants.PRED_CF);
                output.writeBoolean(includesContext);
                if (includesContext) {
                    output.writeUTF(scontext_str);
                }
                keyOut.set(output.toByteArray());
                context.write(keyOut, valOut);
            } catch (final TripleRowResolverException e) {
                throw new IOException(e);
            }
        }
 
Example 9
Source File: ForwardMessage.java    From ChangeSkin with MIT License 5 votes vote down vote up
@Override
public void writeTo(ByteArrayDataOutput out) {
    out.writeUTF(commandName);
    out.writeUTF(args);

    out.writeBoolean(isSource);
    out.writeBoolean(isOP);
}
 
Example 10
Source File: CheckPermMessage.java    From ChangeSkin with MIT License 5 votes vote down vote up
@Override
public void writeTo(ByteArrayDataOutput out) {
    out.writeInt(targetSkin.getRowId());
    out.writeUTF(targetSkin.getEncodedValue());
    out.writeUTF(targetSkin.getSignature());

    out.writeUTF(receiverUUD.toString());
    out.writeBoolean(skinPerm);
    out.writeBoolean(isOp);
}
 
Example 11
Source File: PermResultMessage.java    From ChangeSkin with MIT License 5 votes vote down vote up
@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());
}
 
Example 12
Source File: PacketOutLook.java    From FishingBot with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void write(ByteArrayDataOutput out, int protocolId) throws IOException {
    out.writeFloat(getYaw());
    out.writeFloat(getPitch());
    out.writeBoolean(isOnGround());
}
 
Example 13
Source File: PacketOutPlayer.java    From FishingBot with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void write(ByteArrayDataOutput out, int protocolId) throws IOException {
    out.writeBoolean(onGround);
}
 
Example 14
Source File: ModListener.java    From RedProtect with GNU General Public License v3.0 4 votes vote down vote up
public static byte[] createWDLPacket0() {
    ByteArrayDataOutput output = ByteStreams.newDataOutput();
    output.writeInt(0);
    output.writeBoolean(false);
    return output.toByteArray();
}
 
Example 15
Source File: ChangePremiumMessage.java    From FastLogin with MIT License 4 votes vote down vote up
@Override
public void writeTo(ByteArrayDataOutput output) {
    output.writeBoolean(willEnable);
    output.writeUTF(playerName);
    output.writeBoolean(isSourceInvoker);
}