@Override public void handlePayload(ChannelBuf data, RemoteConnection connection, Platform.Type side) { if (connection instanceof PlayerConnection) { Player player = ((PlayerConnection) connection).getPlayer(); LocalSession session = SpongeWorldEdit.inst().getSession(player); if (session.hasCUISupport()) { return; } session.handleCUIInitializationMessage( new String(data.readBytes(data.available()), StandardCharsets.UTF_8)); session.describeCUI(SpongeWorldEdit.inst().wrapPlayer(player)); } }
public static void init() { channel = Sponge.getChannelRegistrar().createRawChannel(SpongeWorldEdit.inst(), CUI_PLUGIN_CHANNEL); channel.addListener(Platform.Type.SERVER, new CUIChannelHandler()); }