Guest User

Coyote from MaxCheaters(dot)com

a guest
Feb 27th, 2010
748
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 22.87 KB | None | 0 0
  1. Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminBan.java
  2. ===================================================================
  3. --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminBan.java   (revision 3968)
  4. +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminBan.java   (working copy)
  5.  -124,7 +124,7 @@
  6.                 L2PcInstance playerObj = L2World.getInstance().getPlayer(player);
  7.                 if (playerObj != null)
  8.                 {
  9. -                   playerObj.setInJail(true, delay);
  10. +                   playerObj.setPunishLevel(L2PcInstance.PunishLevel.JAIL, delay);
  11.                     activeChar.sendMessage("Character "+player+" jailed for "+(delay>0 ? delay+" minutes." : "ever!"));
  12.                 }
  13.                 else
  14.  -149,7 +149,7 @@
  15.  
  16.                 if (playerObj != null)
  17.                 {
  18. -                   playerObj.setInJail(false, 0);
  19. +                   playerObj.setPunishLevel(L2PcInstance.PunishLevel.NONE, 0);
  20.                     activeChar.sendMessage("Character "+player+" removed from jail");
  21.                 }
  22.                 else
  23.  -176,7 +176,7 @@
  24.         {
  25.             con = L2DatabaseFactory.getInstance().getConnection();
  26.  
  27. -           PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, in_jail=?, jail_timer=? WHERE char_name=?");
  28. +           PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, punish_level=?, punish_timer=? WHERE char_name=?");
  29.             statement.setInt(1, -114356);
  30.             statement.setInt(2, -249645);
  31.             statement.setInt(3, -2984);
  32.  -212,7 +212,7 @@
  33.         try
  34.         {
  35.             con = L2DatabaseFactory.getInstance().getConnection();
  36. -           PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, in_jail=?, jail_timer=? WHERE char_name=?");
  37. +           PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, punish_level=?, punish_timer=? WHERE char_name=?");
  38.             statement.setInt(1, 17836);
  39.             statement.setInt(2, 170178);
  40.             statement.setInt(3, -3507);
  41. Index: java/net/sf/l2j/gameserver/ThreadPoolManager.java
  42. ===================================================================
  43. --- java/net/sf/l2j/gameserver/ThreadPoolManager.java   (revision 3968)
  44. +++ java/net/sf/l2j/gameserver/ThreadPoolManager.java   (working copy)
  45.  -118,6 +118,11 @@
  46.  
  47.         _aiScheduledThreadPool = new ScheduledThreadPoolExecutor(Config.AI_MAX_THREAD, new PriorityThreadFactory("AISTPool", Thread.NORM_PRIORITY));
  48.     }
  49. +  
  50. +   public boolean removeGeneral(Runnable r)
  51. +   {
  52. +       return _generalScheduledThreadPool.remove(r);
  53. +   }
  54.  
  55.     public ScheduledFuture scheduleEffect(Runnable r, long delay)
  56.     {
  57. Index: java/net/sf/l2j/gameserver/util/IllegalPlayerAction.java
  58. ===================================================================
  59. --- java/net/sf/l2j/gameserver/util/IllegalPlayerAction.java    (revision 3968)
  60. +++ java/net/sf/l2j/gameserver/util/IllegalPlayerAction.java    (working copy)
  61.  -97,7 +97,7 @@
  62.                  _actor.closeNetConnection();
  63.                  break;
  64.              case PUNISH_JAIL:
  65. -                _actor.setInJail(true, Config.DEFAULT_PUNISH_PARAM);
  66. +               _actor.setPunishLevel(L2PcInstance.PunishLevel.JAIL, Config.DEFAULT_PUNISH_PARAM);
  67.                  break;
  68.          }
  69.      }
  70. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
  71. ===================================================================
  72. --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (revision 3968)
  73. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (working copy)
  74.  -215,8 +215,8 @@
  75.     private static final String RESTORE_SKILL_SAVE = "SELECT skill_id,skill_level,effect_count,effect_cur_time, reuse_delay FROM character_skills_save WHERE char_obj_id=? AND class_index=? AND restore_type=? ORDER BY buff_index ASC";
  76.     private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?";
  77.  
  78. -    private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=? WHERE obj_id=?";
  79. -    private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level FROM characters WHERE obj_id=?";
  80. +    private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=? WHERE obj_id=?";
  81. +    private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level FROM characters WHERE obj_id=?";
  82.      private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC";
  83.      private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)";
  84.      private static final String UPDATE_CHAR_SUBCLASS = "UPDATE character_subclasses SET exp=?,sp=?,level=?,class_id=? WHERE char_obj_id=? AND class_index =?";
  85.  -365,9 +365,37 @@
  86.  
  87.     private boolean _isIn7sDungeon = false;
  88.  
  89. -    private boolean _inJail = false;
  90. -    private long _jailTimer = 0;
  91. -    private ScheduledFuture _jailTask;
  92. +   private PunishLevel _punishLevel = PunishLevel.NONE;
  93. +   private long _punishTimer = 0;
  94. +   private ScheduledFuture<?> _punishTask;
  95. +  
  96. +   public enum PunishLevel
  97. +   {
  98. +       NONE(0, ""),
  99. +       CHAT(1, "chat banned"),
  100. +       JAIL(2, "jailed"),
  101. +       CHAR(3, "banned"),
  102. +       ACC(4, "banned");
  103. +      
  104. +       private final int punValue;
  105. +       private final String punString;
  106. +      
  107. +       PunishLevel(int value, String string)
  108. +       {
  109. +           punValue = value;
  110. +           punString = string;
  111. +       }
  112. +      
  113. +       public int value()
  114. +       {
  115. +           return punValue;
  116. +       }
  117. +      
  118. +       public String string()
  119. +       {
  120. +           return punString;
  121. +       }
  122. +   }
  123.  
  124.      /** Olympiad */
  125.      private boolean _inOlympiadMode = false;
  126.  -4715,7 +4743,7 @@
  127.         stopWaterTask();
  128.         stopRentPet();
  129.         stopPvpRegTask();
  130. -        stopJailTask(true);
  131. +       stopPunishTask(true);
  132.     }
  133.  
  134.     /**
  135.  -5686,11 +5714,11 @@
  136.                  player.setSponsor(rset.getInt("sponsor"));
  137.                  player.setLvlJoinedAcademy(rset.getInt("lvl_joined_academy"));
  138.                  player.setIsIn7sDungeon((rset.getInt("isin7sdungeon")==1)? true : false);
  139. -                player.setInJail((rset.getInt("in_jail")==1)? true : false);
  140. -                if (player.isInJail())
  141. -                   player.setJailTimer(rset.getLong("jail_timer"));
  142. +                player.setPunishLevel(rset.getInt("punish_level"));
  143. +                if (player.getPunishLevel() != PunishLevel.NONE)
  144. +                   player.setPunishTimer(rset.getLong("punish_timer"));
  145.                  else
  146. -                   player.setJailTimer(0);
  147. +                   player.setPunishTimer(0);
  148.  
  149.                  CursedWeaponsManager.getInstance().checkPlayer(player);
  150.  
  151.  -6046,8 +6074,8 @@
  152.                 totalOnlineTime += (System.currentTimeMillis()-_onlineBeginTime)/1000;
  153.  
  154.              statement.setLong(41, totalOnlineTime);
  155. -            statement.setInt(42, isInJail() ? 1 : 0);
  156. -            statement.setLong(43, getJailTimer());
  157. +            statement.setInt(42, getPunishLevel().value());
  158. +            statement.setLong(43, getPunishTimer());
  159.              statement.setInt(44, isNewbie() ? 1 : 0);
  160.              statement.setInt(45, isNoble() ? 1 : 0);
  161.              statement.setLong(46, getPowerGrade());
  162.  -8037,11 +8065,6 @@
  163.         sendPacket(new EtcStatusUpdate(this));
  164.     }
  165.  
  166. -   public boolean isChatBanned()
  167. -   {
  168. -       return _chatBanned;
  169. -   }
  170. -
  171.      public void setChatUnbanTask(ScheduledFuture task)
  172.      {
  173.           _chatUnbanTask = task;
  174.  -8199,7 +8222,7 @@
  175.      */
  176.     public boolean canDuel()
  177.     {
  178. -       if (isInCombat() || isInJail()) { _noDuelReason = SystemMessageId.S1_CANNOT_DUEL_BECAUSE_S1_IS_CURRENTLY_ENGAGED_IN_BATTLE; return false; }
  179. +       if (isInCombat() || getPunishLevel() == PunishLevel.JAIL) { _noDuelReason = SystemMessageId.S1_CANNOT_DUEL_BECAUSE_S1_IS_CURRENTLY_ENGAGED_IN_BATTLE; return false; }
  180.         if (isDead() || isAlikeDead() || (getCurrentHp() < getMaxHp()/2 || getCurrentMp() < getMaxMp()/2)) { _noDuelReason = SystemMessageId.S1_CANNOT_DUEL_BECAUSE_S1S_HP_OR_MP_IS_BELOW_50_PERCENT; return false; }
  181.         if (isInDuel()) { _noDuelReason = SystemMessageId.S1_CANNOT_DUEL_BECAUSE_S1_IS_ALREADY_ENGAGED_IN_A_DUEL; return false;}
  182.         if (isInOlympiadMode()) { _noDuelReason = SystemMessageId.S1_CANNOT_DUEL_BECAUSE_S1_IS_PARTICIPATING_IN_THE_OLYMPIAD; return false; }
  183.  -8775,8 +8798,7 @@
  184.              }
  185.          }
  186.  
  187. -        // jail task
  188. -        updateJailState();
  189. +        updatePunishState();
  190.  
  191.          if (_isInvul)
  192.             sendMessage("Entering world in Invulnerable mode.");
  193.  -9863,121 +9885,240 @@
  194.  
  195.          _queuedSkill = new SkillDat(queuedSkill, ctrlPressed, shiftPressed);
  196.      }
  197. +    
  198. +    /**
  199. +     * returns punishment level of player
  200. +     * @return
  201. +     */
  202. +    public PunishLevel getPunishLevel()
  203. +    {
  204. +        return _punishLevel;
  205. +    }
  206.  
  207. +    /**
  208. +     * @return True if player is jailed
  209. +     */
  210.      public boolean isInJail()
  211.      {
  212. -        return _inJail;
  213. +       return _punishLevel == PunishLevel.JAIL;
  214.      }
  215. -
  216. -    public void setInJail(boolean state)
  217. +    
  218. +    /**
  219. +     * @return True if player is chat banned
  220. +     */
  221. +    public boolean isChatBanned()
  222.      {
  223. -        _inJail = state;
  224. +       return _punishLevel == PunishLevel.CHAT;
  225.      }
  226. +    
  227. +    public void setPunishLevel(int state)
  228. +    {
  229. +       switch (state){
  230. +           case 0 :
  231. +           {
  232. +               _punishLevel = PunishLevel.NONE;
  233. +               break;
  234. +           }
  235. +           case 1 :
  236. +           {
  237. +               _punishLevel = PunishLevel.CHAT;
  238. +               break;
  239. +           }
  240. +           case 2 :
  241. +           {
  242. +               _punishLevel = PunishLevel.JAIL;
  243. +               break;
  244. +           }
  245. +           case 3 :
  246. +           {
  247. +               _punishLevel = PunishLevel.CHAR;
  248. +               break;
  249. +           }
  250. +           case 4 :
  251. +           {
  252. +               _punishLevel = PunishLevel.ACC;
  253. +               break;
  254. +           }
  255. +       }
  256. +    }
  257.  
  258. -    public void setInJail(boolean state, int delayInMinutes)
  259. +    /**
  260. +     * Sets punish level for player based on delay
  261. +     * @param state
  262. +     * @param delayInMinutes
  263. +     *         0 - Indefinite
  264. +     */
  265. +    public void setPunishLevel(PunishLevel state, int delayInMinutes)
  266.      {
  267. -        _inJail = state;
  268. -        _jailTimer = 0;
  269. -        // Remove the task if any
  270. -        stopJailTask(false);
  271. +       long delayInMilliseconds = delayInMinutes * 60000L;
  272. +       switch (state)
  273. +       {
  274. +           case NONE: // Remove Punishments
  275. +           {
  276. +               switch (_punishLevel)
  277. +               {
  278. +                   case CHAT:
  279. +                   {
  280. +                       _punishLevel = state;
  281. +                       stopPunishTask(true);
  282. +                       sendPacket(new EtcStatusUpdate(this));
  283. +                       sendMessage("Your Chat ban has been lifted");
  284. +                       break;
  285. +                   }
  286. +                   case JAIL:
  287. +                   {
  288. +                       _punishLevel = state;
  289. +                       // Open a Html message to inform the player
  290. +                       NpcHtmlMessage htmlMsg = new NpcHtmlMessage(0);
  291. +                       String jailInfos = HtmCache.getInstance().getHtm("data/html/jail_out.htm");
  292. +                       if (jailInfos != null)
  293. +                           htmlMsg.setHtml(jailInfos);
  294. +                       else
  295. +                           htmlMsg.setHtml("<html><body>You are free for now, respect server rules!</body></html>");
  296. +                       sendPacket(htmlMsg);
  297. +                       stopPunishTask(true);
  298. +                       teleToLocation(17836, 170178, -3507, true);  // Floran
  299. +                       break;
  300. +                   }
  301. +               }
  302. +               break;
  303. +           }
  304. +           case CHAT: // Chat Ban
  305. +           {
  306. +               // not allow player to escape jail using chat ban
  307. +               if (_punishLevel == PunishLevel.JAIL)
  308. +                   break;
  309. +               _punishLevel = state;
  310. +               _punishTimer = 0;
  311. +               sendPacket(new EtcStatusUpdate(this));
  312. +               // Remove the task if any
  313. +               stopPunishTask(false);
  314. +              
  315. +               if (delayInMinutes > 0)
  316. +               {
  317. +                   _punishTimer = delayInMilliseconds;
  318. +                  
  319. +                   // start the countdown
  320. +                   _punishTask = ThreadPoolManager.getInstance().scheduleGeneral(new PunishTask(this), _punishTimer);
  321. +                   sendMessage("You are chat banned for "+delayInMinutes+" minutes.");
  322. +               }
  323. +               else
  324. +                   sendMessage("You have been chat banned");
  325. +               break;
  326. +              
  327. +           }
  328. +           case JAIL: // Jail Player
  329. +           {
  330. +               _punishLevel = state;
  331. +               _punishTimer = 0;
  332. +               // Remove the task if any
  333. +               stopPunishTask(false);
  334. +  
  335. +               if (delayInMinutes > 0)
  336. +               {
  337. +                   _punishTimer = delayInMilliseconds;
  338. +  
  339. +                   // start the countdown
  340. +                   _punishTask = ThreadPoolManager.getInstance().scheduleGeneral(new PunishTask(this), _punishTimer);
  341. +                   sendMessage("You are in jail for "+delayInMinutes+" minutes.");
  342. +               }
  343. +  
  344. +               // Open a Html message to inform the player
  345. +               NpcHtmlMessage htmlMsg = new NpcHtmlMessage(0);
  346. +               String jailInfos = HtmCache.getInstance().getHtm("data/html/jail_in.htm");
  347. +               if (jailInfos != null)
  348. +                   htmlMsg.setHtml(jailInfos);
  349. +               else
  350. +                   htmlMsg.setHtml("<html><body>You have been put in jail by an admin.</body></html>");
  351. +               sendPacket(htmlMsg);
  352. +               setIsIn7sDungeon(false);
  353. +  
  354. +               teleToLocation(-114356, -249645, -2984, false);  // Jail
  355. +               break;
  356. +           }
  357. +           case CHAR: // Ban Character
  358. +           {
  359. +               setAccessLevel(-100);
  360. +               logout();
  361. +               break;
  362. +           }
  363. +           case ACC: // Ban Account
  364. +           {
  365. +               setAccountAccesslevel(-100);
  366. +               logout();
  367. +               break;
  368. +           }
  369. +           default:
  370. +           {
  371. +               _punishLevel = state;
  372. +               break;
  373. +           }
  374. +       }
  375.  
  376. -        if (_inJail)
  377. -        {
  378. -            if (delayInMinutes > 0)
  379. -            {
  380. -                _jailTimer = delayInMinutes * 60000L; // in millisec
  381. -
  382. -                // start the countdown
  383. -                _jailTask = ThreadPoolManager.getInstance().scheduleGeneral(new JailTask(this), _jailTimer);
  384. -                sendMessage("You are in jail for "+delayInMinutes+" minutes.");
  385. -            }
  386. -
  387. -            // Open a Html message to inform the player
  388. -            NpcHtmlMessage htmlMsg = new NpcHtmlMessage(0);
  389. -            String jailInfos = HtmCache.getInstance().getHtm("data/html/jail_in.htm");
  390. -            if (jailInfos != null)
  391. -                htmlMsg.setHtml(jailInfos);
  392. -            else
  393. -                htmlMsg.setHtml("<html><body>You have been put in jail by an admin.</body></html>");
  394. -            sendPacket(htmlMsg);
  395. -
  396. -            teleToLocation(-114356, -249645, -2984, true);  // Jail
  397. -        } else
  398. -        {
  399. -            // Open a Html message to inform the player
  400. -            NpcHtmlMessage htmlMsg = new NpcHtmlMessage(0);
  401. -            String jailInfos = HtmCache.getInstance().getHtm("data/html/jail_out.htm");
  402. -            if (jailInfos != null)
  403. -                htmlMsg.setHtml(jailInfos);
  404. -            else
  405. -                htmlMsg.setHtml("<html><body>You are free for now, respect server rules!</body></html>");
  406. -            sendPacket(htmlMsg);
  407. -
  408. -            teleToLocation(17836, 170178, -3507, true);  // Floran
  409. -        }
  410. -
  411.          // store in database
  412.          storeCharBase();
  413.      }
  414.  
  415. -    public long getJailTimer()
  416. +    public long getPunishTimer()
  417.      {
  418. -        return _jailTimer;
  419. +        return _punishTimer;
  420.      }
  421.  
  422. -    public void setJailTimer(long time)
  423. +    public void setPunishTimer(long time)
  424.      {
  425. -        _jailTimer = time;
  426. +        _punishTimer = time;
  427.      }
  428.  
  429. -    private void updateJailState()
  430. +    private void updatePunishState()
  431.      {
  432. -        if (isInJail())
  433. +       if (getPunishLevel() != PunishLevel.NONE)
  434.          {
  435. -            // If jail time is elapsed, free the player
  436. -            if (_jailTimer > 0)
  437. +            // If punish timer exists, restart punishtask.
  438. +            if (_punishTimer > 0)
  439.              {
  440. -                // restart the countdown
  441. -                _jailTask = ThreadPoolManager.getInstance().scheduleGeneral(new JailTask(this), _jailTimer);
  442. -                sendMessage("You are still in jail for "+Math.round(_jailTimer/60000)+" minutes.");
  443. +                _punishTask = ThreadPoolManager.getInstance().scheduleGeneral(new PunishTask(this), _punishTimer);
  444. +                sendMessage("You are still "+getPunishLevel().string()+" for "+Math.round(_punishTimer/60000)+" minutes.");
  445.              }
  446. -
  447. -            // If player escaped, put him back in jail
  448. -            if (!isInsideZone(ZONE_JAIL))
  449. -                teleToLocation(-114356,-249645,-2984, true);
  450. +            if (getPunishLevel() == PunishLevel.JAIL)
  451. +            {
  452. +               // If player escaped, put him back in jail
  453. +                if (!isInsideZone(ZONE_JAIL))
  454. +                    teleToLocation(-114356,-249645,-2984, true);
  455. +            }
  456.          }
  457.      }
  458.  
  459. -    public void stopJailTask(boolean save)
  460. +    public void stopPunishTask(boolean save)
  461.      {
  462. -        if (_jailTask != null)
  463. +        if (_punishTask != null)
  464.          {
  465.              if (save)
  466.              {
  467. -               long delay = _jailTask.getDelay(TimeUnit.MILLISECONDS);
  468. +               long delay = _punishTask.getDelay(TimeUnit.MILLISECONDS);
  469.                 if (delay < 0)
  470.                     delay = 0;
  471. -               setJailTimer(delay);
  472. +               setPunishTimer(delay);
  473.              }
  474. -            _jailTask.cancel(false);
  475. -            _jailTask = null;
  476. +            _punishTask.cancel(false);
  477. +            ThreadPoolManager.getInstance().removeGeneral((Runnable)_punishTask);
  478. +            _punishTask = null;
  479.          }
  480.      }
  481.  
  482. -    private class JailTask implements Runnable
  483. +    private class PunishTask implements Runnable
  484.      {
  485.          L2PcInstance _player;
  486. -        protected long _startedAt;
  487. +        // protected long _startedAt;
  488.  
  489. -        protected JailTask(L2PcInstance player)
  490. +        protected PunishTask(L2PcInstance player)
  491.          {
  492.              _player = player;
  493. -            _startedAt = System.currentTimeMillis();
  494. +            // _startedAt = System.currentTimeMillis();
  495.          }
  496.  
  497.          public void run()
  498.          {
  499. -            _player.setInJail(false, 0);
  500. +            _player.setPunishLevel(PunishLevel.NONE, 0);
  501.          }
  502.      }
  503.  
  504. Index: java/net/sf/l2j/status/GameStatusThread.java
  505. ===================================================================
  506. --- java/net/sf/l2j/status/GameStatusThread.java    (revision 3968)
  507. +++ java/net/sf/l2j/status/GameStatusThread.java    (working copy)
  508.  -510,7 +510,7 @@
  509.  
  510.                          if (playerObj != null)
  511.                          {
  512. -                            playerObj.setInJail(true, delay);
  513. +                           playerObj.setPunishLevel(L2PcInstance.PunishLevel.JAIL, delay);
  514.                              _print.println("Character "+playerObj.getName()+" jailed for "+(delay>0 ? delay+" minutes." : "ever!"));
  515.                          } else
  516.                             jailOfflinePlayer(playerObj.getName(), delay);
  517.  -531,8 +531,7 @@
  518.  
  519.                          if (playerObj != null)
  520.                          {
  521. -                            playerObj.stopJailTask(false);
  522. -                            playerObj.setInJail(false, 0);
  523. +                           playerObj.setPunishLevel(L2PcInstance.PunishLevel.NONE, 0);
  524.                              _print.println("Character "+playerObj.getName()+" removed from jail");
  525.                          } else
  526.                             unjailOfflinePlayer(playerObj.getName());
  527.  -811,11 +810,11 @@
  528.             {
  529.                 con = L2DatabaseFactory.getInstance().getConnection();
  530.  
  531. -               PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, in_jail=?, jail_timer=? WHERE char_name=?");
  532. +               PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, punish_level=?, punish_timer=? WHERE char_name=?");
  533.                 statement.setInt(1, -114356);
  534.                 statement.setInt(2, -249645);
  535.                 statement.setInt(3, -2984);
  536. -               statement.setInt(4, 1);
  537. +               statement.setInt(4, L2PcInstance.PunishLevel.JAIL.value());
  538.                 statement.setLong(5, delay * 60000L);
  539.                 statement.setString(6, name);
  540.  
  541.  -844,7 +843,7 @@
  542.             {
  543.                 con = L2DatabaseFactory.getInstance().getConnection();
  544.  
  545. -               PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, in_jail=?, jail_timer=? WHERE char_name=?");
  546. +               PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, punish_level=?, punish_timer=? WHERE char_name=?");
  547.                 statement.setInt(1, 17836);
  548.                 statement.setInt(2, 170178);
  549.                 statement.setInt(3, -3507);
Advertisement
Add Comment
Please, Sign In to add comment