Package org.spout.vanilla.protocol.msg.player

Examples of org.spout.vanilla.protocol.msg.player.PlayerChatMessage


  public Message getCommandMessage(String command, CommandArguments args) {
    try {
      if (command.equals("kick")) {
        return getKickMessage(args.popRemainingStrings("message"));
      } else if (command.equals("say")) {
        return new PlayerChatMessage(args.popRemainingStrings("message") + "\u00a7r"); // The reset text is a workaround for a change in 1.3 -- Remove if fixed
      } else {
        return new PlayerChatMessage('/' + command + ' ' + args.popRemainingStrings("message"));
      }
    } catch (ArgumentParseException ex) {
      return new PlayerChatMessage(ChatStyle.RED + ex.getMessage());
    }
  }
View Full Code Here


  @Override
  public PlayerChatMessage decodeFromClient(ByteBuf buffer) throws IOException {
    // As a server we read messages from the client as plain text
    String message = VanillaByteBufUtils.readString(buffer);
    return new PlayerChatMessage(message);
  }
View Full Code Here

  @Override
  public PlayerChatMessage decodeFromServer(ByteBuf buffer) throws IOException {
    // As a client we read messages from the server using the JSON parser
    String message = VanillaByteBufUtils.readString(buffer);

    return new PlayerChatMessage(parser.parse(message).getAsJsonObject().get("text").getAsString());
  }
View Full Code Here

TOP

Related Classes of org.spout.vanilla.protocol.msg.player.PlayerChatMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.