/**
  * TODO: there is a bug in marauroa, remove this if marauroa stops storing volatile attributes.
  * review then also which attributes should be volatile and which shouldnt.
  *
  * @param player
  */
 private void removeVolatile(final RPObject player) {
   if (player.has(AWAY)) {
     player.remove(AWAY);
   }
   // remove grumpy on login to give postman a chance to deliver messages
   // (and in the hope that player is receptive now)
   if (player.has(GRUMPY)) {
     player.remove(GRUMPY);
   }
 }
예제 #2
0
  /**
   * Set a keyed string value on a named slot.
   *
   * @param slotOwner the object owning the slot
   * @param name The slot name.
   * @param key The value key.
   * @param value The value to assign (or remove if <code>null</code>).
   * @return <code>true</code> if value changed, <code>false</code> if there was a problem.
   */
  public static boolean setKeyedSlot(
      final SlotOwner slotOwner, final String name, final String key, final String value) {
    final RPObject object = KeyedSlotUtil.getKeyedSlotObject(slotOwner, name);
    if (object == null) {
      return false;
    }

    if (value != null) {
      object.put(key, value);
    } else if (object.has(key)) {
      object.remove(key);
    }

    return true;
  }