@Override public void handle(Chat chat) throws Exception { int maxLength = ( con.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_11 ) ? 256 : 100; Preconditions.checkArgument( chat.getMessage().length() <= maxLength, "Chat message too long" ); // Mojang limit, check on updates ChatEvent chatEvent = new ChatEvent( con, con.getServer(), chat.getMessage() ); if ( !bungee.getPluginManager().callEvent( chatEvent ).isCancelled() ) { chat.setMessage( chatEvent.getMessage() ); if ( !chatEvent.isCommand() || !bungee.getPluginManager().dispatchCommand( con, chat.getMessage().substring( 1 ) ) ) { con.getServer().unsafe().sendPacket( chat ); } } throw CancelSendSignal.INSTANCE; }
@Override public void chat(String message) { Preconditions.checkState( server != null, "Not connected to server" ); server.getCh().write( new Chat( message ) ); }
@Override public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) { message = readString( buf ); if ( direction == ProtocolConstants.Direction.TO_CLIENT ) { position = buf.readByte(); } }
Chat chat = values.get(position); String t = chat.getRecieverID(); tv.setText(chat.getMessage()); if (chat.getSenderID().equals(prefs.getString("Member_id", ""))) { root.setBackgroundColor(Color.parseColor("#07000000")); tv.setTextColor(Color.parseColor("#636363"));
public void onDataChange(DataSnapshot dataSnapshot) { for (DataSnapshot chatSnapshot: dataSnapshot.getChildren()) { Chat chat = chatSnapshot.getValue(Chat.class); String message = chat.getMessage(); String sender = chat.getSender(); } }
protected void populateView(View view, Chat chat) { String author = chat.getAuthor(); TextView authorText = (TextView) view.findViewById(R.id.author); TextView messageText = (TextView) view.findViewById(R.id.message); authorText.setLayoutParams(params); messageText.setText(chat.getMessage()); messageText.setBackground(view.getResources().getDrawable(R.drawable.bg_msg_you)); messageText.setLayoutParams(params); authorText.setGravity(Gravity.LEFT | Gravity.START); messageText.setText(chat.getMessage()); messageText.setGravity(Gravity.LEFT); messageText.setBackground(view.getResources().getDrawable(R.drawable.bg_msg_from));
@Override public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) { writeString( message, buf ); if ( direction == ProtocolConstants.Direction.TO_CLIENT ) { buf.writeByte( position ); } }
query.addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String s) { Chat chat = dataSnapshot.getValue(Chat.class); String message = chat.getMessage(); String sender = chat.getSender(); } // other overridden messages have been removed for brevity })
@Override public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) { writeString( message, buf ); if ( direction == ProtocolConstants.Direction.TO_CLIENT && protocolVersion >= ProtocolConstants.MINECRAFT_1_8 ) { buf.writeByte( position ); } }
@Override public void handle(Chat chat) throws Exception { Preconditions.checkArgument( chat.getMessage().length() <= 100, "Chat message too long" ); // Mojang limit, check on updates Preconditions.checkArgument(!StringUtil.isBlank(chat.getMessage()), "Chat message is empty"); ServerConnection server = con.getServer(); // if we're still connecting just ignore this packet if ( server == null ) { throw CancelSendSignal.INSTANCE; } ChatEvent chatEvent = new ChatEvent( con, server, chat.getMessage() ); if ( !bungee.getPluginManager().callEvent( chatEvent ).isCancelled() ) { chat.setMessage( chatEvent.getMessage() ); if ( !chatEvent.isCommand() || !bungee.getPluginManager().dispatchCommand( con, chat.getMessage().substring( 1 ) ) ) { server.unsafe().sendPacket( chat ); } } throw CancelSendSignal.INSTANCE; }
private void sendMessage(ChatMessageType position, String message) { unsafe().sendPacket( new Chat( message, (byte) position.ordinal() ) ); }
@Override public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) { message = readString( buf ); if ( direction == ProtocolConstants.Direction.TO_CLIENT && protocolVersion >= ProtocolConstants.MINECRAFT_1_8 ) { position = buf.readByte(); } }
@Override public void broadcast(BaseComponent message) { getConsole().sendMessage( message.toLegacyText() ); broadcast( new Chat( ComponentSerializer.toString( message ) ) ); }
@Override public void broadcast(BaseComponent... message) { getConsole().sendMessage( BaseComponent.toLegacyText( message ) ); broadcast( new Chat( ComponentSerializer.toString( message ) ) ); }
@Override public void chat(String message) { Preconditions.checkState( server != null, "Not connected to server" ); server.getCh().write( new Chat( message ) ); }
private void sendMessage(ChatMessageType position, String message) { unsafe().sendPacket( new Chat( message, (byte) position.ordinal() ) ); }
@Override public void broadcast(BaseComponent... message) { getConsole().sendMessage( BaseComponent.toLegacyText( message ) ); broadcast( new Chat( ComponentSerializer.toString( message ) ) ); }
@Override public void broadcast(BaseComponent message) { getConsole().sendMessage( message.toLegacyText() ); broadcast( new Chat( ComponentSerializer.toString( message ) ) ); }