org.spongepowered.api.network.ChannelBuf Java Examples

The following examples show how to use org.spongepowered.api.network.ChannelBuf. 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: SpongePluginMessagingForwardingSink.java    From NuVotifier with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void handlePayload(ChannelBuf channelBuf, RemoteConnection remoteConnection, Platform.Type type) {
    byte[] msgDirBuf = channelBuf.readBytes(channelBuf.available());
    try {
        this.handlePluginMessage(msgDirBuf);
    } catch (Exception e) {
        p.getLogger().error("There was an unknown error when processing a forwarded vote.", e);
    }
}
 
Example #2
Source File: CheckPermissionListener.java    From ChangeSkin with MIT License 5 votes vote down vote up
@Override
public void handlePayload(ChannelBuf data, RemoteConnection connection, Type side) {

    ByteArrayDataInput dataInput = ByteStreams.newDataInput(data.array());
    CheckPermMessage checkMessage = new CheckPermMessage();
    checkMessage.readFrom(dataInput);

    CheckPermMessage message = new CheckPermMessage();
    message.readFrom(dataInput);

    checkPermissions((Player) connection, message);
}
 
Example #3
Source File: UpdateSkinListener.java    From ChangeSkin with MIT License 5 votes vote down vote up
@Override
public void handlePayload(ChannelBuf data, RemoteConnection connection, Type side) {
    ByteArrayDataInput dataInput = ByteStreams.newDataInput(data.array());
    SkinUpdateMessage updateMessage = new SkinUpdateMessage();
    updateMessage.readFrom(dataInput);

    String playerName = updateMessage.getPlayerName();
    Optional<Player> receiver = Sponge.getServer().getPlayer(playerName);
    if (receiver.isPresent()) {
        Runnable skinUpdater = new SkinApplier(plugin, (CommandSource) connection, receiver.get(), null, false);
        Task.builder().execute(skinUpdater).submit(plugin);
    }
}
 
Example #4
Source File: PluginMessageMessenger.java    From LuckPerms with MIT License 4 votes vote down vote up
@Override
public void handlePayload(@NonNull ChannelBuf buf, @NonNull RemoteConnection connection, Platform.@NonNull Type type) {
    String msg = buf.readUTF();
    this.consumer.consumeIncomingMessageAsString(msg);
}
 
Example #5
Source File: ChannelBufInputStream.java    From BungeeTabListPlus with GNU General Public License v3.0 4 votes vote down vote up
public ChannelBufInputStream(ChannelBuf channelBuf) {
    this.channelBuf = channelBuf;
}