private boolean validateCondition(Player player) {
   Residence residence = getCastle();
   if (residence != null && residence.getId() > 0)
     if (player.getClan() != null)
       if (residence.getOwnerId() == player.getClanId() && player.isClanLeader()) // Leader of clan
       return true; // Owner
   residence = getFortress();
   if (residence != null && residence.getId() > 0)
     if (player.getClan() != null)
       if (residence.getOwnerId() == player.getClanId() && player.isClanLeader()) // Leader of clan
       return true; // Owner
   residence = getClanHall();
   if (residence != null && residence.getId() > 0)
     if (player.getClan() != null)
       if (residence.getOwnerId() == player.getClanId() && player.isClanLeader()) // Leader of clan
       return true; // Owner
   return false;
 }
Example #2
0
 public boolean insert(Player player) {
   Connection con = null;
   PreparedStatement statement = null;
   try {
     con = DatabaseFactory.getInstance().getConnection();
     statement =
         con.prepareStatement(
             "INSERT INTO `characters` (account_name, obj_Id, char_name, face, hairStyle, hairColor, sex, karma, pvpkills, pkkills, clanid, createtime, deletetime, title, accesslevel, online, leaveclan, deleteclan, nochannel, pledge_type, pledge_rank, lvl_joined_academy, apprentice) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
     statement.setString(1, player.getAccountName());
     statement.setInt(2, player.getObjectId());
     statement.setString(3, player.getName());
     statement.setInt(4, player.getFace());
     statement.setInt(5, player.getHairStyle());
     statement.setInt(6, player.getHairColor());
     statement.setInt(7, player.getSex());
     statement.setInt(8, player.getKarma());
     statement.setInt(9, player.getPvpKills());
     statement.setInt(10, player.getPkKills());
     statement.setInt(11, player.getClanId());
     statement.setLong(12, player.getCreateTime() / 1000);
     statement.setInt(13, player.getDeleteTimer());
     statement.setString(14, player.getTitle());
     statement.setInt(15, player.getAccessLevel());
     statement.setInt(16, player.isOnline() ? 1 : 0);
     statement.setLong(17, player.getLeaveClanTime() / 1000);
     statement.setLong(18, player.getDeleteClanTime() / 1000);
     statement.setLong(
         19, player.getNoChannel() > 0 ? player.getNoChannel() / 1000 : player.getNoChannel());
     statement.setInt(20, player.getPledgeType());
     statement.setInt(21, player.getPowerGrade());
     statement.setInt(22, player.getLvlJoinedAcademy());
     statement.setInt(23, player.getApprentice());
     statement.executeUpdate();
   } catch (final Exception e) {
     _log.error("", e);
     return false;
   } finally {
     DbUtils.closeQuietly(con, statement);
   }
   return true;
 }