@Override
  public boolean onInteract(RoomEntity entity, int requestData, boolean isWiredTriggered) {
    if (!isWiredTriggered) {
      if (!(entity instanceof PlayerEntity)) {
        return false;
      }

      PlayerEntity pEntity = (PlayerEntity) entity;

      if (!pEntity.getRoom().getRights().hasRights(pEntity.getPlayerId())
          && !pEntity.getPlayer().getPermissions().getRank().roomFullControl()) {
        return false;
      }
    }

    if (requestData == 2) {
      int time = 0;

      if (!this.getExtraData().isEmpty() && StringUtils.isNumeric(this.getExtraData())) {
        time = Integer.parseInt(this.getExtraData());
      }

      if (time == 0
          || time == 30
          || time == 60
          || time == 120
          || time == 180
          || time == 300
          || time == 600) {
        switch (time) {
          default:
            time = 0;
            break;
          case 0:
            time = 30;
            break;
          case 30:
            time = 60;
            break;
          case 60:
            time = 120;
            break;
          case 120:
            time = 180;
            break;
          case 180:
            time = 300;
            break;
          case 300:
            time = 600;
            break;
        }
      } else {
        time = 0;
      }

      this.setExtraData(time + "");
      this.sendUpdate();
    } else {
      if (this.isStarted) {
        this.isStarted = false;
        //                this.setExtraData("0");
        //                this.sendUpdate();

        return true;
      }

      // Start time.
      this.isStarted = true;

      WiredTriggerGameStarts.executeTriggers(this.getRoom());
      this.setTicks(RoomItemFactory.getProcessTime(1));
    }

    return true;
  }
  public void handle(Session client, MessageEvent msg) {
    String text = msg.readString();

    String user = text.split(" ")[0];
    String message = text.replace(user + " ", "");

    if (client.getPlayer().getEntity() == null
        || client.getPlayer().getEntity().getRoom() == null) {
      return;
    }

    if (!client.getPlayer().getEntity().isVisible()) {
      return;
    }

    final Room room = client.getPlayer().getEntity().getRoom();

    RoomEntity userTo = room.getEntities().getEntityByName(user, RoomEntityType.PLAYER);

    if (userTo == null || user.equals(client.getPlayer().getData().getUsername())) return;

    String filteredMessage = TalkMessageEvent.filterMessage(message);

    if (!client.getPlayer().getPermissions().getRank().roomFilterBypass()) {
      FilterResult filterResult = RoomManager.getInstance().getFilter().filter(message);

      if (filterResult.isBlocked()) {
        client.send(
            new AdvancedAlertMessageComposer(
                Locale.get("game.message.blocked").replace("%s", filterResult.getMessage())));
        return;
      } else if (filterResult.wasModified()) {
        filteredMessage = filterResult.getMessage();
      }
    }

    if (!client.getPlayer().getEntity().onChat(filteredMessage)) return;

    try {
      if (LogManager.ENABLED)
        LogManager.getInstance()
            .getStore()
            .getLogEntryContainer()
            .put(
                new RoomChatLogEntry(
                    room.getId(),
                    client.getPlayer().getId(),
                    Locale.getOrDefault("game.logging.whisper", "<Whisper to %username%>")
                            .replace("%username%", user)
                        + " "
                        + message));
    } catch (Exception ignored) {

    }

    client.send(
        new WhisperMessageComposer(client.getPlayer().getEntity().getId(), filteredMessage));

    if (!((PlayerEntity) userTo).getPlayer().ignores(client.getPlayer().getId()))
      ((PlayerEntity) userTo)
          .getPlayer()
          .getSession()
          .send(
              new WhisperMessageComposer(client.getPlayer().getEntity().getId(), filteredMessage));

    for (PlayerEntity entity :
        client.getPlayer().getEntity().getRoom().getEntities().getWhisperSeers()) {
      if (entity.getPlayer().getId() != client.getPlayer().getId()
          && !user.equals(entity.getUsername()))
        entity
            .getPlayer()
            .getSession()
            .send(
                new WhisperMessageComposer(
                    client.getPlayer().getEntity().getId(),
                    "Whisper to " + user + ": " + filteredMessage));
    }
  }