private boolean mayAccess(Player player,Entity entity,RPAction action){
  if (entity == null) {
    return false;
  }
  RPObject object=entity.getContainer();
  if (object == null) {
    return false;
  }
  RPSlot slot=entity.getContainerSlot();
  if (!reorderableSlots.contains(slot.getName())) {
    return false;
  }
  if (slot instanceof EntitySlot) {
    if (!isReachableSlot(player,slot)) {
      return false;
    }
  }
 else   if (object != player) {
    return false;
  }
  do {
    if (object instanceof Player) {
      if (object != player) {
        logger.error("Player " + player.getName() + " tried to reorder objects belonging to another player. Action: "+ action);
        return false;
      }
    }
    slot=object.getContainerSlot();
    if ((slot != null) && isReachableSlot(player,slot)) {
      return false;
    }
    if (object instanceof Corpse) {
      return false;
    }
    object=object.getContainer();
  }
 while (object != null);
  return true;
}

private boolean mayAccess ( Player player , Entity entity , RPAction action ) { if ( entity == null ) { return false ; } RPObject object = entity . getContainer ( ) ; if ( object == null ) { return false ; } RPSlot slot = entity . getContainerSlot ( ) ; if ( ! reorderableSlots . contains ( slot . getName ( ) ) ) { return false ; } if ( slot instanceof EntitySlot ) { if ( ! isReachableSlot ( player , slot ) ) { return false ; } } else if ( object != player ) { return false ; } do { if ( object instanceof Player ) { if ( object != player ) { logger . error ( "Player " + player . getName ( ) + " tried to reorder objects belonging to another player. Action: " + action ) ; return false ; } } slot = object . getContainerSlot ( ) ; if ( ( slot != null ) && isReachableSlot ( player , slot ) ) { return false ; } if ( object instanceof Corpse ) { return false ; } object = object . getContainer ( ) ; } while ( object != null ) ; return true ; }
check if a player may access an entity for reordering .
