当前位置: 首页>>代码示例>>Java>>正文


Java ChannelBuf类代码示例

本文整理汇总了Java中org.spongepowered.api.network.ChannelBuf的典型用法代码示例。如果您正苦于以下问题:Java ChannelBuf类的具体用法?Java ChannelBuf怎么用?Java ChannelBuf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ChannelBuf类属于org.spongepowered.api.network包,在下文中一共展示了ChannelBuf类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handlePayload

import org.spongepowered.api.network.ChannelBuf; //导入依赖的package包/类
@Override
public void handlePayload(ChannelBuf data, RemoteConnection connection, Platform.Type side) {
    for (Map.Entry<Predicate<ChannelBuf>, Consumer<ChannelBuf>> entry : map.entrySet()) {
       if (entry.getKey().test(data)) {
           entry.getValue().accept(data);
           map.remove(entry.getKey());
           return;
       }
    }
}
 
开发者ID:pie-flavor,项目名称:SpongyCord,代码行数:11,代码来源:SpongyCord.java

示例2: handlePayload

import org.spongepowered.api.network.ChannelBuf; //导入依赖的package包/类
@Override
public void handlePayload(ChannelBuf channelBuf, RemoteConnection remoteConnection, Platform.Type type) {
    try {
        String message = new String(channelBuf.array(), StandardCharsets.UTF_8);
        JSONObject jsonObject = new JSONObject(message);
        Vote v = new Vote(jsonObject);
        listener.onForward(v);
    } catch (Exception e) {
        p.getLogger().error("There was an unknown error when processing a forwarded vote.", e);
    }
}
 
开发者ID:NuVotifier,项目名称:NuVotifier,代码行数:12,代码来源:SpongePluginMessagingForwardingSink.java

示例3: addListener

import org.spongepowered.api.network.ChannelBuf; //导入依赖的package包/类
private static void addListener(Predicate<ChannelBuf> predicate, Consumer<ChannelBuf> consumer) {
    listener.map.put(predicate, consumer);
}
 
开发者ID:pie-flavor,项目名称:SpongyCord,代码行数:4,代码来源:SpongyCord.java

示例4: handlePayload

import org.spongepowered.api.network.ChannelBuf; //导入依赖的package包/类
@Override
public void handlePayload(@Nonnull ChannelBuf buf, @Nonnull RemoteConnection connection, @Nonnull Platform.Type type) {
    String msg = buf.readUTF();
    onMessage(msg, null);
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:6,代码来源:BungeeMessagingService.java

示例5: readFrom

import org.spongepowered.api.network.ChannelBuf; //导入依赖的package包/类
@Override
public void readFrom(ChannelBuf buf) {
	buf.readUTF();
}
 
开发者ID:xfl03,项目名称:CustomSkinServer,代码行数:5,代码来源:SpongePlugin.java

示例6: writeTo

import org.spongepowered.api.network.ChannelBuf; //导入依赖的package包/类
@Override
public void writeTo(ChannelBuf buf) {
	buf.writeUTF(text);
}
 
开发者ID:xfl03,项目名称:CustomSkinServer,代码行数:5,代码来源:SpongePlugin.java

示例7: sendTo

import org.spongepowered.api.network.ChannelBuf; //导入依赖的package包/类
@Override
public void sendTo(Player player, Consumer<ChannelBuf> payload) {
    checkState(this.bound);
    getRegistrar().sendPayload(player, getName(), payload::accept);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:6,代码来源:LanternRawDataChannel.java

示例8: sendToServer

import org.spongepowered.api.network.ChannelBuf; //导入依赖的package包/类
@Override
public void sendToServer(Consumer<ChannelBuf> payload) {
    checkState(this.bound);
    checkNotNull(payload, "payload");
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:6,代码来源:LanternRawDataChannel.java

示例9: sendToAll

import org.spongepowered.api.network.ChannelBuf; //导入依赖的package包/类
@Override
public void sendToAll(Consumer<ChannelBuf> payload) {
    checkState(this.bound);
    getRegistrar().sendPayloadToAll(getName(), payload::accept);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:6,代码来源:LanternRawDataChannel.java

示例10: ChannelBufInputStream

import org.spongepowered.api.network.ChannelBuf; //导入依赖的package包/类
public ChannelBufInputStream(ChannelBuf channelBuf) {
    this.channelBuf = channelBuf;
}
 
开发者ID:CodeCrafter47,项目名称:BungeeTabListPlus,代码行数:4,代码来源:ChannelBufInputStream.java


注:本文中的org.spongepowered.api.network.ChannelBuf类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。