Package net.lightstone.msg

Examples of net.lightstone.msg.Message


  @SuppressWarnings("unchecked")
  @Override
  protected Object encode(ChannelHandlerContext ctx, Channel c, Object msg) throws Exception {
    if (msg instanceof Message) {
      Message message = (Message) msg;

      Class<? extends Message> clazz = message.getClass();
      MessageCodec<Message> codec = (MessageCodec<Message>) CodecLookupService.find(clazz);
      if (codec == null) {
        throw new IOException("Unknown message type: " + clazz + ".");
      }
View Full Code Here


    if (pendingRemoval)
      return false;

    timeoutCounter++;

    Message message;
    while ((message = messageQueue.poll()) != null) {
      MessageHandler<Message> handler = (MessageHandler<Message>) HandlerLookupService.find(message.getClass());
      if (handler != null) {
        handler.handle(this, player, message);
      }
      timeoutCounter = 0;
    }
View Full Code Here

    for (Iterator<Entity> it = knownEntities.iterator(); it.hasNext(); ) {
      Entity entity = it.next();
      boolean withinDistance = entity.isActive() && isWithinDistance(entity);

      if (withinDistance) {
        Message msg = entity.createUpdateMessage();
        if (msg != null)
          session.send(msg);
      } else {
        session.send(new DestroyEntityMessage(entity.getId()));
        it.remove();
View Full Code Here

TOP

Related Classes of net.lightstone.msg.Message

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.