Ejemplo n.º 1
0
 public void handle(ClientMessage msg, CommunicationHandler comm) {
   int flatID = Integer.parseInt(msg.nextArgument('/'));
   Space flat = HabboHotel.getSpaceAdmin().getSpaceInfo(flatID);
   if (flat != null && flat.ownerID == comm.getUserObject().ID) {
     // Delete flat and all content etc
     HabboHotel.getSpaceAdmin().deleteSpace(flat);
   }
 }
Ejemplo n.º 2
0
  public void handle(ClientMessage msg, CommunicationHandler comm) {
    // Gather destination tile coordinates
    short tileX = Short.parseShort(msg.nextArgument());
    short tileY = Short.parseShort(msg.nextArgument());

    // Get SpaceUser
    SpaceUser usr = comm.getSpaceInstance().getUserByClientID(comm.clientID);

    // Can move?
    if (usr != null && !usr.moveLock) {
      // Not trying to restart the route? (as it's pointless...)
      if (tileX != usr.goalX || tileY != usr.goalY) {
        // Not clicking own tile?
        if (tileX != usr.X || tileY != usr.Y) {
          // Request movement 'trip' in space instance
          // Pathfinder will be invoked in the current thread (so, m_thread in TcpConnection)
          comm.getSpaceInstance().getInteractor().startUserMovement(usr, tileX, tileY, false);
        }
      }
    }
  }
Ejemplo n.º 3
0
  public void handle(ClientMessage msg, CommunicationHandler comm) {
    if (comm.getSpaceInstance().getUserByClientID(comm.clientID).isFlatController) {
      int itemID = Integer.parseInt(msg.nextArgument('/'));
      Item item = comm.getSpaceInstance().getInteractor().getWallItem(itemID);

      // Item found?
      if (item != null) {
        // Item a post.it?
        if (item.definition.behaviour.isPostIt) {
          // Parse data
          String[] data = msg.getRemainingBody().split(" ", 2);
          if (!SecurityUtil.postItColorValid(data[0])) {
            comm.systemMsg(
                "Sorry mate, but this isn't a valid post.it color.\rAre you using a jewish client or what?\rOh well, go ahead, you have a scripted post.it now!");
          }
          // else // Remove this to allow scripting
          {
            item.customData = data[0]; // Color
            item.itemData = data[1]; // Message
            if (item.customData.length() > 684) {
              item.customData = item.customData.substring(0, 684);
            }

            // Notify clients
            ServerMessage notify =
                new ServerMessage("ADDITEM"); // UPDATEITEM does not work (client not finished!)
            notify.appendObject(item);
            comm.getSpaceInstance().broadcast(notify);

            // Update item
            HabboHotel.getItemAdmin().updateItem(item);
          }
        }
      }
    }
  }
Ejemplo n.º 4
0
  public void handle(ClientMessage msg, CommunicationHandler comm) {
    comm.response.set("ADVERTISEMENT");
    comm.response.appendArgument("0");

    comm.sendResponse();
  }