Package simpleserver.message

Examples of simpleserver.message.MessagePacket


        write(in.readInt());

        break;
      case 0x03: // Chat Message
        String message = readUTF16();
        MessagePacket messagePacket = new Message().decodeMessage(message);

        if (messagePacket == null) {
          // we are raw text, handle as such

          if (isServerTunnel && server.config.properties.getBoolean("useMsgFormats")) {
            if (server.config.properties.getBoolean("forwardChat") && server.getMessager().wasForwarded(message)) {
              break;
            }

            Matcher colorMatcher = COLOR_PATTERN.matcher(message);
            String cleanMessage = colorMatcher.replaceAll("");

            Matcher messageMatcher = MESSAGE_PATTERN.matcher(cleanMessage);
            if (messageMatcher.find()) {

            } else if (cleanMessage.matches(CONSOLE_CHAT_PATTERN) && !server.config.properties.getBoolean("chatConsoleToOps")) {
              break;
            }

            if (server.config.properties.getBoolean("msgWrap")) {
              sendMessage(message);
            } else {
              if (message.length() > MAXIMUM_MESSAGE_SIZE) {
                //message = message.substring(0, MAXIMUM_MESSAGE_SIZE);
              }
              write(packetId);
              write(message);
            }
          } else if (!isServerTunnel) {

            if (player.isMuted() && !message.startsWith("/")
                    && !message.startsWith("!")) {
              player.addTMessage(Color.RED, "You are muted! You may not send messages to all players.");
              break;
            }

            if (message.charAt(0) == commandPrefix) {
              message = player.parseCommand(message, false);
              if (message == null) {
                break;
              }
              write(packetId);
              write(message);
              return;
            }

            player.sendMessage(message);
          }
        } else {
          // we have a json object
          if (messagePacket.isJoinedPacket()) {
            String username = messagePacket.getJoinedUsername();

            if (isServerTunnel) {
              if (server.bots.ninja(username)) {
                break;
              }
View Full Code Here

TOP

Related Classes of simpleserver.message.MessagePacket

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.