Browse Source

BETA: Complete source formatting and cleanup.
* Many JavaDocs has been fixed, as well as many typos in comments.
* Removed old/out-dated/experimental commented out code in many places.
* Fixed minor typo in [5638], seems the patch applied wrongly, Reported by: St3eT, malyelfik, thorl2
* Closing #6322
* Added "On save actions" for the project.

'''Note: From now on all code committed must be formatted.'''

Zoey76 12 năm trước cách đây
mục cha
commit
15293bcdbb
100 tập tin đã thay đổi với 4082 bổ sung2689 xóa
  1. 2 1
      L2J_Server_BETA/.settings/org.eclipse.jdt.ui.prefs
  2. 11 4
      L2J_Server_BETA/java/com/l2jserver/Config.java
  3. 10 15
      L2J_Server_BETA/java/com/l2jserver/gameserver/Announcements.java
  4. 4 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/CastleUpdater.java
  5. 13 7
      L2J_Server_BETA/java/com/l2jserver/gameserver/FortUpdater.java
  6. 25 10
      L2J_Server_BETA/java/com/l2jserver/gameserver/GameServer.java
  7. 18 9
      L2J_Server_BETA/java/com/l2jserver/gameserver/GameTimeController.java
  8. 16 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/ItemsAutoDestroy.java
  9. 8 5
      L2J_Server_BETA/java/com/l2jserver/gameserver/LoginServerThread.java
  10. 7 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/MonsterRace.java
  11. 282 105
      L2J_Server_BETA/java/com/l2jserver/gameserver/SevenSigns.java
  12. 211 126
      L2J_Server_BETA/java/com/l2jserver/gameserver/SevenSignsFestival.java
  13. 84 107
      L2J_Server_BETA/java/com/l2jserver/gameserver/Shutdown.java
  14. 3 1
      L2J_Server_BETA/java/com/l2jserver/gameserver/TaskPriority.java
  15. 95 83
      L2J_Server_BETA/java/com/l2jserver/gameserver/ThreadPoolManager.java
  16. 14 18
      L2J_Server_BETA/java/com/l2jserver/gameserver/TradeController.java
  17. 89 176
      L2J_Server_BETA/java/com/l2jserver/gameserver/ai/AbstractAI.java
  18. 20 38
      L2J_Server_BETA/java/com/l2jserver/gameserver/ai/Ctrl.java
  19. 22 17
      L2J_Server_BETA/java/com/l2jserver/gameserver/ai/CtrlEvent.java
  20. 2 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/ai/CtrlIntention.java
  21. 6 2
      L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2AirShipAI.java
  22. 268 140
      L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2AttackableAI.java
  23. 8 2
      L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2BoatAI.java
  24. 292 227
      L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2CharacterAI.java
  25. 4 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2DoorAI.java
  26. 214 100
      L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2FortSiegeGuardAI.java
  27. 32 10
      L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2NpcWalkerAI.java
  28. 12 35
      L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2PlayableAI.java
  29. 65 36
      L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2PlayerAI.java
  30. 197 98
      L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2SiegeGuardAI.java
  31. 4 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2SpecialSiegeGuardAI.java
  32. 35 10
      L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2SummonAI.java
  33. 1 1
      L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2VehicleAI.java
  34. 8 10
      L2J_Server_BETA/java/com/l2jserver/gameserver/cache/FastMRUCache.java
  35. 1 2
      L2J_Server_BETA/java/com/l2jserver/gameserver/cache/WarehouseCacheManager.java
  36. 8 20
      L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/BB/Forum.java
  37. 6 7
      L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/BB/Post.java
  38. 9 10
      L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/BB/Topic.java
  39. 7 5
      L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/CommunityBoard.java
  40. 2 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/Manager/AdminBBSManager.java
  41. 5 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/Manager/BaseBBSManager.java
  42. 39 134
      L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/Manager/ClanBBSManager.java
  43. 14 10
      L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/Manager/ForumsBBSManager.java
  44. 6 37
      L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/Manager/PostBBSManager.java
  45. 55 69
      L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/Manager/RegionBBSManager.java
  46. 2 5
      L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/Manager/TopBBSManager.java
  47. 14 67
      L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/Manager/TopicBBSManager.java
  48. 3 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/AugmentationData.java
  49. 21 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/CharNameTable.java
  50. 22 8
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/CharSummonTable.java
  51. 1 1
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/EventDroplist.java
  52. 15 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/HerbDropTable.java
  53. 71 43
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/ItemTable.java
  54. 8 10
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/MerchantPriceConfigTable.java
  55. 71 41
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/MultiSell.java
  56. 2 2
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/NpcBufferTable.java
  57. 25 9
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/OfflineTradersTable.java
  58. 4 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/PetNameTable.java
  59. 21 18
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/SkillTable.java
  60. 2 2
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/SkillTreesData.java
  61. 27 8
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/SpawnTable.java
  62. 8 10
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/SummonEffectsTable.java
  63. 13 1
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/SummonSkillsTable.java
  64. 1 2
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/TeleportLocationTable.java
  65. 9 1
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/TerritoryTable.java
  66. 11 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/UITable.java
  67. 245 60
      L2J_Server_BETA/java/com/l2jserver/gameserver/engines/DocumentBase.java
  68. 4 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/engines/DocumentEngine.java
  69. 1 2
      L2J_Server_BETA/java/com/l2jserver/gameserver/engines/DocumentParser.java
  70. 21 12
      L2J_Server_BETA/java/com/l2jserver/gameserver/engines/items/DocumentItem.java
  71. 0 1
      L2J_Server_BETA/java/com/l2jserver/gameserver/engines/items/Item.java
  72. 321 213
      L2J_Server_BETA/java/com/l2jserver/gameserver/engines/skills/DocumentSkill.java
  73. 3 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/geoeditorcon/GeoEditorListener.java
  74. 35 10
      L2J_Server_BETA/java/com/l2jserver/gameserver/geoeditorcon/GeoEditorThread.java
  75. 0 1
      L2J_Server_BETA/java/com/l2jserver/gameserver/handler/ItemHandler.java
  76. 2 2
      L2J_Server_BETA/java/com/l2jserver/gameserver/idfactory/IdFactory.java
  77. 39 15
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/AirShipManager.java
  78. 44 8
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/AntiFeedManager.java
  79. 15 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/AuctionManager.java
  80. 23 14
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/BoatManager.java
  81. 48 21
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/CHSiegeManager.java
  82. 45 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/CastleManager.java
  83. 44 16
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/CastleManorManager.java
  84. 50 39
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/ClanHallManager.java
  85. 9 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/CoupleManager.java
  86. 30 18
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/CursedWeaponsManager.java
  87. 24 11
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/DayNightSpawnManager.java
  88. 48 10
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/DimensionalRiftManager.java
  89. 38 12
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/DuelManager.java
  90. 18 2
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/FortManager.java
  91. 10 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/FortSiegeGuardManager.java
  92. 41 9
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/FortSiegeManager.java
  93. 161 80
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/FourSepulchersManager.java
  94. 1 1
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/GlobalVariablesManager.java
  95. 38 54
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/GrandBossManager.java
  96. 102 73
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/HandysBlockCheckerManager.java
  97. 2 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/HellboundManager.java
  98. 6 2
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/ItemAuctionManager.java
  99. 0 1
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/ItemsOnGroundManager.java
  100. 29 19
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/MailManager.java

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2 - 1
L2J_Server_BETA/.settings/org.eclipse.jdt.ui.prefs


+ 11 - 4
L2J_Server_BETA/java/com/l2jserver/Config.java

@@ -2281,7 +2281,7 @@ public final class Config
 			}
 			catch (Exception e)
 			{
-				_log.log(Level.WARNING, "Error while loading Player XP percent lost!",  e);
+				_log.log(Level.WARNING, "Error while loading Player XP percent lost!", e);
 			}
 			
 			String[] rateDropItemsById = RatesSettings.getProperty("RateDropItemsById", "").split(";");
@@ -4315,7 +4315,8 @@ public final class Config
 				_log.log(Level.INFO, "Network Config: ipconfig.xml exists using manual configuration...");
 				parseFile(new File(IP_CONFIG_FILE));
 			}
-			else // Auto configuration...
+			else
+			// Auto configuration...
 			{
 				_log.log(Level.INFO, "Network Config: ipconfig.xml doesn't exists using automatic configuration...");
 				autoIpConfig();
@@ -4363,7 +4364,7 @@ public final class Config
 		protected void autoIpConfig()
 		{
 			String externalIp = "127.0.0.1";
-			try 
+			try
 			{
 				URL autoIp = new URL("http://api.externalip.net/ip/");
 				try (BufferedReader in = new BufferedReader(new InputStreamReader(autoIp.openStream())))
@@ -4387,15 +4388,21 @@ public final class Config
 					NetworkInterface ni = niList.nextElement();
 					
 					if (!ni.isUp() || ni.isVirtual())
+					{
 						continue;
+					}
 					
-					if (!ni.isLoopback() && ni.getHardwareAddress().length != 6)
+					if (!ni.isLoopback() && (ni.getHardwareAddress().length != 6))
+					{
 						continue;
+					}
 					
 					for (InterfaceAddress ia : ni.getInterfaceAddresses())
 					{
 						if (ia.getAddress() instanceof Inet6Address)
+						{
 							continue;
+						}
 						
 						sub.setIPAddress(ia.getAddress().getHostAddress());
 						sub.setMaskedBits(ia.getNetworkPrefixLength());

+ 10 - 15
L2J_Server_BETA/java/com/l2jserver/gameserver/Announcements.java

@@ -39,18 +39,13 @@ import com.l2jserver.gameserver.script.DateRange;
 import com.l2jserver.gameserver.util.Broadcast;
 import com.l2jserver.util.StringUtil;
 
-/**
- * This class ...
- * 
- * @version $Revision: 1.5.2.1.2.7 $ $Date: 2005/03/29 23:15:14 $
- */
 public class Announcements
 {
 	private static Logger _log = Logger.getLogger(Announcements.class.getName());
 	
-	private List<String> _announcements = new FastList<>();
-	private List<String> _critAnnouncements = new FastList<>();
-	private List<List<Object>> _eventAnnouncements = new FastList<>();
+	private final List<String> _announcements = new FastList<>();
+	private final List<String> _critAnnouncements = new FastList<>();
+	private final List<List<Object>> _eventAnnouncements = new FastList<>();
 	
 	protected Announcements()
 	{
@@ -70,7 +65,9 @@ public class Announcements
 		readFromDisk("data/critannouncements.txt", _critAnnouncements);
 		
 		if (Config.DEBUG)
-			_log.info("Announcements: Loaded " + (_announcements.size() + _critAnnouncements.size())  + " announcements.");
+		{
+			_log.info("Announcements: Loaded " + (_announcements.size() + _critAnnouncements.size()) + " announcements.");
+		}
 	}
 	
 	public void showAnnouncements(L2PcInstance activeChar)
@@ -98,9 +95,9 @@ public class Announcements
 			if (!validDateRange.isValid() || validDateRange.isWithinRange(currentDate))
 			{
 				SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1);
-				for (int j = 0; j < msg.length; j++)
+				for (String element : msg)
 				{
-					sm.addString(msg[j]);
+					sm.addString(element);
 				}
 				activeChar.sendPacket(sm);
 			}
@@ -124,8 +121,7 @@ public class Announcements
 		final StringBuilder replyMSG = StringUtil.startAppend(500, "<br>");
 		for (int i = 0; i < _announcements.size(); i++)
 		{
-			StringUtil.append(replyMSG, "<table width=260><tr><td width=220>", _announcements.get(i), "</td><td width=40>"
-					+ "<button value=\"Delete\" action=\"bypass -h admin_del_announcement ", String.valueOf(i), "\" width=60 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table>");
+			StringUtil.append(replyMSG, "<table width=260><tr><td width=220>", _announcements.get(i), "</td><td width=40>" + "<button value=\"Delete\" action=\"bypass -h admin_del_announcement ", String.valueOf(i), "\" width=60 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table>");
 		}
 		adminReply.replace("%announces%", replyMSG.toString());
 		activeChar.sendPacket(adminReply);
@@ -139,8 +135,7 @@ public class Announcements
 		final StringBuilder replyMSG = StringUtil.startAppend(500, "<br>");
 		for (int i = 0; i < _critAnnouncements.size(); i++)
 		{
-			StringUtil.append(replyMSG, "<table width=260><tr><td width=220>", _critAnnouncements.get(i), "</td><td width=40>"
-					+ "<button value=\"Delete\" action=\"bypass -h admin_del_critannouncement ", String.valueOf(i), "\" width=60 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table>");
+			StringUtil.append(replyMSG, "<table width=260><tr><td width=220>", _critAnnouncements.get(i), "</td><td width=40>" + "<button value=\"Delete\" action=\"bypass -h admin_del_critannouncement ", String.valueOf(i), "\" width=60 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table>");
 		}
 		adminReply.replace("%critannounces%", replyMSG.toString());
 		activeChar.sendPacket(adminReply);

+ 4 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/CastleUpdater.java

@@ -23,7 +23,6 @@ import com.l2jserver.gameserver.model.L2Clan;
 import com.l2jserver.gameserver.model.entity.Castle;
 import com.l2jserver.gameserver.model.itemcontainer.ItemContainer;
 
-
 /**
  * Class managing periodical events with castle
  * @author Thorgrim - 2005
@@ -31,7 +30,7 @@ import com.l2jserver.gameserver.model.itemcontainer.ItemContainer;
 public class CastleUpdater implements Runnable
 {
 	protected static final Logger _log = Logger.getLogger(CastleUpdater.class.getName());
-	private L2Clan _clan;
+	private final L2Clan _clan;
 	private int _runCount = 0;
 	
 	public CastleUpdater(L2Clan clan, int runCount)
@@ -52,12 +51,14 @@ public class CastleUpdater implements Runnable
 				Castle castle = CastleManager.getInstance().getCastleById(_clan.getCastleId());
 				if (!Config.ALT_MANOR_SAVE_ALL_ACTIONS)
 				{
-					if (_runCount % Config.ALT_MANOR_SAVE_PERIOD_RATE == 0)
+					if ((_runCount % Config.ALT_MANOR_SAVE_PERIOD_RATE) == 0)
 					{
 						castle.saveSeedData();
 						castle.saveCropData();
 						if (Config.DEBUG)
+						{
 							_log.info("Manor System: all data for " + castle.getName() + " saved");
+						}
 					}
 				}
 				CastleUpdater cu = new CastleUpdater(_clan, ++_runCount);

+ 13 - 7
L2J_Server_BETA/java/com/l2jserver/gameserver/FortUpdater.java

@@ -29,10 +29,10 @@ import com.l2jserver.gameserver.model.itemcontainer.PcInventory;
 public class FortUpdater implements Runnable
 {
 	protected static Logger _log = Logger.getLogger(FortUpdater.class.getName());
-	private L2Clan _clan;
-	private Fort _fort;
+	private final L2Clan _clan;
+	private final Fort _fort;
 	private int _runCount;
-	private UpdaterType _updaterType;
+	private final UpdaterType _updaterType;
 	
 	public enum UpdaterType
 	{
@@ -53,12 +53,14 @@ public class FortUpdater implements Runnable
 	{
 		try
 		{
-			switch(_updaterType)
+			switch (_updaterType)
 			{
 				case PERIODIC_UPDATE:
 					_runCount++;
-					if (_fort.getOwnerClan() == null || _fort.getOwnerClan() != _clan)
+					if ((_fort.getOwnerClan() == null) || (_fort.getOwnerClan() != _clan))
+					{
 						return;
+					}
 					
 					_fort.setBloodOathReward(_fort.getBloodOathReward() + Config.FS_BLOOD_OATH_COUNT);
 					if (_fort.getFortState() == 2)
@@ -70,14 +72,18 @@ public class FortUpdater implements Runnable
 							_fort.raiseSupplyLvL();
 						}
 						else
+						{
 							_fort.setFortState(1, 0);
+						}
 					}
 					_fort.saveFortVariables();
 					break;
 				case MAX_OWN_TIME:
-					if (_fort.getOwnerClan() == null || _fort.getOwnerClan() != _clan)
+					if ((_fort.getOwnerClan() == null) || (_fort.getOwnerClan() != _clan))
+					{
 						return;
-					if (_fort.getOwnedTime() > Config.FS_MAX_OWN_TIME * 3600)
+					}
+					if (_fort.getOwnedTime() > (Config.FS_MAX_OWN_TIME * 3600))
 					{
 						_fort.removeOwner(true);
 						_fort.setFortState(0, 0);

+ 25 - 10
L2J_Server_BETA/java/com/l2jserver/gameserver/GameServer.java

@@ -132,11 +132,6 @@ import com.l2jserver.status.Status;
 import com.l2jserver.util.DeadLockDetector;
 import com.l2jserver.util.IPv4Filter;
 
-/**
- * This class ...
- * 
- * @version $Revision: 1.29.2.15.2.19 $ $Date: 2005/04/05 19:41:23 $
- */
 public class GameServer
 {
 	private static final Logger _log = Logger.getLogger(GameServer.class.getName());
@@ -246,7 +241,7 @@ public class GameServer
 		PetDataTable.getInstance();
 		CharSummonTable.getInstance().init();
 		
-		printSection("Clans"); 
+		printSection("Clans");
 		ClanTable.getInstance();
 		CHSiegeManager.getInstance();
 		ClanHallManager.getInstance();
@@ -255,7 +250,9 @@ public class GameServer
 		printSection("Geodata");
 		GeoData.getInstance();
 		if (Config.GEODATA == 2)
+		{
 			PathFinding.getInstance();
+		}
 		
 		printSection("NPCs");
 		HerbDropTable.getInstance();
@@ -314,8 +311,10 @@ public class GameServer
 		{
 			_log.info(getClass().getSimpleName() + ": Loading Server Scripts");
 			File scripts = new File(Config.DATAPACK_ROOT, "data/scripts.cfg");
-			if(!Config.ALT_DEV_NO_HANDLERS || !Config.ALT_DEV_NO_QUESTS)
+			if (!Config.ALT_DEV_NO_HANDLERS || !Config.ALT_DEV_NO_QUESTS)
+			{
 				L2ScriptEngineManager.getInstance().executeScriptList(scripts);
+			}
 		}
 		catch (IOException ioe)
 		{
@@ -326,10 +325,14 @@ public class GameServer
 		TransformationManager.getInstance().report();
 		
 		if (Config.SAVE_DROPPED_ITEM)
+		{
 			ItemsOnGroundManager.getInstance();
+		}
 		
-		if (Config.AUTODESTROY_ITEM_AFTER > 0 || Config.HERB_AUTO_DESTROY_TIME > 0)
+		if ((Config.AUTODESTROY_ITEM_AFTER > 0) || (Config.HERB_AUTO_DESTROY_TIME > 0))
+		{
 			ItemsAutoDestroy.getInstance();
+		}
 		
 		MonsterRace.getInstance();
 		
@@ -345,20 +348,26 @@ public class GameServer
 		_log.info("AutoSpawnHandler: Loaded " + AutoSpawnHandler.getInstance().size() + " handlers in total.");
 		
 		if (Config.L2JMOD_ALLOW_WEDDING)
+		{
 			CoupleManager.getInstance();
+		}
 		
 		TaskManager.getInstance();
-
+		
 		AntiFeedManager.getInstance().registerEvent(AntiFeedManager.GAME_ID);
 		MerchantPriceConfigTable.getInstance().updateReferences();
 		CastleManager.getInstance().activateInstances();
 		FortManager.getInstance().activateInstances();
 		
 		if (Config.ALLOW_MAIL)
+		{
 			MailManager.getInstance();
+		}
 		
 		if (Config.ACCEPT_GEOEDITOR_CONN)
+		{
 			GeoEditorListener.getInstance();
+		}
 		
 		Runtime.getRuntime().addShutdownHook(Shutdown.getInstance());
 		
@@ -368,7 +377,9 @@ public class GameServer
 		KnownListUpdateTaskManager.getInstance();
 		
 		if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
+		{
 			OfflineTradersTable.getInstance().restoreOfflineTraders();
+		}
 		
 		if (Config.DEADLOCK_DETECTOR)
 		{
@@ -377,12 +388,14 @@ public class GameServer
 			_deadDetectThread.start();
 		}
 		else
+		{
 			_deadDetectThread = null;
+		}
 		System.gc();
 		// maxMemory is the upper limit the jvm can use, totalMemory the size of
 		// the current allocation pool, freeMemory the unused memory in the
 		// allocation pool
-		long freeMem = (Runtime.getRuntime().maxMemory() - Runtime.getRuntime().totalMemory() + Runtime.getRuntime().freeMemory()) / 1048576;
+		long freeMem = ((Runtime.getRuntime().maxMemory() - Runtime.getRuntime().totalMemory()) + Runtime.getRuntime().freeMemory()) / 1048576;
 		long totalMem = Runtime.getRuntime().maxMemory() / 1048576;
 		_log.info(getClass().getSimpleName() + ": Started, free memory " + freeMem + " Mb of " + totalMem + " Mb");
 		Toolkit.getDefaultToolkit().beep();
@@ -471,7 +484,9 @@ public class GameServer
 	{
 		s = "=[ " + s + " ]";
 		while (s.length() < 78)
+		{
 			s = "-" + s;
+		}
 		_log.info(s);
 	}
 }

+ 18 - 9
L2J_Server_BETA/java/com/l2jserver/gameserver/GameTimeController.java

@@ -14,9 +14,6 @@
  */
 package com.l2jserver.gameserver;
 
-import gnu.trove.map.hash.TIntObjectHashMap;
-import gnu.trove.procedure.TObjectProcedure;
-
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -26,6 +23,9 @@ import com.l2jserver.gameserver.ai.CtrlEvent;
 import com.l2jserver.gameserver.instancemanager.DayNightSpawnManager;
 import com.l2jserver.gameserver.model.actor.L2Character;
 
+import gnu.trove.map.hash.TIntObjectHashMap;
+import gnu.trove.procedure.TObjectProcedure;
+
 /**
  * Removed TimerThread watcher [DrHouse]<br>
  * One in-game day is 240 real minutes.
@@ -107,7 +107,9 @@ public class GameTimeController
 	public void registerMovingObject(L2Character cha)
 	{
 		if (cha == null)
+		{
 			return;
+		}
 		
 		_lock.lock();
 		try
@@ -124,9 +126,8 @@ public class GameTimeController
 	 * Move all characters contained in movingObjects of GameTimeController.<br>
 	 * All characters in movement are identified in <b>movingObjects</b> of GameTimeController.<br>
 	 * <b><u> Actions</u> :</b><br>
-	 * <li>Update the position of each L2Character </li>
-	 * <li>If movement is finished, the L2Character is removed from movingObjects </li>
-	 * <li>Create a task to update the _knownObject and _knowPlayers of each L2Character that finished its movement and of their already known L2Object then notify AI with EVT_ARRIVED </li>
+	 * <li>Update the position of each L2Character</li> <li>If movement is finished, the L2Character is removed from movingObjects</li> <li>Create a task to update the _knownObject and _knowPlayers of each L2Character that finished its movement and of their already known L2Object then notify AI with
+	 * EVT_ARRIVED</li>
 	 */
 	protected void moveObjects()
 	{
@@ -185,7 +186,7 @@ public class GameTimeController
 			long runtime;
 			int sleepTime;
 			
-			for(;;)
+			for (;;)
 			{
 				try
 				{
@@ -195,22 +196,28 @@ public class GameTimeController
 					_gameTicks = (int) (runtime / MILLIS_IN_TICK); // new ticks value (ticks now)
 					
 					if (oldTicks != _gameTicks)
+					{
 						moveObjects(); // Runs possibly too often
+					}
 					
 					runtime = (System.currentTimeMillis() - _gameStartTime) - runtime;
 					
 					// calculate sleep time... time needed to next tick minus time it takes to call moveObjects()
-					sleepTime = 1 + MILLIS_IN_TICK - ((int) runtime) % MILLIS_IN_TICK;
+					sleepTime = (1 + MILLIS_IN_TICK) - (((int) runtime) % MILLIS_IN_TICK);
 					
-					//_log.finest("TICK: "+_gameTicks);
+					// _log.finest("TICK: "+_gameTicks);
 					
 					if (sleepTime > 0)
+					{
 						Thread.sleep(sleepTime);
+					}
 				}
 				catch (InterruptedException ie)
 				{
 					if (_interruptRequest)
+					{
 						return;
+					}
 					
 					_log.log(Level.WARNING, "", ie);
 				}
@@ -246,7 +253,9 @@ public class GameTimeController
 				if (_ended.hasAI()) // AI could be just disabled due to region turn off
 				{
 					if (Config.MOVE_BASED_KNOWNLIST)
+					{
 						_ended.getKnownList().findObjects();
+					}
 					_ended.getAI().notifyEvent(CtrlEvent.EVT_ARRIVED);
 				}
 			}

+ 16 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/ItemsAutoDestroy.java

@@ -25,7 +25,7 @@ import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
 import com.l2jserver.gameserver.model.items.type.L2EtcItemType;
 
 public class ItemsAutoDestroy
-{	
+{
 	protected List<L2ItemInstance> _items = null;
 	protected static long _sleep;
 	
@@ -33,8 +33,10 @@ public class ItemsAutoDestroy
 	{
 		_items = new FastList<>();
 		_sleep = Config.AUTODESTROY_ITEM_AFTER * 1000;
-		if (_sleep == 0) // it should not happend as it is not called when AUTODESTROY_ITEM_AFTER = 0 but we never know..
+		if (_sleep == 0)
+		{
 			_sleep = 3600000;
+		}
 		ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new CheckItemsForDestroy(), 5000, 5000);
 	}
 	
@@ -52,13 +54,17 @@ public class ItemsAutoDestroy
 	public synchronized void removeItems()
 	{
 		if (_items.isEmpty())
+		{
 			return;
+		}
 		
 		long curtime = System.currentTimeMillis();
 		for (L2ItemInstance item : _items)
 		{
-			if (item == null || item.getDropTime() == 0 || item.getLocation() != L2ItemInstance.ItemLocation.VOID)
+			if ((item == null) || (item.getDropTime() == 0) || (item.getLocation() != L2ItemInstance.ItemLocation.VOID))
+			{
 				_items.remove(item);
+			}
 			else
 			{
 				if (item.getItem().getAutoDestroyTime() > 0)
@@ -69,7 +75,9 @@ public class ItemsAutoDestroy
 						L2World.getInstance().removeObject(item);
 						_items.remove(item);
 						if (Config.SAVE_DROPPED_ITEM)
+						{
 							ItemsOnGroundManager.getInstance().removeObject(item);
+						}
 					}
 				}
 				else if (item.getItemType() == L2EtcItemType.HERB)
@@ -80,7 +88,9 @@ public class ItemsAutoDestroy
 						L2World.getInstance().removeObject(item);
 						_items.remove(item);
 						if (Config.SAVE_DROPPED_ITEM)
+						{
 							ItemsOnGroundManager.getInstance().removeObject(item);
+						}
 					}
 				}
 				else if ((curtime - item.getDropTime()) > _sleep)
@@ -89,10 +99,12 @@ public class ItemsAutoDestroy
 					L2World.getInstance().removeObject(item);
 					_items.remove(item);
 					if (Config.SAVE_DROPPED_ITEM)
+					{
 						ItemsOnGroundManager.getInstance().removeObject(item);
+					}
 				}
 			}
-		}		
+		}
 	}
 	
 	protected class CheckItemsForDestroy extends Thread

+ 8 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/LoginServerThread.java

@@ -78,9 +78,7 @@ public class LoginServerThread extends Thread
 	protected static final Logger _log = Logger.getLogger(LoginServerThread.class.getName());
 	protected static final Logger _logAccounting = Logger.getLogger("accounting");
 	
-	/**
-	 * @see com.l2jserver.loginserver.L2LoginServer#PROTOCOL_REV
-	 */
+	/** @see com.l2jserver.loginserver.L2LoginServer#PROTOCOL_REV */
 	private static final int REVISION = 0x0106;
 	private RSAPublicKey _publicKey;
 	private final String _hostname;
@@ -348,7 +346,7 @@ public class LoginServerThread extends Thread
 			}
 			catch (UnknownHostException e)
 			{
-				_log.log(Level.WARNING, "", e);	
+				_log.log(Level.WARNING, "", e);
 			}
 			catch (SocketException e)
 			{
@@ -556,7 +554,10 @@ public class LoginServerThread extends Thread
 		if (client != null)
 		{
 			LogRecord record = new LogRecord(Level.WARNING, "Kicked by login");
-			record.setParameters(new Object[]{client});
+			record.setParameters(new Object[]
+			{
+				client
+			});
 			_logAccounting.log(record);
 			client.setAditionalClosePacket(SystemMessage.getSystemMessage(SystemMessageId.ANOTHER_LOGIN_WITH_ACCOUNT));
 			client.closeNow();
@@ -583,7 +584,9 @@ public class LoginServerThread extends Thread
 					chars++;
 					long delTime = rs.getLong("deletetime");
 					if (delTime != 0)
+					{
 						charToDel.add(delTime);
+					}
 				}
 			}
 		}

+ 7 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/MonsterRace.java

@@ -24,15 +24,14 @@ import com.l2jserver.gameserver.model.actor.L2Npc;
 import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
 import com.l2jserver.util.Rnd;
 
-
 public class MonsterRace
 {
 	protected static final Logger _log = Logger.getLogger(MonsterRace.class.getName());
 	
-	private L2Npc[] _monsters;
+	private final L2Npc[] _monsters;
 	private Constructor<?> _constructor;
 	private int[][] _speeds;
-	private int[] _first, _second;
+	private final int[] _first, _second;
 	
 	protected MonsterRace()
 	{
@@ -78,7 +77,7 @@ public class MonsterRace
 			{
 				_log.log(Level.WARNING, "", e);
 			}
-			//_log.info("Monster "+i+" is id: "+(id+random));
+			// _log.info("Monster "+i+" is id: "+(id+random));
 		}
 		newSpeeds();
 	}
@@ -95,9 +94,13 @@ public class MonsterRace
 			for (int j = 0; j < 20; j++)
 			{
 				if (j == 19)
+				{
 					_speeds[i][j] = 100;
+				}
 				else
+				{
 					_speeds[i][j] = Rnd.get(60) + 65;
+				}
 				total += _speeds[i][j];
 			}
 			if (total >= _first[1])

+ 282 - 105
L2J_Server_BETA/java/com/l2jserver/gameserver/SevenSigns.java

@@ -14,8 +14,6 @@
  */
 package com.l2jserver.gameserver;
 
-import gnu.trove.procedure.TObjectProcedure;
-
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -49,9 +47,11 @@ import com.l2jserver.gameserver.network.serverpackets.SSQInfo;
 import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
 import com.l2jserver.gameserver.util.Broadcast;
 
+import gnu.trove.procedure.TObjectProcedure;
+
 /**
- *  Seven Signs Engine
- *  @author Tempy
+ * Seven Signs engine.
+ * @author Tempy
  */
 public class SevenSigns
 {
@@ -103,7 +103,12 @@ public class SevenSigns
 	public static final int SEAL_STONE_GREEN_ID = 6361;
 	public static final int SEAL_STONE_RED_ID = 6362;
 	
-	public static final int[] SEAL_STONE_IDS = { SEAL_STONE_BLUE_ID, SEAL_STONE_GREEN_ID, SEAL_STONE_RED_ID };
+	public static final int[] SEAL_STONE_IDS =
+	{
+		SEAL_STONE_BLUE_ID,
+		SEAL_STONE_GREEN_ID,
+		SEAL_STONE_RED_ID
+	};
 	
 	public static final int SEAL_STONE_BLUE_VALUE = 3;
 	public static final int SEAL_STONE_GREEN_VALUE = 5;
@@ -127,9 +132,9 @@ public class SevenSigns
 	
 	protected Map<Integer, StatsSet> _signsPlayerData;
 	
-	private Map<Integer, Integer> _signsSealOwners;
-	private Map<Integer, Integer> _signsDuskSealTotals;
-	private Map<Integer, Integer> _signsDawnSealTotals;
+	private final Map<Integer, Integer> _signsSealOwners;
+	private final Map<Integer, Integer> _signsDuskSealTotals;
+	private final Map<Integer, Integer> _signsDawnSealTotals;
 	
 	private AutoSpawnInstance _merchantSpawn;
 	private AutoSpawnInstance _blacksmithSpawn;
@@ -141,26 +146,15 @@ public class SevenSigns
 	private Map<Integer, AutoSpawnInstance> _preacherSpawns;
 	private Map<Integer, AutoSpawnInstance> _marketeerSpawns;
 	
-	private static final String LOAD_DATA =
-		"SELECT charId, cabal, seal, red_stones, green_stones, blue_stones, " +
-		"ancient_adena_amount, contribution_score FROM seven_signs";
+	private static final String LOAD_DATA = "SELECT charId, cabal, seal, red_stones, green_stones, blue_stones, " + "ancient_adena_amount, contribution_score FROM seven_signs";
 	
 	private static final String LOAD_STATUS = "SELECT * FROM seven_signs_status WHERE id=0";
 	
-	private static final String INSERT_PLAYER =
-		"INSERT INTO seven_signs (charId, cabal, seal) VALUES (?,?,?)";
+	private static final String INSERT_PLAYER = "INSERT INTO seven_signs (charId, cabal, seal) VALUES (?,?,?)";
 	
-	private static final String UPDATE_PLAYER =
-		"UPDATE seven_signs SET cabal=?, seal=?, red_stones=?, green_stones=?, blue_stones=?, " +
-		"ancient_adena_amount=?, contribution_score=? WHERE charId=?";
+	private static final String UPDATE_PLAYER = "UPDATE seven_signs SET cabal=?, seal=?, red_stones=?, green_stones=?, blue_stones=?, " + "ancient_adena_amount=?, contribution_score=? WHERE charId=?";
 	
-	private static final String UPDATE_STATUS =
-		"UPDATE seven_signs_status SET current_cycle=?, active_period=?, previous_winner=?, " +
-		"dawn_stone_score=?, dawn_festival_score=?, dusk_stone_score=?, dusk_festival_score=?, " +
-		"avarice_owner=?, gnosis_owner=?, strife_owner=?, avarice_dawn_score=?, gnosis_dawn_score=?, " +
-		"strife_dawn_score=?, avarice_dusk_score=?, gnosis_dusk_score=?, strife_dusk_score=?, " +
-		"festival_cycle=?, accumulated_bonus0=?, accumulated_bonus1=?, accumulated_bonus2=?," +
-		"accumulated_bonus3=?, accumulated_bonus4=?, date=? WHERE id=0";
+	private static final String UPDATE_STATUS = "UPDATE seven_signs_status SET current_cycle=?, active_period=?, previous_winner=?, " + "dawn_stone_score=?, dawn_festival_score=?, dusk_stone_score=?, dusk_festival_score=?, " + "avarice_owner=?, gnosis_owner=?, strife_owner=?, avarice_dawn_score=?, gnosis_dawn_score=?, " + "strife_dawn_score=?, avarice_dusk_score=?, gnosis_dusk_score=?, strife_dusk_score=?, " + "festival_cycle=?, accumulated_bonus0=?, accumulated_bonus1=?, accumulated_bonus2=?," + "accumulated_bonus3=?, accumulated_bonus4=?, date=? WHERE id=0";
 	
 	protected SevenSigns()
 	{
@@ -182,14 +176,24 @@ public class SevenSigns
 		initializeSeals();
 		
 		if (isSealValidationPeriod())
+		{
 			if (getCabalHighestScore() == CABAL_NULL)
+			{
 				_log.info("SevenSigns: The competition ended with a tie last week.");
+			}
 			else
+			{
 				_log.info("SevenSigns: The " + getCabalName(getCabalHighestScore()) + " were victorious last week.");
+			}
+		}
 		else if (getCabalHighestScore() == CABAL_NULL)
+		{
 			_log.info("SevenSigns: The competition, if the current trend continues, will end in a tie this week.");
+		}
 		else
+		{
 			_log.info("SevenSigns: The " + getCabalName(getCabalHighestScore()) + " are in the lead this week.");
+		}
 		
 		long milliToChange = 0;
 		if (isNextPeriodChangeInPast())
@@ -202,7 +206,6 @@ public class SevenSigns
 			milliToChange = getMilliToPeriodChange();
 		}
 		
-		
 		// Schedule a time for the next period change.
 		SevenSignsPeriodChange sspc = new SevenSignsPeriodChange();
 		ThreadPoolManager.getInstance().scheduleGeneral(sspc, milliToChange);
@@ -232,7 +235,9 @@ public class SevenSigns
 				lastPeriodChange.set(Calendar.SECOND, 0);
 				// if we hit next week, just turn back 1 week
 				if (Calendar.getInstance().before(lastPeriodChange))
-					lastPeriodChange.add(Calendar.HOUR, -24*7);
+				{
+					lastPeriodChange.add(Calendar.HOUR, -24 * 7);
+				}
 				break;
 			case PERIOD_COMP_RECRUITING:
 			case PERIOD_COMP_RESULTS:
@@ -242,16 +247,15 @@ public class SevenSigns
 		}
 		
 		// because of previous "date" column usage, check only if it already contains usable data for us
-		if (_lastSave.getTimeInMillis() > 7 && _lastSave.before(lastPeriodChange))
+		if ((_lastSave.getTimeInMillis() > 7) && _lastSave.before(lastPeriodChange))
+		{
 			return true;
+		}
 		return false;
 	}
 	
 	/**
-	 * Registers all random spawns and auto-chats for Seven Signs NPCs,
-	 * along with spawns for the Preachers of Doom and Orators of Revelations
-	 * at the beginning of the Seal Validation period.
-	 *
+	 * Registers all random spawns and auto-chats for Seven Signs NPCs, along with spawns for the Preachers of Doom and Orators of Revelations at the beginning of the Seal Validation period.
 	 */
 	public void spawnSevenSignsNPC()
 	{
@@ -268,60 +272,85 @@ public class SevenSigns
 		if (isSealValidationPeriod() || isCompResultsPeriod())
 		{
 			for (AutoSpawnInstance spawnInst : _marketeerSpawns.values())
+			{
 				AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, true);
+			}
 			
-			if (getSealOwner(SEAL_GNOSIS) == getCabalHighestScore() && getSealOwner(SEAL_GNOSIS) != CABAL_NULL)
+			if ((getSealOwner(SEAL_GNOSIS) == getCabalHighestScore()) && (getSealOwner(SEAL_GNOSIS) != CABAL_NULL))
 			{
 				if (!Config.ANNOUNCE_MAMMON_SPAWN)
+				{
 					_blacksmithSpawn.setBroadcast(false);
+				}
 				
 				if (!AutoSpawnHandler.getInstance().getAutoSpawnInstance(_blacksmithSpawn.getObjectId(), true).isSpawnActive())
+				{
 					AutoSpawnHandler.getInstance().setSpawnActive(_blacksmithSpawn, true);
+				}
 				
 				for (AutoSpawnInstance spawnInst : _oratorSpawns.values())
+				{
 					if (!AutoSpawnHandler.getInstance().getAutoSpawnInstance(spawnInst.getObjectId(), true).isSpawnActive())
+					{
 						AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, true);
+					}
+				}
 				
 				for (AutoSpawnInstance spawnInst : _preacherSpawns.values())
+				{
 					if (!AutoSpawnHandler.getInstance().getAutoSpawnInstance(spawnInst.getObjectId(), true).isSpawnActive())
+					{
 						AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, true);
+					}
+				}
 				
-				if (!AutoChatHandler.getInstance().getAutoChatInstance(PREACHER_NPC_ID, false).isActive()
-						&& !AutoChatHandler.getInstance().getAutoChatInstance(ORATOR_NPC_ID, false).isActive())
+				if (!AutoChatHandler.getInstance().getAutoChatInstance(PREACHER_NPC_ID, false).isActive() && !AutoChatHandler.getInstance().getAutoChatInstance(ORATOR_NPC_ID, false).isActive())
+				{
 					AutoChatHandler.getInstance().setAutoChatActive(true);
+				}
 			}
 			else
 			{
 				AutoSpawnHandler.getInstance().setSpawnActive(_blacksmithSpawn, false);
 				
 				for (AutoSpawnInstance spawnInst : _oratorSpawns.values())
+				{
 					AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, false);
+				}
 				
 				for (AutoSpawnInstance spawnInst : _preacherSpawns.values())
+				{
 					AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, false);
+				}
 				
 				AutoChatHandler.getInstance().setAutoChatActive(false);
 			}
 			
-			if (getSealOwner(SEAL_AVARICE) == getCabalHighestScore() && getSealOwner(SEAL_AVARICE) != CABAL_NULL)
+			if ((getSealOwner(SEAL_AVARICE) == getCabalHighestScore()) && (getSealOwner(SEAL_AVARICE) != CABAL_NULL))
 			{
 				if (!Config.ANNOUNCE_MAMMON_SPAWN)
+				{
 					_merchantSpawn.setBroadcast(false);
+				}
 				
 				if (!AutoSpawnHandler.getInstance().getAutoSpawnInstance(_merchantSpawn.getObjectId(), true).isSpawnActive())
+				{
 					AutoSpawnHandler.getInstance().setSpawnActive(_merchantSpawn, true);
+				}
 				
 				switch (getCabalHighestScore())
 				{
 					case CABAL_DAWN:
 						if (!AutoSpawnHandler.getInstance().getAutoSpawnInstance(_lilithSpawn.getObjectId(), true).isSpawnActive())
+						{
 							AutoSpawnHandler.getInstance().setSpawnActive(_lilithSpawn, true);
+						}
 						
 						AutoSpawnHandler.getInstance().setSpawnActive(_anakimSpawn, false);
 						
 						for (AutoSpawnInstance dawnCrest : _crestofdawnspawns.values())
 						{
-							if(!AutoSpawnHandler.getInstance().getAutoSpawnInstance(dawnCrest.getObjectId(), true).isSpawnActive())
+							if (!AutoSpawnHandler.getInstance().getAutoSpawnInstance(dawnCrest.getObjectId(), true).isSpawnActive())
 							{
 								AutoSpawnHandler.getInstance().setSpawnActive(dawnCrest, true);
 							}
@@ -332,16 +361,18 @@ public class SevenSigns
 							AutoSpawnHandler.getInstance().setSpawnActive(duskCrest, false);
 						}
 						break;
-						
+					
 					case CABAL_DUSK:
 						if (!AutoSpawnHandler.getInstance().getAutoSpawnInstance(_anakimSpawn.getObjectId(), true).isSpawnActive())
+						{
 							AutoSpawnHandler.getInstance().setSpawnActive(_anakimSpawn, true);
+						}
 						
 						AutoSpawnHandler.getInstance().setSpawnActive(_lilithSpawn, false);
 						
 						for (AutoSpawnInstance duskCrest : _crestofduskspawns.values())
 						{
-							if(!AutoSpawnHandler.getInstance().getAutoSpawnInstance(duskCrest.getObjectId(), true).isSpawnActive())
+							if (!AutoSpawnHandler.getInstance().getAutoSpawnInstance(duskCrest.getObjectId(), true).isSpawnActive())
 							{
 								AutoSpawnHandler.getInstance().setSpawnActive(duskCrest, true);
 							}
@@ -384,13 +415,19 @@ public class SevenSigns
 				AutoSpawnHandler.getInstance().setSpawnActive(duskCrest, false);
 			}
 			for (AutoSpawnInstance spawnInst : _oratorSpawns.values())
+			{
 				AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, false);
+			}
 			
 			for (AutoSpawnInstance spawnInst : _preacherSpawns.values())
+			{
 				AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, false);
+			}
 			
 			for (AutoSpawnInstance spawnInst : _marketeerSpawns.values())
+			{
 				AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, false);
+			}
 			
 			AutoChatHandler.getInstance().setAutoChatActive(false);
 		}
@@ -480,7 +517,9 @@ public class SevenSigns
 		int numDays = _nextPeriodChange.get(Calendar.DAY_OF_WEEK) - PERIOD_START_DAY;
 		
 		if (numDays < 0)
+		{
 			return 0 - numDays;
+		}
 		
 		return 7 - numDays;
 	}
@@ -504,14 +543,22 @@ public class SevenSigns
 				int daysToChange = getDaysToPeriodChange();
 				
 				if (daysToChange == 7)
+				{
 					if (_nextPeriodChange.get(Calendar.HOUR_OF_DAY) < PERIOD_START_HOUR)
+					{
 						daysToChange = 0;
-					else if (_nextPeriodChange.get(Calendar.HOUR_OF_DAY) == PERIOD_START_HOUR && _nextPeriodChange.get(Calendar.MINUTE) < PERIOD_START_MINS)
+					}
+					else if ((_nextPeriodChange.get(Calendar.HOUR_OF_DAY) == PERIOD_START_HOUR) && (_nextPeriodChange.get(Calendar.MINUTE) < PERIOD_START_MINS))
+					{
 						daysToChange = 0;
+					}
+				}
 				
 				// Otherwise...
 				if (daysToChange > 0)
+				{
 					_nextPeriodChange.add(Calendar.DATE, daysToChange);
+				}
 				
 				_nextPeriodChange.set(Calendar.HOUR_OF_DAY, PERIOD_START_HOUR);
 				_nextPeriodChange.set(Calendar.MINUTE, PERIOD_START_MINS);
@@ -560,7 +607,7 @@ public class SevenSigns
 	/**
 	 * returns true if the given date is in Seal Validation or in Quest Event Results period
 	 * @param date
-	 * @return 
+	 * @return
 	 */
 	public boolean isDateInSealValidPeriod(Calendar date)
 	{
@@ -568,10 +615,14 @@ public class SevenSigns
 		long nextQuestStart = 0;
 		long nextValidStart = 0;
 		long tillDate = date.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
-		while ((2 * PERIOD_MAJOR_LENGTH + 2 * PERIOD_MINOR_LENGTH) < tillDate)
-			tillDate -= (2 * PERIOD_MAJOR_LENGTH + 2 * PERIOD_MINOR_LENGTH);
+		while (((2 * PERIOD_MAJOR_LENGTH) + (2 * PERIOD_MINOR_LENGTH)) < tillDate)
+		{
+			tillDate -= ((2 * PERIOD_MAJOR_LENGTH) + (2 * PERIOD_MINOR_LENGTH));
+		}
 		while (tillDate < 0)
-			tillDate += (2 * PERIOD_MAJOR_LENGTH + 2 * PERIOD_MINOR_LENGTH);
+		{
+			tillDate += ((2 * PERIOD_MAJOR_LENGTH) + (2 * PERIOD_MINOR_LENGTH));
+		}
 		
 		switch (getCurrentPeriod())
 		{
@@ -593,9 +644,10 @@ public class SevenSigns
 				break;
 		}
 		
-		if ((nextQuestStart < tillDate && tillDate < nextValidStart)
-				|| (nextValidStart < nextQuestStart && (tillDate < nextValidStart || nextQuestStart < tillDate)))
+		if (((nextQuestStart < tillDate) && (tillDate < nextValidStart)) || ((nextValidStart < nextQuestStart) && ((tillDate < nextValidStart) || (nextQuestStart < tillDate))))
+		{
 			return false;
+		}
 		return true;
 	}
 	
@@ -608,11 +660,9 @@ public class SevenSigns
 			case CABAL_NULL:
 				return 0;
 			case CABAL_DAWN:
-				return Math.round((float) (_dawnStoneScore / ((float) totalStoneScore == 0 ? 1 : totalStoneScore)) * 500)
-				+ _dawnFestivalScore;
+				return Math.round((float) (_dawnStoneScore / ((float) totalStoneScore == 0 ? 1 : totalStoneScore)) * 500) + _dawnFestivalScore;
 			case CABAL_DUSK:
-				return Math.round((float) (_duskStoneScore / ((float) totalStoneScore == 0 ? 1 : totalStoneScore)) * 500)
-				+ _duskFestivalScore;
+				return Math.round((float) (_duskStoneScore / ((float) totalStoneScore == 0 ? 1 : totalStoneScore)) * 500) + _duskFestivalScore;
 		}
 		
 		return 0;
@@ -651,11 +701,17 @@ public class SevenSigns
 	public final int getCabalHighestScore()
 	{
 		if (getCurrentScore(CABAL_DUSK) == getCurrentScore(CABAL_DAWN))
+		{
 			return CABAL_NULL;
+		}
 		else if (getCurrentScore(CABAL_DUSK) > getCurrentScore(CABAL_DAWN))
+		{
 			return CABAL_DUSK;
+		}
 		else
+		{
 			return CABAL_DAWN;
+		}
 	}
 	
 	public final int getSealOwner(int seal)
@@ -666,11 +722,17 @@ public class SevenSigns
 	public final int getSealProportion(int seal, int cabal)
 	{
 		if (cabal == CABAL_NULL)
+		{
 			return 0;
+		}
 		else if (cabal == CABAL_DUSK)
+		{
 			return _signsDuskSealTotals.get(seal);
+		}
 		else
+		{
 			return _signsDawnSealTotals.get(seal);
+		}
 	}
 	
 	public final int getTotalMembers(int cabal)
@@ -679,8 +741,12 @@ public class SevenSigns
 		String cabalName = getCabalShortName(cabal);
 		
 		for (StatsSet sevenDat : _signsPlayerData.values())
+		{
 			if (sevenDat.getString("cabal").equals(cabalName))
+			{
 				cabalMembers++;
+			}
+		}
 		
 		return cabalMembers;
 	}
@@ -689,7 +755,9 @@ public class SevenSigns
 	{
 		final StatsSet currPlayer = _signsPlayerData.get(objectId);
 		if (currPlayer == null)
+		{
 			return 0;
+		}
 		
 		int stoneCount = 0;
 		stoneCount += currPlayer.getInteger("red_stones");
@@ -703,7 +771,9 @@ public class SevenSigns
 	{
 		final StatsSet currPlayer = _signsPlayerData.get(objectId);
 		if (currPlayer == null)
+		{
 			return 0;
+		}
 		
 		return currPlayer.getInteger("contribution_score");
 	}
@@ -712,7 +782,9 @@ public class SevenSigns
 	{
 		final StatsSet currPlayer = _signsPlayerData.get(objectId);
 		if (currPlayer == null)
+		{
 			return 0;
+		}
 		
 		return currPlayer.getInteger("ancient_adena_amount");
 	}
@@ -721,7 +793,9 @@ public class SevenSigns
 	{
 		final StatsSet currPlayer = _signsPlayerData.get(objectId);
 		if (currPlayer == null)
+		{
 			return SEAL_NULL;
+		}
 		
 		return currPlayer.getInteger("seal");
 	}
@@ -730,15 +804,23 @@ public class SevenSigns
 	{
 		final StatsSet currPlayer = _signsPlayerData.get(objectId);
 		if (currPlayer == null)
+		{
 			return CABAL_NULL;
+		}
 		
 		String playerCabal = currPlayer.getString("cabal");
 		if (playerCabal.equalsIgnoreCase("dawn"))
+		{
 			return CABAL_DAWN;
+		}
 		else if (playerCabal.equalsIgnoreCase("dusk"))
+		{
 			return CABAL_DUSK;
+		}
 		else
+		{
 			return CABAL_NULL;
+		}
 	}
 	
 	/**
@@ -812,7 +894,7 @@ public class SevenSigns
 	 * Should be called on period change and shutdown only.
 	 */
 	public void saveSevenSignsData()
-	{	
+	{
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
 			PreparedStatement ps = con.prepareStatement(UPDATE_PLAYER))
 		{
@@ -840,7 +922,9 @@ public class SevenSigns
 	{
 		StatsSet sevenDat = _signsPlayerData.get(objectId);
 		if (sevenDat == null)
+		{
 			return;
+		}
 		
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
 			PreparedStatement ps = con.prepareStatement(UPDATE_PLAYER))
@@ -903,7 +987,7 @@ public class SevenSigns
 	 * Primarily used when beginning a new cycle, and should otherwise never be called.
 	 */
 	protected void resetPlayerData()
-	{	
+	{
 		int charObjId;
 		
 		// Reset each player's contribution data as well as seal and cabal.
@@ -972,20 +1056,25 @@ public class SevenSigns
 		
 		// Increasing Seal total score for the player chosen Seal.
 		if ("dawn".equals(currPlayerData.getString("cabal")))
+		{
 			_signsDawnSealTotals.put(chosenSeal, _signsDawnSealTotals.get(chosenSeal) + 1);
+		}
 		else
+		{
 			_signsDuskSealTotals.put(chosenSeal, _signsDuskSealTotals.get(chosenSeal) + 1);
+		}
 		
 		if (!Config.ALT_SEVENSIGNS_LAZY_UPDATE)
+		{
 			saveSevenSignsStatus();
+		}
 		
 		return chosenCabal;
 	}
 	
 	/**
 	 * Returns the amount of ancient adena the specified player can claim, if any.<BR>
-	 * If removeReward = True, all the ancient adena owed to them is removed, then
-	 * DB is updated.
+	 * If removeReward = True, all the ancient adena owed to them is removed, then DB is updated.
 	 * @param objectId
 	 * @param removeReward
 	 * @return
@@ -1014,10 +1103,8 @@ public class SevenSigns
 	}
 	
 	/**
-	 * Used to add the specified player's seal stone contribution points
-	 * to the current total for their cabal. Returns the point score the
-	 * contribution was worth.<br>
-	 *
+	 * Used to add the specified player's seal stone contribution points to the current total for their cabal.<br>
+	 * Returns the point score the contribution was worth.<br>
 	 * Each stone count <B>must be</B> broken down and specified by the stone's color.
 	 * @param objectId
 	 * @param blueCount
@@ -1034,7 +1121,9 @@ public class SevenSigns
 		long totalContribScore = currPlayer.getLong("contribution_score") + contribScore;
 		
 		if (totalContribScore > Config.ALT_MAXIMUM_PLAYER_CONTRIB)
+		{
 			return -1;
+		}
 		
 		currPlayer.set("red_stones", currPlayer.getInteger("red_stones") + redCount);
 		currPlayer.set("green_stones", currPlayer.getInteger("green_stones") + greenCount);
@@ -1063,10 +1152,8 @@ public class SevenSigns
 	}
 	
 	/**
-	 * Adds the specified number of festival points to the specified cabal.
-	 * Remember, the same number of points are <B>deducted from the rival cabal</B>
-	 * to maintain proportionality.
-	 *
+	 * Adds the specified number of festival points to the specified cabal.<br>
+	 * Remember, the same number of points are <b>deducted from the rival cabal</b> to maintain proportionality.
 	 * @param cabal
 	 * @param amount
 	 */
@@ -1078,20 +1165,23 @@ public class SevenSigns
 			
 			// To prevent negative scores!
 			if (_dawnFestivalScore >= amount)
+			{
 				_dawnFestivalScore -= amount;
+			}
 		}
 		else
 		{
 			_dawnFestivalScore += amount;
 			
 			if (_duskFestivalScore >= amount)
+			{
 				_duskFestivalScore -= amount;
+			}
 		}
 	}
 	
 	/**
 	 * Send info on the current Seven Signs period to the specified player.
-	 *
 	 * @param player
 	 */
 	public void sendCurrentPeriodMsg(L2PcInstance player)
@@ -1119,7 +1209,6 @@ public class SevenSigns
 	
 	/**
 	 * Sends the built-in system message specified by sysMsgId to all online players.
-	 *
 	 * @param sysMsgId
 	 */
 	public void sendMessageToAll(SystemMessageId sysMsgId)
@@ -1129,8 +1218,9 @@ public class SevenSigns
 	}
 	
 	/**
-	 * Used to initialize the seals for each cabal. (Used at startup or at beginning of a new cycle).
-	 * This method should  be called after <B>resetSeals()</B> and <B>calcNewSealOwners()</B> on a new cycle.
+	 * Used to initialize the seals for each cabal.<bR>
+	 * (Used at startup or at beginning of a new cycle).<br>
+	 * This method should be called after <b>resetSeals()</b> and <b>calcNewSealOwners()</b> on a new cycle.
 	 */
 	protected void initializeSeals()
 	{
@@ -1139,12 +1229,20 @@ public class SevenSigns
 			int sealOwner = _signsSealOwners.get(currSeal);
 			
 			if (sealOwner != CABAL_NULL)
+			{
 				if (isSealValidationPeriod())
+				{
 					_log.info("SevenSigns: The " + getCabalName(sealOwner) + " have won the " + getSealName(currSeal, false) + ".");
+				}
 				else
+				{
 					_log.info("SevenSigns: The " + getSealName(currSeal, false) + " is currently owned by " + getCabalName(sealOwner) + ".");
+				}
+			}
 			else
+			{
 				_log.info("SevenSigns: The " + getSealName(currSeal, false) + " remains unclaimed.");
+			}
 		}
 	}
 	
@@ -1162,13 +1260,12 @@ public class SevenSigns
 	}
 	
 	/**
-	 * Calculates the ownership of the three Seals of the Seven Signs,
-	 * based on various criterion.
-	 * <BR><BR>
+	 * Calculates the ownership of the three Seals of the Seven Signs, based on various criterion. <BR>
+	 * <BR>
 	 * Should only ever called at the beginning of a new cycle.
 	 */
 	protected void calcNewSealOwners()
-	{	
+	{
 		for (Integer currSeal : _signsDawnSealTotals.keySet())
 		{
 			int prevSealOwner = _signsSealOwners.get(currSeal);
@@ -1180,14 +1277,11 @@ public class SevenSigns
 			int totalDuskMembers = getTotalMembers(CABAL_DUSK) == 0 ? 1 : getTotalMembers(CABAL_DUSK);
 			int duskPercent = Math.round(((float) duskProportion / (float) totalDuskMembers) * 100);
 			
-			/*
-			 * - If a Seal was already closed or owned by the opponent and the new winner wants
-			 *   to assume ownership of the Seal, 35% or more of the members of the Cabal must
-			 *   have chosen the Seal. If they chose less than 35%, they cannot own the Seal.
-			 *
-			 * - If the Seal was owned by the winner in the previous Seven Signs, they can retain
-			 *   that seal if 10% or more members have chosen it. If they want to possess a new Seal,
-			 *   at least 35% of the members of the Cabal must have chosen the new Seal.
+			/**
+			 * If a Seal was already closed or owned by the opponent and the new winner wants to assume ownership of the Seal, 35% or more of the members of the Cabal must have chosen the Seal.<br>
+			 * If they chose less than 35%, they cannot own the Seal.<br>
+			 * If the Seal was owned by the winner in the previous Seven Signs, they can retain that seal if 10% or more members have chosen it.<br>
+			 * If they want to possess a new Seal, at least 35% of the members of the Cabal must have chosen the new Seal.
 			 */
 			switch (prevSealOwner)
 			{
@@ -1199,15 +1293,23 @@ public class SevenSigns
 							break;
 						case CABAL_DAWN:
 							if (dawnPercent >= 35)
+							{
 								newSealOwner = CABAL_DAWN;
+							}
 							else
+							{
 								newSealOwner = CABAL_NULL;
+							}
 							break;
 						case CABAL_DUSK:
 							if (duskPercent >= 35)
+							{
 								newSealOwner = CABAL_DUSK;
+							}
 							else
+							{
 								newSealOwner = CABAL_NULL;
+							}
 							break;
 					}
 					break;
@@ -1216,23 +1318,37 @@ public class SevenSigns
 					{
 						case CABAL_NULL:
 							if (dawnPercent >= 10)
+							{
 								newSealOwner = CABAL_DAWN;
+							}
 							else
+							{
 								newSealOwner = CABAL_NULL;
+							}
 							break;
 						case CABAL_DAWN:
 							if (dawnPercent >= 10)
+							{
 								newSealOwner = CABAL_DAWN;
+							}
 							else
+							{
 								newSealOwner = CABAL_NULL;
+							}
 							break;
 						case CABAL_DUSK:
 							if (duskPercent >= 35)
+							{
 								newSealOwner = CABAL_DUSK;
+							}
 							else if (dawnPercent >= 10)
+							{
 								newSealOwner = CABAL_DAWN;
+							}
 							else
+							{
 								newSealOwner = CABAL_NULL;
+							}
 							break;
 					}
 					break;
@@ -1241,23 +1357,37 @@ public class SevenSigns
 					{
 						case CABAL_NULL:
 							if (duskPercent >= 10)
+							{
 								newSealOwner = CABAL_DUSK;
+							}
 							else
+							{
 								newSealOwner = CABAL_NULL;
+							}
 							break;
 						case CABAL_DAWN:
 							if (dawnPercent >= 35)
+							{
 								newSealOwner = CABAL_DAWN;
+							}
 							else if (duskPercent >= 10)
+							{
 								newSealOwner = CABAL_DUSK;
+							}
 							else
+							{
 								newSealOwner = CABAL_NULL;
+							}
 							break;
 						case CABAL_DUSK:
 							if (duskPercent >= 10)
+							{
 								newSealOwner = CABAL_DUSK;
+							}
 							else
+							{
 								newSealOwner = CABAL_NULL;
+							}
 							break;
 					}
 					break;
@@ -1270,21 +1400,33 @@ public class SevenSigns
 			{
 				case SEAL_AVARICE:
 					if (newSealOwner == CABAL_DAWN)
+					{
 						sendMessageToAll(SystemMessageId.DAWN_OBTAINED_AVARICE);
+					}
 					else if (newSealOwner == CABAL_DUSK)
+					{
 						sendMessageToAll(SystemMessageId.DUSK_OBTAINED_AVARICE);
+					}
 					break;
 				case SEAL_GNOSIS:
 					if (newSealOwner == CABAL_DAWN)
+					{
 						sendMessageToAll(SystemMessageId.DAWN_OBTAINED_GNOSIS);
+					}
 					else if (newSealOwner == CABAL_DUSK)
+					{
 						sendMessageToAll(SystemMessageId.DUSK_OBTAINED_GNOSIS);
+					}
 					break;
 				case SEAL_STRIFE:
 					if (newSealOwner == CABAL_DAWN)
+					{
 						sendMessageToAll(SystemMessageId.DAWN_OBTAINED_STRIFE);
+					}
 					else if (newSealOwner == CABAL_DUSK)
+					{
 						sendMessageToAll(SystemMessageId.DUSK_OBTAINED_STRIFE);
+					}
 					
 					CastleManager.getInstance().validateTaxes(newSealOwner);
 					break;
@@ -1295,7 +1437,7 @@ public class SevenSigns
 	/**
 	 * This method is called to remove all players from catacombs and necropolises, who belong to the losing cabal.<br>
 	 * Should only ever called at the beginning of Seal Validation.
-	 * @param compWinner 
+	 * @param compWinner
 	 */
 	protected void teleLosingCabalFromDungeons(String compWinner)
 	{
@@ -1320,7 +1462,7 @@ public class SevenSigns
 				
 				if (isSealValidationPeriod() || isCompResultsPeriod())
 				{
-					if (!onlinePlayer.isGM() && onlinePlayer.isIn7sDungeon() && (currPlayer == null || !currPlayer.getString("cabal").equals(_cmpWinner)))
+					if (!onlinePlayer.isGM() && onlinePlayer.isIn7sDungeon() && ((currPlayer == null) || !currPlayer.getString("cabal").equals(_cmpWinner)))
 					{
 						onlinePlayer.teleToLocation(MapRegionManager.TeleportWhereType.Town);
 						onlinePlayer.setIsIn7sDungeon(false);
@@ -1329,7 +1471,7 @@ public class SevenSigns
 				}
 				else
 				{
-					if (!onlinePlayer.isGM() && onlinePlayer.isIn7sDungeon() && (currPlayer == null || !currPlayer.getString("cabal").isEmpty()))
+					if (!onlinePlayer.isGM() && onlinePlayer.isIn7sDungeon() && ((currPlayer == null) || !currPlayer.getString("cabal").isEmpty()))
 					{
 						onlinePlayer.teleToLocation(MapRegionManager.TeleportWhereType.Town);
 						onlinePlayer.setIsIn7sDungeon(false);
@@ -1343,9 +1485,8 @@ public class SevenSigns
 	}
 	
 	/**
-	 * The primary controller of period change of the Seven Signs system.
+	 * The primary controller of period change of the Seven Signs system.<br>
 	 * This runs all related tasks depending on the period that is about to begin.
-	 *
 	 * @author Tempy
 	 */
 	protected class SevenSignsPeriodChange implements Runnable
@@ -1353,9 +1494,7 @@ public class SevenSigns
 		@Override
 		public void run()
 		{
-			/*
-			 * Remember the period check here refers to the period just ENDED!
-			 */
+			// Remember the period check here refers to the period just ENDED!
 			final int periodEnded = getCurrentPeriod();
 			_activePeriod++;
 			
@@ -1398,7 +1537,7 @@ public class SevenSigns
 					
 					// Perform initial Seal Validation set up.
 					initializeSeals();
-					//Buff/Debuff members of the event when Seal of Strife captured.
+					// Buff/Debuff members of the event when Seal of Strife captured.
 					giveCPMult(getSealOwner(SEAL_STRIFE));
 					// Send message that Seal Validation has begun.
 					sendMessageToAll(SystemMessageId.SEAL_VALIDATION_PERIOD_BEGUN);
@@ -1406,7 +1545,9 @@ public class SevenSigns
 					// Change next Territory War date
 					Quest twQuest = QuestManager.getInstance().getQuest(TerritoryWarManager.qn);
 					if (twQuest != null)
+					{
 						twQuest.startQuestTimer("setNextTWDate", 30000, null, null);
+					}
 					
 					_log.info("SevenSigns: The " + getCabalName(_previousWinner) + " have won the competition with " + getCurrentScore(_previousWinner) + " points!");
 					break;
@@ -1417,7 +1558,7 @@ public class SevenSigns
 					
 					// Send message that Seal Validation has ended.
 					sendMessageToAll(SystemMessageId.SEAL_VALIDATION_PERIOD_ENDED);
-					//Clear Seal of Strife influence.
+					// Clear Seal of Strife influence.
 					removeCPMult();
 					// Reset all data
 					resetPlayerData();
@@ -1465,37 +1606,61 @@ public class SevenSigns
 	
 	public boolean checkIsDawnPostingTicket(int itemId)
 	{
-		//TODO I think it should be some kind of a list in the datapack for compare;
-		if (itemId > 6114 && itemId < 6175)
+		// TODO: I think it should be some kind of a list in the datapack for compare.
+		if ((itemId > 6114) && (itemId < 6175))
+		{
 			return true;
-		if (itemId > 6801 && itemId < 6812)
+		}
+		if ((itemId > 6801) && (itemId < 6812))
+		{
 			return true;
-		if (itemId > 7997 && itemId < 8008)
+		}
+		if ((itemId > 7997) && (itemId < 8008))
+		{
 			return true;
-		if (itemId > 7940 && itemId < 7951)
+		}
+		if ((itemId > 7940) && (itemId < 7951))
+		{
 			return true;
-		if (itemId > 6294 && itemId < 6307)
+		}
+		if ((itemId > 6294) && (itemId < 6307))
+		{
 			return true;
-		if (itemId > 6831 && itemId < 6834)
+		}
+		if ((itemId > 6831) && (itemId < 6834))
+		{
 			return true;
-		if (itemId > 8027 && itemId < 8030)
+		}
+		if ((itemId > 8027) && (itemId < 8030))
+		{
 			return true;
-		if (itemId > 7970 && itemId < 7973)
+		}
+		if ((itemId > 7970) && (itemId < 7973))
+		{
 			return true;
+		}
 		return false;
 	}
 	
 	public boolean checkIsRookiePostingTicket(int itemId)
 	{
-		//TODO I think it should be some kind of a list in the datapack for compare;
-		if (itemId > 6174 && itemId < 6295)
+		// TODO: I think it should be some kind of a list in the datapack for compare.
+		if ((itemId > 6174) && (itemId < 6295))
+		{
 			return true;
-		if (itemId > 6811 && itemId < 6832)
+		}
+		if ((itemId > 6811) && (itemId < 6832))
+		{
 			return true;
-		if (itemId > 7950 && itemId < 7971)
+		}
+		if ((itemId > 7950) && (itemId < 7971))
+		{
 			return true;
-		if (itemId > 8007 && itemId < 8028)
+		}
+		if ((itemId > 8007) && (itemId < 8028))
+		{
 			return true;
+		}
 		return false;
 	}
 	
@@ -1518,14 +1683,20 @@ public class SevenSigns
 		{
 			if (character != null)
 			{
-				//Gives "Victor of War" passive skill to all online characters with Cabal, which controls Seal of Strife
+				// Gives "Victor of War" passive skill to all online characters with Cabal, which controls Seal of Strife
 				int cabal = getPlayerCabal(character.getObjectId());
 				if (cabal != SevenSigns.CABAL_NULL)
+				{
 					if (cabal == _strifeOwner)
+					{
 						character.addSkill(SkillTable.FrequentSkill.THE_VICTOR_OF_WAR.getSkill());
+					}
 					else
-						//Gives "The Vanquished of War" passive skill to all online characters with Cabal, which does not control Seal of Strife
+					{
+						// Gives "The Vanquished of War" passive skill to all online characters with Cabal, which does not control Seal of Strife
 						character.addSkill(SkillTable.FrequentSkill.THE_VANQUISHED_OF_WAR.getSkill());
+					}
+				}
 			}
 			return true;
 		}
@@ -1537,13 +1708,13 @@ public class SevenSigns
 	}
 	
 	protected final class RemoveCPMult implements TObjectProcedure<L2PcInstance>
-	{	
+	{
 		@Override
 		public final boolean execute(final L2PcInstance character)
 		{
 			if (character != null)
 			{
-				//Remove SevenSigns' buffs/debuffs.
+				// Remove SevenSigns' buffs/debuffs.
 				character.removeSkill(SkillTable.FrequentSkill.THE_VICTOR_OF_WAR.getSkill());
 				character.removeSkill(SkillTable.FrequentSkill.THE_VANQUISHED_OF_WAR.getSkill());
 			}
@@ -1554,15 +1725,21 @@ public class SevenSigns
 	public boolean checkSummonConditions(L2PcInstance activeChar)
 	{
 		if (activeChar == null)
+		{
 			return true;
-		//Golems cannot be summoned by Dusk when the Seal of Strife is controlled by the Dawn
+		}
+		// Golems cannot be summoned by Dusk when the Seal of Strife is controlled by the Dawn
 		if (isSealValidationPeriod())
+		{
 			if (getSealOwner(SEAL_STRIFE) == CABAL_DAWN)
+			{
 				if (getPlayerCabal(activeChar.getObjectId()) == CABAL_DUSK)
 				{
 					activeChar.sendMessage("You cannot summon Siege Golem or Cannon while Seal of Strife posessed by Lords of Dawn.");
 					return true;
 				}
+			}
+		}
 		
 		return false;
 	}

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 211 - 126
L2J_Server_BETA/java/com/l2jserver/gameserver/SevenSignsFestival.java


+ 84 - 107
L2J_Server_BETA/java/com/l2jserver/gameserver/Shutdown.java

@@ -14,8 +14,6 @@
  */
 package com.l2jserver.gameserver;
 
-import gnu.trove.procedure.TObjectProcedure;
-
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -45,17 +43,16 @@ import com.l2jserver.gameserver.network.serverpackets.ServerClose;
 import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
 import com.l2jserver.gameserver.util.Broadcast;
 
+import gnu.trove.procedure.TObjectProcedure;
 
 /**
- *
- * This class provides the functions for shutting down and restarting the server
+ * This class provides the functions for shutting down and restarting the server.<br>
  * It closes all open client connections and saves all data.
- *
  * @version $Revision: 1.2.4.5 $ $Date: 2005/03/27 15:29:09 $
  */
 public class Shutdown extends Thread
 {
-	private static Logger _log = Logger.getLogger(Shutdown.class.getName());
+	private static final Logger _log = Logger.getLogger(Shutdown.class.getName());
 	private static Shutdown _counterInstance = null;
 	
 	private int _secondsShut;
@@ -64,11 +61,16 @@ public class Shutdown extends Thread
 	public static final int GM_SHUTDOWN = 1;
 	public static final int GM_RESTART = 2;
 	public static final int ABORT = 3;
-	private static final String[] MODE_TEXT = { "SIGTERM", "shutting down", "restarting", "aborting" };
+	private static final String[] MODE_TEXT =
+	{
+		"SIGTERM",
+		"shutting down",
+		"restarting",
+		"aborting"
+	};
 	
 	/**
 	 * This function starts a shutdown count down from Telnet (Copied from Function startShutdown())
-	 *
 	 * @param seconds seconds until shutdown
 	 */
 	private void SendServerQuit(int seconds)
@@ -81,7 +83,6 @@ public class Shutdown extends Thread
 	public void startTelnetShutdown(String IP, int seconds, boolean restart)
 	{
 		_log.warning("IP: " + IP + " issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!");
-		//_an.announceToAll("Server is " + _modeText[shutdownMode] + " in "+seconds+ " seconds!");
 		
 		if (restart)
 		{
@@ -128,7 +129,6 @@ public class Shutdown extends Thread
 	
 	/**
 	 * This function aborts a running countdown
-	 *
 	 * @param IP IP Which Issued shutdown command
 	 */
 	public void telnetAbort(String IP)
@@ -145,7 +145,6 @@ public class Shutdown extends Thread
 	
 	/**
 	 * Default constructor is only used internal to create the shutdown-hook instance
-	 *
 	 */
 	protected Shutdown()
 	{
@@ -155,10 +154,8 @@ public class Shutdown extends Thread
 	
 	/**
 	 * This creates a countdown instance of Shutdown.
-	 *
-	 * @param seconds	how many seconds until shutdown
-	 * @param restart	true is the server shall restart after shutdown
-	 *
+	 * @param seconds how many seconds until shutdown
+	 * @param restart true is the server shall restart after shutdown
 	 */
 	public Shutdown(int seconds, boolean restart)
 	{
@@ -178,37 +175,14 @@ public class Shutdown extends Thread
 	}
 	
 	/**
-	 * get the shutdown-hook instance
-	 * the shutdown-hook instance is created by the first call of this function,
-	 * but it has to be registrered externaly.
-	 *
-	 * @return	instance of Shutdown, to be used as shutdown hook
-	 */
-	public static Shutdown getInstance()
-	{
-		return SingletonHolder._instance;
-	}
-	
-	/**
-	 * this function is called, when a new thread starts
-	 *
-	 * if this thread is the thread of getInstance, then this is the shutdown hook
-	 * and we save all data and disconnect all clients.
-	 *
-	 * after this thread ends, the server will completely exit
-	 *
-	 * if this is not the thread of getInstance, then this is a countdown thread.
-	 * we start the countdown, and when we finished it, and it was not aborted,
-	 * we tell the shutdown-hook why we call exit, and then call exit
-	 *
-	 * when the exit status of the server is 1, startServer.sh / startServer.bat
-	 * will restart the server.
-	 *
+	 * This function is called, when a new thread starts if this thread is the thread of getInstance, then this is the shutdown hook and we save all data and disconnect all clients.<br>
+	 * After this thread ends, the server will completely exit if this is not the thread of getInstance, then this is a countdown thread.<br>
+	 * We start the countdown, and when we finished it, and it was not aborted, we tell the shutdown-hook why we call exit, and then call exit when the exit status of the server is 1, startServer.sh / startServer.bat will restart the server.
 	 */
 	@Override
 	public void run()
 	{
-		if (this == SingletonHolder._instance)
+		if (this == getInstance())
 		{
 			TimeCounter tc = new TimeCounter();
 			TimeCounter tc1 = new TimeCounter();
@@ -217,18 +191,18 @@ public class Shutdown extends Thread
 				if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
 				{
 					OfflineTradersTable.getInstance().storeOffliners();
-					_log.info("Offline Traders Table: Offline shops stored("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+					_log.info("Offline Traders Table: Offline shops stored(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 				}
 			}
 			catch (Throwable t)
 			{
-				_log.log(Level.WARNING, "Error saving offline shops.",t);
+				_log.log(Level.WARNING, "Error saving offline shops.", t);
 			}
 			
 			try
 			{
 				disconnectAllCharacters();
-				_log.info("All players disconnected and saved("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+				_log.info("All players disconnected and saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 			}
 			catch (Throwable t)
 			{
@@ -239,7 +213,7 @@ public class Shutdown extends Thread
 			try
 			{
 				GameTimeController.getInstance().stopTimer();
-				_log.info("Game Time Controller: Timer stopped("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+				_log.info("Game Time Controller: Timer stopped(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 			}
 			catch (Throwable t)
 			{
@@ -250,7 +224,7 @@ public class Shutdown extends Thread
 			try
 			{
 				ThreadPoolManager.getInstance().shutdown();
-				_log.info("Thread Pool Manager: Manager has been shut down("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+				_log.info("Thread Pool Manager: Manager has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 			}
 			catch (Throwable t)
 			{
@@ -260,7 +234,7 @@ public class Shutdown extends Thread
 			try
 			{
 				CommunityServerThread.getInstance().interrupt();
-				_log.info("Community Server Thread: Thread interruped("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+				_log.info("Community Server Thread: Thread interruped(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 			}
 			catch (Throwable t)
 			{
@@ -270,7 +244,7 @@ public class Shutdown extends Thread
 			try
 			{
 				LoginServerThread.getInstance().interrupt();
-				_log.info("Login Server Thread: Thread interruped("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+				_log.info("Login Server Thread: Thread interruped(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 			}
 			catch (Throwable t)
 			{
@@ -285,7 +259,7 @@ public class Shutdown extends Thread
 			try
 			{
 				GameServer.gameServer.getSelectorThread().shutdown();
-				_log.info("Game Server: Selector thread has been shut down("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+				_log.info("Game Server: Selector thread has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 			}
 			catch (Throwable t)
 			{
@@ -296,7 +270,7 @@ public class Shutdown extends Thread
 			try
 			{
 				L2DatabaseFactory.getInstance().shutdown();
-				_log.info("L2Database Factory: Database connection has been shut down("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+				_log.info("L2Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 			}
 			catch (Throwable t)
 			{
@@ -304,7 +278,7 @@ public class Shutdown extends Thread
 			}
 			
 			// server will quit, when this function ends.
-			if (SingletonHolder._instance._shutdownMode == GM_RESTART)
+			if (getInstance()._shutdownMode == GM_RESTART)
 			{
 				Runtime.getRuntime().halt(2);
 			}
@@ -313,7 +287,7 @@ public class Shutdown extends Thread
 				Runtime.getRuntime().halt(0);
 			}
 			
-			_log.info("The server has been successfully shut down in "+tc1.getEstimatedTime()/1000+"seconds.");
+			_log.info("The server has been successfully shut down in " + (tc1.getEstimatedTime() / 1000) + "seconds.");
 		}
 		else
 		{
@@ -324,11 +298,11 @@ public class Shutdown extends Thread
 			switch (_shutdownMode)
 			{
 				case GM_SHUTDOWN:
-					SingletonHolder._instance.setMode(GM_SHUTDOWN);
+					getInstance().setMode(GM_SHUTDOWN);
 					System.exit(0);
 					break;
 				case GM_RESTART:
-					SingletonHolder._instance.setMode(GM_RESTART);
+					getInstance().setMode(GM_RESTART);
 					System.exit(2);
 					break;
 			}
@@ -336,11 +310,10 @@ public class Shutdown extends Thread
 	}
 	
 	/**
-	 * This functions starts a shutdown countdown
-	 *
-	 * @param activeChar	GM who issued the shutdown command
-	 * @param seconds		seconds until shutdown
-	 * @param restart		true if the server will restart after shutdown
+	 * This functions starts a shutdown countdown.
+	 * @param activeChar GM who issued the shutdown command
+	 * @param seconds seconds until shutdown
+	 * @param restart true if the server will restart after shutdown
 	 */
 	public void startShutdown(L2PcInstance activeChar, int seconds, boolean restart)
 	{
@@ -353,8 +326,7 @@ public class Shutdown extends Thread
 			_shutdownMode = GM_SHUTDOWN;
 		}
 		
-		_log.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown command. "
-				+ MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!");
+		_log.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!");
 		
 		if (_shutdownMode > 0)
 		{
@@ -387,20 +359,18 @@ public class Shutdown extends Thread
 			_counterInstance._abort();
 		}
 		
-		//		 the main instance should only run for shutdown hook, so we start a new instance
+		// the main instance should only run for shutdown hook, so we start a new instance
 		_counterInstance = new Shutdown(seconds, restart);
 		_counterInstance.start();
 	}
 	
 	/**
-	 * This function aborts a running countdown
-	 *
-	 * @param activeChar	GM who issued the abort command
+	 * This function aborts a running countdown.
+	 * @param activeChar GM who issued the abort command
 	 */
 	public void abort(L2PcInstance activeChar)
 	{
-		_log.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown ABORT. "
-				+ MODE_TEXT[_shutdownMode] + " has been stopped!");
+		_log.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!");
 		if (_counterInstance != null)
 		{
 			_counterInstance._abort();
@@ -410,8 +380,8 @@ public class Shutdown extends Thread
 	}
 	
 	/**
-	 * set the shutdown mode
-	 * @param mode	what mode shall be set
+	 * Set the shutdown mode.
+	 * @param mode what mode shall be set
 	 */
 	private void setMode(int mode)
 	{
@@ -419,8 +389,7 @@ public class Shutdown extends Thread
 	}
 	
 	/**
-	 * set shutdown mode to ABORT
-	 *
+	 * Set shutdown mode to ABORT.
 	 */
 	private void _abort()
 	{
@@ -428,8 +397,7 @@ public class Shutdown extends Thread
 	}
 	
 	/**
-	 * this counts the countdown and reports it to all players
-	 * countdown is aborted if mode changes to ABORT
+	 * This counts the countdown and reports it to all players countdown is aborted if mode changes to ABORT.
 	 */
 	private void countdown()
 	{
@@ -466,7 +434,7 @@ public class Shutdown extends Thread
 						SendServerQuit(120);
 						break;
 					case 60:
-						LoginServerThread.getInstance().setServerStatus(ServerStatus.STATUS_DOWN); //avoids new players from logging in
+						LoginServerThread.getInstance().setServerStatus(ServerStatus.STATUS_DOWN); // avoids new players from logging in
 						SendServerQuit(60);
 						break;
 					case 30:
@@ -494,22 +462,23 @@ public class Shutdown extends Thread
 				
 				_secondsShut--;
 				
-				int delay = 1000; //milliseconds
+				int delay = 1000; // milliseconds
 				Thread.sleep(delay);
 				
 				if (_shutdownMode == ABORT)
+				{
 					break;
+				}
 			}
 		}
 		catch (InterruptedException e)
 		{
-			//this will never happen
+			// this will never happen
 		}
 	}
 	
 	/**
-	 * this sends a last byebye, disconnects all players and saves data
-	 *
+	 * This sends a last byebye, disconnects all players and saves data.
 	 */
 	private void saveData()
 	{
@@ -524,70 +493,71 @@ public class Shutdown extends Thread
 			case GM_RESTART:
 				_log.info("GM restart received. Restarting NOW!");
 				break;
-				
+		
 		}
 		
-		/*if (Config.ACTIVATE_POSITION_RECORDER)
-			Universe.getInstance().implode(true);*/
+		/*
+		 * if (Config.ACTIVATE_POSITION_RECORDER) Universe.getInstance().implode(true);
+		 */
 		TimeCounter tc = new TimeCounter();
 		// Seven Signs data is now saved along with Festival data.
 		if (!SevenSigns.getInstance().isSealValidationPeriod())
 		{
 			SevenSignsFestival.getInstance().saveFestivalData(false);
-			_log.info("SevenSignsFestival: Festival data saved("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+			_log.info("SevenSignsFestival: Festival data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 		}
 		
 		// Save Seven Signs data before closing. :)
 		SevenSigns.getInstance().saveSevenSignsData();
-		_log.info("SevenSigns: Seven Signs data saved("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+		_log.info("SevenSigns: Seven Signs data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 		SevenSigns.getInstance().saveSevenSignsStatus();
-		_log.info("SevenSigns: Seven Signs status saved("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+		_log.info("SevenSigns: Seven Signs status saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 		
 		// Save all raidboss and GrandBoss status ^_^
 		RaidBossSpawnManager.getInstance().cleanUp();
-		_log.info("RaidBossSpawnManager: All raidboss info saved("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+		_log.info("RaidBossSpawnManager: All raidboss info saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 		GrandBossManager.getInstance().cleanUp();
-		_log.info("GrandBossManager: All Grand Boss info saved("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+		_log.info("GrandBossManager: All Grand Boss info saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 		HellboundManager.getInstance().cleanUp();
 		_log.info("Hellbound Manager: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 		_log.info("TradeController saving data.. This action may take some minutes! Please wait until completed!");
 		TradeController.getInstance().dataCountStore();
-		_log.info("TradeController: All count Item saved("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+		_log.info("TradeController: All count Item saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 		ItemAuctionManager.getInstance().shutdown();
-		_log.info("Item Auction Manager: All tasks stopped("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+		_log.info("Item Auction Manager: All tasks stopped(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 		Olympiad.getInstance().saveOlympiadStatus();
-		_log.info("Olympiad System: Data saved("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+		_log.info("Olympiad System: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 		Hero.getInstance().shutdown();
-		_log.info("Hero System: Data saved("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+		_log.info("Hero System: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 		ClanTable.getInstance().storeClanScore();
-		_log.info("Clan System: Data saved("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+		_log.info("Clan System: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 		
 		// Save Cursed Weapons data before closing.
 		CursedWeaponsManager.getInstance().saveData();
-		_log.info("Cursed Weapons Manager: Data saved("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+		_log.info("Cursed Weapons Manager: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 		
 		// Save all manor data
 		CastleManorManager.getInstance().save();
-		_log.info("Castle Manor Manager: Data saved("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+		_log.info("Castle Manor Manager: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 		
 		CHSiegeManager.getInstance().onServerShutDown();
 		_log.info("CHSiegeManager: Siegable hall attacker lists saved!");
 		
 		// Save all global (non-player specific) Quest data that needs to persist after reboot
 		QuestManager.getInstance().save();
-		_log.info("Quest Manager: Data saved("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+		_log.info("Quest Manager: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 		
 		// Save all global variables data
 		GlobalVariablesManager.getInstance().saveVars();
-		_log.info("Global Variables Manager: Variables saved("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+		_log.info("Global Variables Manager: Variables saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 		
-		//Save items on ground before closing
+		// Save items on ground before closing
 		if (Config.SAVE_DROPPED_ITEM)
 		{
 			ItemsOnGroundManager.getInstance().saveInDb();
-			_log.info("Items On Ground Manager: Data saved("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+			_log.info("Items On Ground Manager: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 			ItemsOnGroundManager.getInstance().cleanUp();
-			_log.info("Items On Ground Manager: Cleaned up("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+			_log.info("Items On Ground Manager: Cleaned up(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 		}
 		
 		try
@@ -597,13 +567,12 @@ public class Shutdown extends Thread
 		}
 		catch (InterruptedException e)
 		{
-			//never happens :p
+			// never happens :p
 		}
 	}
 	
 	/**
-	 * this disconnects all clients from the server
-	 *
+	 * This disconnects all clients from the server.
 	 */
 	private void disconnectAllCharacters()
 	{
@@ -619,11 +588,11 @@ public class Shutdown extends Thread
 		{
 			if (player != null)
 			{
-				//Logout Character
+				// Logout Character
 				try
 				{
 					L2GameClient client = player.getClient();
-					if (client != null && !client.isDetached())
+					if ((client != null) && !client.isDetached())
 					{
 						client.close(ServerClose.STATIC_PACKET);
 						client.setActiveChar(null);
@@ -641,9 +610,8 @@ public class Shutdown extends Thread
 	}
 	
 	/**
-	 * A simple class used to track down the estimated time of method executions.
-	 * Once this class is created, it saves the start time, and when you want to get
-	 * the estimated time, use the getEstimatedTime() method.
+	 * A simple class used to track down the estimated time of method executions.<br>
+	 * Once this class is created, it saves the start time, and when you want to get the estimated time, use the getEstimatedTime() method.
 	 */
 	private static final class TimeCounter
 	{
@@ -672,6 +640,15 @@ public class Shutdown extends Thread
 		}
 	}
 	
+	/**
+	 * Get the shutdown-hook instance the shutdown-hook instance is created by the first call of this function, but it has to be registered externally.<br>
+	 * @return instance of Shutdown, to be used as shutdown hook
+	 */
+	public static Shutdown getInstance()
+	{
+		return SingletonHolder._instance;
+	}
+	
 	private static class SingletonHolder
 	{
 		protected static final Shutdown _instance = new Shutdown();

+ 3 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/TaskPriority.java

@@ -19,5 +19,7 @@ package com.l2jserver.gameserver;
  */
 public enum TaskPriority
 {
-	PR_NORMAL, PR_HIGH, PR_URGENT;
+	PR_NORMAL,
+	PR_HIGH,
+	PR_URGENT;
 }

+ 95 - 83
L2J_Server_BETA/java/com/l2jserver/gameserver/ThreadPoolManager.java

@@ -35,12 +35,16 @@ import com.l2jserver.Config;
 import com.l2jserver.util.StringUtil;
 
 /**
- * <p>This class is made to handle all the ThreadPools used in L2j.</p>
- * <p>Scheduled Tasks can either be sent to a {@link #_generalScheduledThreadPool "general"} or {@link #_effectsScheduledThreadPool "effects"} {@link ScheduledThreadPoolExecutor ScheduledThreadPool}:
- * The "effects" one is used for every effects (skills, hp/mp regen ...) while the "general" one is used for
- * everything else that needs to be scheduled.<br>
- * There also is an {@link #_aiScheduledThreadPool "ai"} {@link ScheduledThreadPoolExecutor ScheduledThreadPool} used for AI Tasks.</p>
- * <p>Tasks can be sent to {@link ScheduledThreadPoolExecutor ScheduledThreadPool} either with:
+ * <p>
+ * This class is made to handle all the ThreadPools used in L2j.
+ * </p>
+ * <p>
+ * Scheduled Tasks can either be sent to a {@link #_generalScheduledThreadPool "general"} or {@link #_effectsScheduledThreadPool "effects"} {@link ScheduledThreadPoolExecutor ScheduledThreadPool}: The "effects" one is used for every effects (skills, hp/mp regen ...) while the "general" one is used
+ * for everything else that needs to be scheduled.<br>
+ * There also is an {@link #_aiScheduledThreadPool "ai"} {@link ScheduledThreadPoolExecutor ScheduledThreadPool} used for AI Tasks.
+ * </p>
+ * <p>
+ * Tasks can be sent to {@link ScheduledThreadPoolExecutor ScheduledThreadPool} either with:
  * <ul>
  * <li>{@link #scheduleEffect(Runnable, long)} : for effects Tasks that needs to be executed only once.</li>
  * <li>{@link #scheduleGeneral(Runnable, long)} : for scheduled Tasks that needs to be executed once.</li>
@@ -51,10 +55,10 @@ import com.l2jserver.util.StringUtil;
  * <li>{@link #scheduleEffectAtFixedRate(Runnable, long, long)} : for effects Tasks that needs to be executed periodicaly.</li>
  * <li>{@link #scheduleGeneralAtFixedRate(Runnable, long, long)} : for scheduled Tasks that needs to be executed periodicaly.</li>
  * <li>{@link #scheduleAiAtFixedRate(Runnable, long, long)} : for AI Tasks that needs to be executed periodicaly</li>
- * </ul></p>
- *
- * <p>For all Tasks that should be executed with no delay asynchronously in a ThreadPool there also are usual {@link ThreadPoolExecutor ThreadPools}
- * that can grow/shrink according to their load.:
+ * </ul>
+ * </p>
+ * <p>
+ * For all Tasks that should be executed with no delay asynchronously in a ThreadPool there also are usual {@link ThreadPoolExecutor ThreadPools} that can grow/shrink according to their load.:
  * <ul>
  * <li>{@link #_generalPacketsThreadPool GeneralPackets} where most packets handler are executed.</li>
  * <li>{@link #_ioPacketsThreadPool I/O Packets} where all the i/o packets are executed.</li>
@@ -63,7 +67,6 @@ import com.l2jserver.util.StringUtil;
  * </ul>
  * </p>
  * @author -Wooden-
- *
  */
 public class ThreadPoolManager
 {
@@ -90,7 +93,9 @@ public class ThreadPoolManager
 				final Thread t = Thread.currentThread();
 				final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
 				if (h != null)
+				{
 					h.uncaughtException(t, e);
+				}
 			}
 		}
 	}
@@ -98,10 +103,9 @@ public class ThreadPoolManager
 	protected ScheduledThreadPoolExecutor _effectsScheduledThreadPool;
 	protected ScheduledThreadPoolExecutor _generalScheduledThreadPool;
 	protected ScheduledThreadPoolExecutor _aiScheduledThreadPool;
-	private ThreadPoolExecutor _generalPacketsThreadPool;
-	private ThreadPoolExecutor _ioPacketsThreadPool;
-	private ThreadPoolExecutor _generalThreadPool;
-	
+	private final ThreadPoolExecutor _generalPacketsThreadPool;
+	private final ThreadPoolExecutor _ioPacketsThreadPool;
+	private final ThreadPoolExecutor _generalThreadPool;
 	
 	/** temp workaround for VM issue */
 	private static final long MAX_DELAY = Long.MAX_VALUE / 1000000 / 2;
@@ -128,9 +132,13 @@ public class ThreadPoolManager
 	public static long validateDelay(long delay)
 	{
 		if (delay < 0)
+		{
 			delay = 0;
+		}
 		else if (delay > MAX_DELAY)
+		{
 			delay = MAX_DELAY;
+		}
 		return delay;
 	}
 	
@@ -254,73 +262,74 @@ public class ThreadPoolManager
 	
 	public String[] getStats()
 	{
-		return new String[] {
-				"STP:",
-				" + Effects:",
-				" |- ActiveThreads:   " + _effectsScheduledThreadPool.getActiveCount(),
-				" |- getCorePoolSize: " + _effectsScheduledThreadPool.getCorePoolSize(),
-				" |- PoolSize:        " + _effectsScheduledThreadPool.getPoolSize(),
-				" |- MaximumPoolSize: " + _effectsScheduledThreadPool.getMaximumPoolSize(),
-				" |- CompletedTasks:  " + _effectsScheduledThreadPool.getCompletedTaskCount(),
-				" |- ScheduledTasks:  " + (_effectsScheduledThreadPool.getTaskCount() - _effectsScheduledThreadPool.getCompletedTaskCount()),
-				" | -------",
-				" + General:",
-				" |- ActiveThreads:   " + _generalScheduledThreadPool.getActiveCount(),
-				" |- getCorePoolSize: " + _generalScheduledThreadPool.getCorePoolSize(),
-				" |- PoolSize:        " + _generalScheduledThreadPool.getPoolSize(),
-				" |- MaximumPoolSize: " + _generalScheduledThreadPool.getMaximumPoolSize(),
-				" |- CompletedTasks:  " + _generalScheduledThreadPool.getCompletedTaskCount(),
-				" |- ScheduledTasks:  " + (_generalScheduledThreadPool.getTaskCount() - _generalScheduledThreadPool.getCompletedTaskCount()),
-				" | -------",
-				" + AI:",
-				" |- ActiveThreads:   " + _aiScheduledThreadPool.getActiveCount(),
-				" |- getCorePoolSize: " + _aiScheduledThreadPool.getCorePoolSize(),
-				" |- PoolSize:        " + _aiScheduledThreadPool.getPoolSize(),
-				" |- MaximumPoolSize: " + _aiScheduledThreadPool.getMaximumPoolSize(),
-				" |- CompletedTasks:  " + _aiScheduledThreadPool.getCompletedTaskCount(),
-				" |- ScheduledTasks:  " + (_aiScheduledThreadPool.getTaskCount() - _aiScheduledThreadPool.getCompletedTaskCount()),
-				"TP:",
-				" + Packets:",
-				" |- ActiveThreads:   " + _generalPacketsThreadPool.getActiveCount(),
-				" |- getCorePoolSize: " + _generalPacketsThreadPool.getCorePoolSize(),
-				" |- MaximumPoolSize: " + _generalPacketsThreadPool.getMaximumPoolSize(),
-				" |- LargestPoolSize: " + _generalPacketsThreadPool.getLargestPoolSize(),
-				" |- PoolSize:        " + _generalPacketsThreadPool.getPoolSize(),
-				" |- CompletedTasks:  " + _generalPacketsThreadPool.getCompletedTaskCount(),
-				" |- QueuedTasks:     " + _generalPacketsThreadPool.getQueue().size(),
-				" | -------",
-				" + I/O Packets:",
-				" |- ActiveThreads:   " + _ioPacketsThreadPool.getActiveCount(),
-				" |- getCorePoolSize: " + _ioPacketsThreadPool.getCorePoolSize(),
-				" |- MaximumPoolSize: " + _ioPacketsThreadPool.getMaximumPoolSize(),
-				" |- LargestPoolSize: " + _ioPacketsThreadPool.getLargestPoolSize(),
-				" |- PoolSize:        " + _ioPacketsThreadPool.getPoolSize(),
-				" |- CompletedTasks:  " + _ioPacketsThreadPool.getCompletedTaskCount(),
-				" |- QueuedTasks:     " + _ioPacketsThreadPool.getQueue().size(),
-				" | -------",
-				" + General Tasks:",
-				" |- ActiveThreads:   " + _generalThreadPool.getActiveCount(),
-				" |- getCorePoolSize: " + _generalThreadPool.getCorePoolSize(),
-				" |- MaximumPoolSize: " + _generalThreadPool.getMaximumPoolSize(),
-				" |- LargestPoolSize: " + _generalThreadPool.getLargestPoolSize(),
-				" |- PoolSize:        " + _generalThreadPool.getPoolSize(),
-				" |- CompletedTasks:  " + _generalThreadPool.getCompletedTaskCount(),
-				" |- QueuedTasks:     " + _generalThreadPool.getQueue().size(),
-				" | -------",
-				" + Javolution stats:",
-				" |- FastList:        " + FastList.report(),
-				" |- FastMap:        " + FastMap.report(),
-				" |- FastSet:        " + FastSet.report(),
-				" | -------"
+		return new String[]
+		{
+			"STP:",
+			" + Effects:",
+			" |- ActiveThreads:   " + _effectsScheduledThreadPool.getActiveCount(),
+			" |- getCorePoolSize: " + _effectsScheduledThreadPool.getCorePoolSize(),
+			" |- PoolSize:        " + _effectsScheduledThreadPool.getPoolSize(),
+			" |- MaximumPoolSize: " + _effectsScheduledThreadPool.getMaximumPoolSize(),
+			" |- CompletedTasks:  " + _effectsScheduledThreadPool.getCompletedTaskCount(),
+			" |- ScheduledTasks:  " + (_effectsScheduledThreadPool.getTaskCount() - _effectsScheduledThreadPool.getCompletedTaskCount()),
+			" | -------",
+			" + General:",
+			" |- ActiveThreads:   " + _generalScheduledThreadPool.getActiveCount(),
+			" |- getCorePoolSize: " + _generalScheduledThreadPool.getCorePoolSize(),
+			" |- PoolSize:        " + _generalScheduledThreadPool.getPoolSize(),
+			" |- MaximumPoolSize: " + _generalScheduledThreadPool.getMaximumPoolSize(),
+			" |- CompletedTasks:  " + _generalScheduledThreadPool.getCompletedTaskCount(),
+			" |- ScheduledTasks:  " + (_generalScheduledThreadPool.getTaskCount() - _generalScheduledThreadPool.getCompletedTaskCount()),
+			" | -------",
+			" + AI:",
+			" |- ActiveThreads:   " + _aiScheduledThreadPool.getActiveCount(),
+			" |- getCorePoolSize: " + _aiScheduledThreadPool.getCorePoolSize(),
+			" |- PoolSize:        " + _aiScheduledThreadPool.getPoolSize(),
+			" |- MaximumPoolSize: " + _aiScheduledThreadPool.getMaximumPoolSize(),
+			" |- CompletedTasks:  " + _aiScheduledThreadPool.getCompletedTaskCount(),
+			" |- ScheduledTasks:  " + (_aiScheduledThreadPool.getTaskCount() - _aiScheduledThreadPool.getCompletedTaskCount()),
+			"TP:",
+			" + Packets:",
+			" |- ActiveThreads:   " + _generalPacketsThreadPool.getActiveCount(),
+			" |- getCorePoolSize: " + _generalPacketsThreadPool.getCorePoolSize(),
+			" |- MaximumPoolSize: " + _generalPacketsThreadPool.getMaximumPoolSize(),
+			" |- LargestPoolSize: " + _generalPacketsThreadPool.getLargestPoolSize(),
+			" |- PoolSize:        " + _generalPacketsThreadPool.getPoolSize(),
+			" |- CompletedTasks:  " + _generalPacketsThreadPool.getCompletedTaskCount(),
+			" |- QueuedTasks:     " + _generalPacketsThreadPool.getQueue().size(),
+			" | -------",
+			" + I/O Packets:",
+			" |- ActiveThreads:   " + _ioPacketsThreadPool.getActiveCount(),
+			" |- getCorePoolSize: " + _ioPacketsThreadPool.getCorePoolSize(),
+			" |- MaximumPoolSize: " + _ioPacketsThreadPool.getMaximumPoolSize(),
+			" |- LargestPoolSize: " + _ioPacketsThreadPool.getLargestPoolSize(),
+			" |- PoolSize:        " + _ioPacketsThreadPool.getPoolSize(),
+			" |- CompletedTasks:  " + _ioPacketsThreadPool.getCompletedTaskCount(),
+			" |- QueuedTasks:     " + _ioPacketsThreadPool.getQueue().size(),
+			" | -------",
+			" + General Tasks:",
+			" |- ActiveThreads:   " + _generalThreadPool.getActiveCount(),
+			" |- getCorePoolSize: " + _generalThreadPool.getCorePoolSize(),
+			" |- MaximumPoolSize: " + _generalThreadPool.getMaximumPoolSize(),
+			" |- LargestPoolSize: " + _generalThreadPool.getLargestPoolSize(),
+			" |- PoolSize:        " + _generalThreadPool.getPoolSize(),
+			" |- CompletedTasks:  " + _generalThreadPool.getCompletedTaskCount(),
+			" |- QueuedTasks:     " + _generalThreadPool.getQueue().size(),
+			" | -------",
+			" + Javolution stats:",
+			" |- FastList:        " + FastList.report(),
+			" |- FastMap:        " + FastMap.report(),
+			" |- FastSet:        " + FastSet.report(),
+			" | -------"
 		};
 	}
 	
 	private static class PriorityThreadFactory implements ThreadFactory
 	{
-		private int _prio;
-		private String _name;
-		private AtomicInteger _threadNumber = new AtomicInteger(1);
-		private ThreadGroup _group;
+		private final int _prio;
+		private final String _name;
+		private final AtomicInteger _threadNumber = new AtomicInteger(1);
+		private final ThreadGroup _group;
 		
 		public PriorityThreadFactory(String name, int prio)
 		{
@@ -392,12 +401,13 @@ public class ThreadPoolManager
 			int count = ptf.getGroup().activeCount();
 			Thread[] threads = new Thread[count + 2];
 			ptf.getGroup().enumerate(threads);
-			StringUtil.append(sb, "General Packet Thread Pool:" + Config.EOL + "Tasks in the queue: ", String.valueOf(_generalPacketsThreadPool.getQueue().size()), Config.EOL
-					+ "Showing threads stack trace:" + Config.EOL + "There should be ", String.valueOf(count), " Threads" + Config.EOL);
+			StringUtil.append(sb, "General Packet Thread Pool:" + Config.EOL + "Tasks in the queue: ", String.valueOf(_generalPacketsThreadPool.getQueue().size()), Config.EOL + "Showing threads stack trace:" + Config.EOL + "There should be ", String.valueOf(count), " Threads" + Config.EOL);
 			for (Thread t : threads)
 			{
 				if (t == null)
+				{
 					continue;
+				}
 				
 				StringUtil.append(sb, t.getName(), Config.EOL);
 				for (StackTraceElement ste : t.getStackTrace())
@@ -423,13 +433,14 @@ public class ThreadPoolManager
 			int count = ptf.getGroup().activeCount();
 			Thread[] threads = new Thread[count + 2];
 			ptf.getGroup().enumerate(threads);
-			StringUtil.append(sb, "I/O Packet Thread Pool:" + Config.EOL + "Tasks in the queue: ", String.valueOf(_ioPacketsThreadPool.getQueue().size()), Config.EOL
-					+ "Showing threads stack trace:" + Config.EOL + "There should be ", String.valueOf(count), " Threads" + Config.EOL);
+			StringUtil.append(sb, "I/O Packet Thread Pool:" + Config.EOL + "Tasks in the queue: ", String.valueOf(_ioPacketsThreadPool.getQueue().size()), Config.EOL + "Showing threads stack trace:" + Config.EOL + "There should be ", String.valueOf(count), " Threads" + Config.EOL);
 			
 			for (Thread t : threads)
 			{
 				if (t == null)
+				{
 					continue;
+				}
 				
 				StringUtil.append(sb, t.getName(), Config.EOL);
 				
@@ -456,13 +467,14 @@ public class ThreadPoolManager
 			int count = ptf.getGroup().activeCount();
 			Thread[] threads = new Thread[count + 2];
 			ptf.getGroup().enumerate(threads);
-			StringUtil.append(sb, "General Thread Pool:" + Config.EOL + "Tasks in the queue: ", String.valueOf(_generalThreadPool.getQueue().size()), Config.EOL
-					+ "Showing threads stack trace:" + Config.EOL + "There should be ", String.valueOf(count), " Threads" + Config.EOL);
+			StringUtil.append(sb, "General Thread Pool:" + Config.EOL + "Tasks in the queue: ", String.valueOf(_generalThreadPool.getQueue().size()), Config.EOL + "Showing threads stack trace:" + Config.EOL + "There should be ", String.valueOf(count), " Threads" + Config.EOL);
 			
 			for (Thread t : threads)
 			{
 				if (t == null)
+				{
 					continue;
+				}
 				
 				StringUtil.append(sb, t.getName(), Config.EOL);
 				

+ 14 - 18
L2J_Server_BETA/java/com/l2jserver/gameserver/TradeController.java

@@ -35,7 +35,6 @@ import com.l2jserver.gameserver.model.L2TradeList.L2TradeItem;
 
 /**
  * This class ...
- *
  * @version $Revision: 1.5.4.13 $ $Date: 2005/04/06 16:13:38 $
  */
 public class TradeController
@@ -43,12 +42,7 @@ public class TradeController
 	private static Logger _log = Logger.getLogger(TradeController.class.getName());
 	
 	private int _nextListId;
-	private Map<Integer, L2TradeList> _lists = new FastMap<>();
-	
-	public static TradeController getInstance()
-	{
-		return SingletonHolder._instance;
-	}
+	private final Map<Integer, L2TradeList> _lists = new FastMap<>();
 	
 	protected TradeController()
 	{
@@ -60,10 +54,7 @@ public class TradeController
 		{
 			int itemId, price, maxCount, currentCount, time;
 			long saveTimer;
-			try (PreparedStatement ps = con.prepareStatement("SELECT item_id, price, shop_id, "
-					+ L2DatabaseFactory.getInstance().safetyString("order")
-					+ ", count, currentCount, time, savetimer FROM merchant_buylists WHERE shop_id=? ORDER BY "
-					+ L2DatabaseFactory.getInstance().safetyString("order") + " ASC"))
+			try (PreparedStatement ps = con.prepareStatement("SELECT item_id, price, shop_id, " + L2DatabaseFactory.getInstance().safetyString("order") + ", count, currentCount, time, savetimer FROM merchant_buylists WHERE shop_id=? ORDER BY " + L2DatabaseFactory.getInstance().safetyString("order") + " ASC"))
 			{
 				while (rs1.next())
 				{
@@ -138,10 +129,7 @@ public class TradeController
 				int initialSize = _lists.size();
 				int itemId, price, maxCount, currentCount, time;
 				long saveTimer;
-				PreparedStatement statement = con.prepareStatement("SELECT item_id, price, shop_id, "
-						+ L2DatabaseFactory.getInstance().safetyString("order")
-						+ ", count, currentCount, time, savetimer FROM custom_merchant_buylists WHERE shop_id=? ORDER BY "
-						+ L2DatabaseFactory.getInstance().safetyString("order") + " ASC");
+				PreparedStatement statement = con.prepareStatement("SELECT item_id, price, shop_id, " + L2DatabaseFactory.getInstance().safetyString("order") + ", count, currentCount, time, savetimer FROM custom_merchant_buylists WHERE shop_id=? ORDER BY " + L2DatabaseFactory.getInstance().safetyString("order") + " ASC");
 				while (rset1.next())
 				{
 					statement.setString(1, String.valueOf(rset1.getInt("shop_id")));
@@ -163,8 +151,7 @@ public class TradeController
 						L2TradeItem item = new L2TradeItem(shopId, itemId);
 						if (ItemTable.getInstance().getTemplate(itemId) == null)
 						{
-							_log.warning("Skipping itemId: " + itemId + " on buylistId: " + buy1.getListId()
-									+ ", missing data for that item.");
+							_log.warning("Skipping itemId: " + itemId + " on buylistId: " + buy1.getListId() + ", missing data for that item.");
 							continue;
 						}
 						
@@ -225,9 +212,13 @@ public class TradeController
 		{
 			String tradeNpcId = list.getNpcId();
 			if (tradeNpcId.startsWith("gm"))
+			{
 				continue;
+			}
 			if (npcId == Integer.parseInt(tradeNpcId))
+			{
 				lists.add(list);
+			}
 		}
 		return lists;
 	}
@@ -244,7 +235,7 @@ public class TradeController
 					for (L2TradeItem item : list.getItems())
 					{
 						long currentCount;
-						if (item.hasLimitedStock() && (currentCount = item.getCurrentCount()) < item.getMaxCount())
+						if (item.hasLimitedStock() && ((currentCount = item.getCurrentCount()) < item.getMaxCount()))
 						{
 							statement.setLong(1, currentCount);
 							statement.setInt(2, item.getItemId());
@@ -270,6 +261,11 @@ public class TradeController
 		return _nextListId++;
 	}
 	
+	public static TradeController getInstance()
+	{
+		return SingletonHolder._instance;
+	}
+	
 	private static class SingletonHolder
 	{
 		protected static final TradeController _instance = new TradeController();

+ 89 - 176
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/AbstractAI.java

@@ -85,13 +85,17 @@ public abstract class AbstractAI implements Ctrl
 			try
 			{
 				if (_followTask == null)
+				{
 					return;
+				}
 				
 				L2Character followTarget = _followTarget; // copy to prevent NPE
 				if (followTarget == null)
 				{
 					if (_actor instanceof L2Summon)
+					{
 						((L2Summon) _actor).setFollowStatus(false);
+					}
 					setIntention(AI_INTENTION_IDLE);
 					return;
 				}
@@ -102,7 +106,9 @@ public abstract class AbstractAI implements Ctrl
 					{
 						// if the target is too far (maybe also teleported)
 						if (_actor instanceof L2Summon)
+						{
 							((L2Summon) _actor).setFollowStatus(false);
+						}
 						
 						setIntention(AI_INTENTION_IDLE);
 						return;
@@ -155,10 +161,8 @@ public abstract class AbstractAI implements Ctrl
 	private static final int ATTACK_FOLLOW_INTERVAL = 500;
 	
 	/**
-	 * Constructor of AbstractAI.<BR><BR>
-	 *
+	 * Constructor of AbstractAI.
 	 * @param accessor The AI accessor of the L2Character
-	 *
 	 */
 	protected AbstractAI(L2Character.AIAccessor accessor)
 	{
@@ -214,38 +218,26 @@ public abstract class AbstractAI implements Ctrl
 	}
 	
 	/**
-	 * Set the Intention of this AbstractAI.<BR><BR>
-	 *
-	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : This method is USED by AI classes</B></FONT><BR><BR>
-	 *
-	 * <B><U> Overridden in </U> : </B><BR>
+	 * Set the Intention of this AbstractAI.<br>
+	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : This method is USED by AI classes</B></FONT><B><U><br>
+	 * Overridden in </U> : </B><BR>
 	 * <B>L2AttackableAI</B> : Create an AI Task executed every 1s (if necessary)<BR>
-	 * <B>L2PlayerAI</B> : Stores the current AI intention parameters to later restore it if necessary<BR><BR>
-	 *
+	 * <B>L2PlayerAI</B> : Stores the current AI intention parameters to later restore it if necessary.
 	 * @param intention The new Intention to set to the AI
 	 * @param arg0 The first parameter of the Intention
 	 * @param arg1 The second parameter of the Intention
-	 *
 	 */
 	synchronized void changeIntention(CtrlIntention intention, Object arg0, Object arg1)
 	{
-		/*
-		 if (Config.DEBUG)
-		 _log.warning("AbstractAI: changeIntention -> " + intention + " " + arg0 + " " + arg1);
-		 */
-		
 		_intention = intention;
 		_intentionArg0 = arg0;
 		_intentionArg1 = arg1;
 	}
 	
 	/**
-	 * Launch the L2CharacterAI onIntention method corresponding to the new Intention.<BR><BR>
-	 *
-	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : Stop the FOLLOW mode if necessary</B></FONT><BR><BR>
-	 *
+	 * Launch the L2CharacterAI onIntention method corresponding to the new Intention.<br>
+	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : Stop the FOLLOW mode if necessary</B></FONT>
 	 * @param intention The new Intention to set to the AI
-	 *
 	 */
 	@Override
 	public final void setIntention(CtrlIntention intention)
@@ -254,13 +246,10 @@ public abstract class AbstractAI implements Ctrl
 	}
 	
 	/**
-	 * Launch the L2CharacterAI onIntention method corresponding to the new Intention.<BR><BR>
-	 *
-	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : Stop the FOLLOW mode if necessary</B></FONT><BR><BR>
-	 *
+	 * Launch the L2CharacterAI onIntention method corresponding to the new Intention.<br>
+	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : Stop the FOLLOW mode if necessary</B></FONT>
 	 * @param intention The new Intention to set to the AI
 	 * @param arg0 The first parameter of the Intention (optional target)
-	 *
 	 */
 	@Override
 	public final void setIntention(CtrlIntention intention, Object arg0)
@@ -268,50 +257,14 @@ public abstract class AbstractAI implements Ctrl
 		setIntention(intention, arg0, null);
 	}
 	
-	/**
-	 * Launch the L2CharacterAI onIntention method corresponding to the new Intention.<BR><BR>
-	 *
-	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : Stop the FOLLOW mode if necessary</B></FONT><BR><BR>
-	 *
-	 * @param intention The new Intention to set to the AI
-	 * @param arg0 The first parameter of the Intention (optional target)
-	 * @param arg1 The second parameter of the Intention (optional target)
-	 *
-	 */
-	/*
-	public final void informAIIntention(CtrlIntention intent, Object arg0) {
-		ThreadPoolManager.getInstance().executeAi(new InformAIMsg(this, intent, arg0));
-	}
-	
-	public final void informAIIntention(CtrlIntention intent) {
-		ThreadPoolManager.getInstance().executeAi(new InformAIMsg(this, intent, null));
-	}
-
-	public class InformAIMsg implements Runnable {
-		private AbstractAI _ai;
-		private CtrlIntention _intent;
-		private Object _arg0;
-		public InformAIMsg(AbstractAI ai, CtrlIntention intention, Object arg0) {
-			_ai=ai;
-			_intent = intention;
-			_arg0 = arg0;
-		}
-		public final void run() {
-			_ai.setIntention(_intent, _arg0, null);
-		}
-	}
-	 */
 	@Override
 	public final void setIntention(CtrlIntention intention, Object arg0, Object arg1)
 	{
-		/*
-		 if (Config.DEBUG)
-		 _log.warning("AbstractAI: setIntention -> " + intention + " " + arg0 + " " + arg1);
-		 */
-		
 		// Stop the follow mode if necessary
-		if (intention != AI_INTENTION_FOLLOW && intention != AI_INTENTION_ATTACK)
+		if ((intention != AI_INTENTION_FOLLOW) && (intention != AI_INTENTION_ATTACK))
+		{
 			stopFollow();
+		}
 		
 		// Launch the onIntention method of the L2CharacterAI corresponding to the new Intention
 		switch (intention)
@@ -353,13 +306,9 @@ public abstract class AbstractAI implements Ctrl
 	}
 	
 	/**
-	 * Launch the L2CharacterAI onEvt method corresponding to the Event.<BR><BR>
-	 *
-	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : The current general intention won't be change
-	 * (ex : If the character attack and is stunned, he will attack again after the stunned period)</B></FONT><BR><BR>
-	 *
+	 * Launch the L2CharacterAI onEvt method corresponding to the Event.<br>
+	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned period)</B></FONT>
 	 * @param evt The event whose the AI must be notified
-	 *
 	 */
 	@Override
 	public final void notifyEvent(CtrlEvent evt)
@@ -368,14 +317,9 @@ public abstract class AbstractAI implements Ctrl
 	}
 	
 	/**
-	 * Launch the L2CharacterAI onEvt method corresponding to the Event.<BR><BR>
-	 *
-	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : The current general intention won't be change
-	 * (ex : If the character attack and is stunned, he will attack again after the stunned period)</B></FONT><BR><BR>
-	 *
+	 * Launch the L2CharacterAI onEvt method corresponding to the Event. <FONT COLOR=#FF0000><B> <U>Caution</U> : The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned period)</B></FONT>
 	 * @param evt The event whose the AI must be notified
 	 * @param arg0 The first parameter of the Event (optional target)
-	 *
 	 */
 	@Override
 	public final void notifyEvent(CtrlEvent evt, Object arg0)
@@ -383,46 +327,11 @@ public abstract class AbstractAI implements Ctrl
 		notifyEvent(evt, arg0, null);
 	}
 	
-	/*
-	public final void informAIEvent(CtrlEvent evt) {
-		ThreadPoolManager.getInstance().executeAi(new InformAIEvent(this, evt, null, null));
-	}
-
-	public final void informAIEvent(CtrlEvent evt, Object arg0) {
-		ThreadPoolManager.getInstance().executeAi(new InformAIEvent(this, evt, arg0, null));
-	}
-
-	public final void informAIEvent(CtrlEvent evt, Object arg0, Object arg1) {
-		ThreadPoolManager.getInstance().executeAi(new InformAIEvent(this, evt, arg0, arg1));
-	}
-
-	public class InformAIEvent implements Runnable {
-		private AbstractAI _ai;
-		private CtrlEvent _evt;
-		private Object _arg0, _arg1;
-
-		public InformAIEvent(AbstractAI ai, CtrlEvent evt, Object arg0, Object arg1) {
-			_ai=ai;
-			_evt = evt;
-			_arg0 = arg0;
-			_arg1 = arg1;
-		}
-
-		public final void run() {
-			_ai.notifyEvent(_evt, _arg0, _arg1);
-		}
-	}
-	 */
 	/**
-	 * Launch the L2CharacterAI onEvt method corresponding to the Event.<BR><BR>
-	 *
-	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : The current general intention won't be change
-	 * (ex : If the character attack and is stunned, he will attack again after the stunned period)</B></FONT><BR><BR>
-	 *
+	 * Launch the L2CharacterAI onEvt method corresponding to the Event. <FONT COLOR=#FF0000><B> <U>Caution</U> : The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned period)</B></FONT>
 	 * @param evt The event whose the AI must be notified
 	 * @param arg0 The first parameter of the Event (optional target)
 	 * @param arg1 The second parameter of the Event (optional target)
-	 *
 	 */
 	@Override
 	public final void notifyEvent(CtrlEvent evt, Object arg0, Object arg1)
@@ -432,11 +341,6 @@ public abstract class AbstractAI implements Ctrl
 			return;
 		}
 		
-		/*
-		 if (Config.DEBUG)
-		 _log.warning("AbstractAI: notifyEvent -> " + evt + " " + arg0 + " " + arg1);
-		 */
-		
 		switch (evt)
 		{
 			case EVT_THINK:
@@ -471,7 +375,9 @@ public abstract class AbstractAI implements Ctrl
 				break;
 			case EVT_READY_TO_ACT:
 				if (!_actor.isCastingNow() && !_actor.isCastingSimultaneouslyNow())
+				{
 					onEvtReadyToAct();
+				}
 				break;
 			case EVT_USER_CMD:
 				onEvtUserCmd(arg0, arg1);
@@ -479,12 +385,16 @@ public abstract class AbstractAI implements Ctrl
 			case EVT_ARRIVED:
 				// happens e.g. from stopmove but we don't process it if we're casting
 				if (!_actor.isCastingNow() && !_actor.isCastingSimultaneouslyNow())
+				{
 					onEvtArrived();
+				}
 				break;
 			case EVT_ARRIVED_REVALIDATE:
 				// this is disregarded if the char is not moving any more
 				if (_actor.isMoving())
+				{
 					onEvtArrivedRevalidate();
+				}
 				break;
 			case EVT_ARRIVED_BLOCKED:
 				onEvtArrivedBlocked((L2CharPosition) arg0);
@@ -572,23 +482,21 @@ public abstract class AbstractAI implements Ctrl
 	protected abstract void onEvtFinishCasting();
 	
 	/**
-	 * Cancel action client side by sending Server->Client packet ActionFailed to the L2PcInstance actor.<BR><BR>
-	 *
-	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : Low level function, used by AI subclasses</B></FONT><BR><BR>
-	 *
+	 * Cancel action client side by sending Server->Client packet ActionFailed to the L2PcInstance actor. <FONT COLOR=#FF0000><B> <U>Caution</U> : Low level function, used by AI subclasses</B></FONT>
 	 */
 	protected void clientActionFailed()
 	{
 		if (_actor instanceof L2PcInstance)
+		{
 			_actor.sendPacket(ActionFailed.STATIC_PACKET);
+		}
 	}
 	
 	/**
-	 * Move the actor to Pawn server side AND client side by sending Server->Client packet MoveToPawn <I>(broadcast)</I>.<BR><BR>
-	 *
-	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : Low level function, used by AI subclasses</B></FONT><BR><BR>
-	 * @param pawn 
-	 * @param offset 
+	 * Move the actor to Pawn server side AND client side by sending Server->Client packet MoveToPawn <I>(broadcast)</I>.<br>
+	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : Low level function, used by AI subclasses</B></FONT>
+	 * @param pawn
+	 * @param offset
 	 */
 	protected void moveToPawn(L2Object pawn, int offset)
 	{
@@ -596,24 +504,30 @@ public abstract class AbstractAI implements Ctrl
 		if (!_actor.isMovementDisabled())
 		{
 			if (offset < 10)
+			{
 				offset = 10;
+			}
 			
 			// prevent possible extra calls to this function (there is none?),
 			// also don't send movetopawn packets too often
 			boolean sendPacket = true;
-			if (_clientMoving && _target == pawn)
+			if (_clientMoving && (_target == pawn))
 			{
 				if (_clientMovingToPawnOffset == offset)
 				{
 					if (GameTimeController.getGameTicks() < _moveToPawnTimeout)
+					{
 						return;
+					}
 					sendPacket = false;
 				}
 				else if (_actor.isOnGeodataPath())
 				{
 					// minimum time to calculate new route is 2 seconds
 					if (GameTimeController.getGameTicks() < (_moveToPawnTimeout + 10))
+					{
 						return;
+					}
 				}
 			}
 			
@@ -624,8 +538,10 @@ public abstract class AbstractAI implements Ctrl
 			_moveToPawnTimeout = GameTimeController.getGameTicks();
 			_moveToPawnTimeout += 1000 / GameTimeController.MILLIS_IN_TICK;
 			
-			if (pawn == null || _accessor == null)
+			if ((pawn == null) || (_accessor == null))
+			{
 				return;
+			}
 			
 			// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
 			_accessor.moveTo(pawn.getX(), pawn.getY(), pawn.getZ(), offset);
@@ -644,11 +560,15 @@ public abstract class AbstractAI implements Ctrl
 					_actor.broadcastPacket(new MoveToLocation(_actor));
 					_clientMovingToPawnOffset = 0;
 				}
-				else if (sendPacket) // don't repeat unnecessarily
+				else if (sendPacket)
+				{
 					_actor.broadcastPacket(new MoveToPawn(_actor, (L2Character) pawn, offset));
+				}
 			}
 			else
+			{
 				_actor.broadcastPacket(new MoveToLocation(_actor));
+			}
 		}
 		else
 		{
@@ -657,12 +577,11 @@ public abstract class AbstractAI implements Ctrl
 	}
 	
 	/**
-	 * Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation <I>(broadcast)</I>.<BR><BR>
-	 *
-	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : Low level function, used by AI subclasses</B></FONT><BR><BR>
-	 * @param x 
-	 * @param y 
-	 * @param z 
+	 * Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation <I>(broadcast)</I>.<br>
+	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : Low level function, used by AI subclasses</B></FONT>
+	 * @param x
+	 * @param y
+	 * @param z
 	 */
 	protected void moveTo(int x, int y, int z)
 	{
@@ -688,25 +607,21 @@ public abstract class AbstractAI implements Ctrl
 	}
 	
 	/**
-	 * Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation <I>(broadcast)</I>.<BR><BR>
-	 *
-	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : Low level function, used by AI subclasses</B></FONT><BR><BR>
-	 * @param pos 
+	 * Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation <I>(broadcast)</I>.<br>
+	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : Low level function, used by AI subclasses</B></FONT>
+	 * @param pos
 	 */
 	protected void clientStopMoving(L2CharPosition pos)
 	{
-		/*
-		 if (Config.DEBUG)
-		 _log.warning("clientStopMoving();");
-		 */
-		
 		// Stop movement of the L2Character
 		if (_actor.isMoving())
+		{
 			_accessor.stopMove(pos);
+		}
 		
 		_clientMovingToPawnOffset = 0;
 		
-		if (_clientMoving || pos != null)
+		if (_clientMoving || (pos != null))
 		{
 			_clientMoving = false;
 			
@@ -724,7 +639,9 @@ public abstract class AbstractAI implements Ctrl
 		}
 	}
 	
-	// Client has already arrived to target, no need to force StopMove packet
+	/**
+	 * Client has already arrived to target, no need to force StopMove packet.
+	 */
 	protected void clientStoppedMoving()
 	{
 		if (_clientMovingToPawnOffset > 0) // movetoPawn needs to be stopped
@@ -747,17 +664,17 @@ public abstract class AbstractAI implements Ctrl
 		{
 			L2Summon summon = (L2Summon) _actor;
 			if (summon.getOwner() != null)
+			{
 				summon.getOwner().getAI().setAutoAttacking(isAutoAttacking);
+			}
 			return;
 		}
 		_clientAutoAttacking = isAutoAttacking;
 	}
 	
 	/**
-	 * Start the actor Auto Attack client side by sending Server->Client packet AutoAttackStart <I>(broadcast)</I>.<BR><BR>
-	 *
-	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : Low level function, used by AI subclasses</B></FONT><BR><BR>
-	 *
+	 * Start the actor Auto Attack client side by sending Server->Client packet AutoAttackStart <I>(broadcast)</I>.<br>
+	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : Low level function, used by AI subclasses</B></FONT>
 	 */
 	public void clientStartAutoAttack()
 	{
@@ -765,13 +682,17 @@ public abstract class AbstractAI implements Ctrl
 		{
 			L2Summon summon = (L2Summon) _actor;
 			if (summon.getOwner() != null)
+			{
 				summon.getOwner().getAI().clientStartAutoAttack();
+			}
 			return;
 		}
 		if (!isAutoAttacking())
 		{
-			if (_actor instanceof L2PcInstance && ((L2PcInstance)_actor).getPet() != null)
-				((L2PcInstance)_actor).getPet().broadcastPacket(new AutoAttackStart(((L2PcInstance)_actor).getPet().getObjectId()));
+			if ((_actor instanceof L2PcInstance) && (((L2PcInstance) _actor).getPet() != null))
+			{
+				((L2PcInstance) _actor).getPet().broadcastPacket(new AutoAttackStart(((L2PcInstance) _actor).getPet().getObjectId()));
+			}
 			// Send a Server->Client packet AutoAttackStart to the actor and all L2PcInstance in its _knownPlayers
 			_actor.broadcastPacket(new AutoAttackStart(_actor.getObjectId()));
 			setAutoAttacking(true);
@@ -780,10 +701,8 @@ public abstract class AbstractAI implements Ctrl
 	}
 	
 	/**
-	 * Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop <I>(broadcast)</I>.<BR><BR>
-	 *
-	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : Low level function, used by AI subclasses</B></FONT><BR><BR>
-	 *
+	 * Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop <I>(broadcast)</I>.<br>
+	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : Low level function, used by AI subclasses</B></FONT>
 	 */
 	public void clientStopAutoAttack()
 	{
@@ -791,13 +710,17 @@ public abstract class AbstractAI implements Ctrl
 		{
 			L2Summon summon = (L2Summon) _actor;
 			if (summon.getOwner() != null)
+			{
 				summon.getOwner().getAI().clientStopAutoAttack();
+			}
 			return;
 		}
 		if (_actor instanceof L2PcInstance)
 		{
 			if (!AttackStanceTaskManager.getInstance().hasAttackStanceTask(_actor) && isAutoAttacking())
+			{
 				AttackStanceTaskManager.getInstance().addAttackStanceTask(_actor);
+			}
 		}
 		else if (isAutoAttacking())
 		{
@@ -807,10 +730,8 @@ public abstract class AbstractAI implements Ctrl
 	}
 	
 	/**
-	 * Kill the actor client side by sending Server->Client packet AutoAttackStop, StopMove/StopRotation, Die <I>(broadcast)</I>.<BR><BR>
-	 *
-	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : Low level function, used by AI subclasses</B></FONT><BR><BR>
-	 *
+	 * Kill the actor client side by sending Server->Client packet AutoAttackStop, StopMove/StopRotation, Die <I>(broadcast)</I>.<br>
+	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : Low level function, used by AI subclasses</B></FONT>
 	 */
 	protected void clientNotifyDead()
 	{
@@ -829,18 +750,15 @@ public abstract class AbstractAI implements Ctrl
 	}
 	
 	/**
-	 * Update the state of this actor client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the L2PcInstance player.<BR><BR>
-	 *
-	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : Low level function, used by AI subclasses</B></FONT><BR><BR>
-	 *
+	 * Update the state of this actor client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the L2PcInstance player.<br>
+	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : Low level function, used by AI subclasses</B></FONT>
 	 * @param player The L2PcIstance to notify with state of this L2Character
-	 *
 	 */
 	public void describeStateToPlayer(L2PcInstance player)
 	{
 		if (_clientMoving)
 		{
-			if (_clientMovingToPawnOffset != 0 && _followTarget != null)
+			if ((_clientMovingToPawnOffset != 0) && (_followTarget != null))
 			{
 				// Send a Server->Client packet MoveToPawn to the actor and all L2PcInstance in its _knownPlayers
 				MoveToPawn msg = new MoveToPawn(_actor, _followTarget, _clientMovingToPawnOffset);
@@ -856,10 +774,8 @@ public abstract class AbstractAI implements Ctrl
 	}
 	
 	/**
-	 * Create and Launch an AI Follow Task to execute every 1s.<BR><BR>
-	 *
+	 * Create and Launch an AI Follow Task to execute every 1s.
 	 * @param target The L2Character to follow
-	 *
 	 */
 	public synchronized void startFollow(L2Character target)
 	{
@@ -875,10 +791,9 @@ public abstract class AbstractAI implements Ctrl
 	}
 	
 	/**
-	 * Create and Launch an AI Follow Task to execute every 0.5s, following at specified range.<BR><BR>
-	 *
+	 * Create and Launch an AI Follow Task to execute every 0.5s, following at specified range.
 	 * @param target The L2Character to follow
-	 * @param range 
+	 * @param range
 	 */
 	public synchronized void startFollow(L2Character target, int range)
 	{
@@ -893,7 +808,7 @@ public abstract class AbstractAI implements Ctrl
 	}
 	
 	/**
-	 * Stop an AI Follow Task.<BR><BR>
+	 * Stop an AI Follow Task.
 	 */
 	public synchronized void stopFollow()
 	{
@@ -932,8 +847,6 @@ public abstract class AbstractAI implements Ctrl
 	@Override
 	public String toString()
 	{
-		if (_actor == null)
-			return "Actor: null";
 		return "Actor: " + _actor;
 	}
 }

+ 20 - 38
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/Ctrl.java

@@ -17,44 +17,26 @@ package com.l2jserver.gameserver.ai;
 import com.l2jserver.gameserver.model.actor.L2Character;
 
 /**
- * Interface of AI and client state.
- *
- * To correctly send messages to client we need it's state.
- * For example, if we've sent 'StartAutoAttack' message, we need to
- * send 'StopAutoAttack' message before any other action. Or
- * if we've sent 'MoveToPawn', we need to send 'StopMove' when
- * the movement of a character is canceled (by Root spell or
- * any other reason). Thus, we need to know the state of
- * client, i.e. which messages we've sent and how the client
- * will show the scene.
- *
- * Close to this task is the task of AI.
- * If a player's character is attacking a mob, his ATTACK may be
- * interrupted by an event, that temporary disable attacking.
- * But when the possibility to ATTACK will be enabled, the
- * character must continue the ATTACK. For mobs it may be
- * more complex, since we want them to decide when to use magic,
- * or when to follow the player for physical combat, or when to escape,
- * to help another mob, etc.
- *
- * This interface is hiding complexity of server<->client
- * interaction and multiple states of a character. It allows to
- * set a desired, simple "wish" of a character, and the implementation
- * of this interface will take care about the rest.
- * The goal of a character may be like "ATTACK", "random walk" and so on.
- * To reach the goal implementation will split it into several small
- * actions, several steps (possibly repeatable). Like "run to target"
- * then "hit it", then if target is not dead - repeat.
- * This flow of simpler steps may be interrupted by incoming events.
- * Like a character's movement was disabled (by Root spell, for instance).
- * Depending on character's ability AI may choose to wait, or to use
- * magic ATTACK and so on.
- * Additionally incoming events are compared with client's state
- * of the character, and required network messages are sent to
- * client's, i.e. if we have incoming event that character's movement
- * was disabled, it causes changing if its behavior, and if client's
- * state for the character is "moving" we send messages to clients
- * to stop the avatar/mob.
+ * Interface of AI and client state.<br>
+ * To correctly send messages to client we need it's state.<br>
+ * For example, if we've sent 'StartAutoAttack' message, we need to send 'StopAutoAttack' message before any other action.<br>
+ * Or if we've sent 'MoveToPawn', we need to send 'StopMove' when the movement of a character is canceled (by Root spell or any other reason).<br>
+ * Thus, we need to know the state of client, i.e. which messages we've sent and how the client will show the scene.<br>
+ * Close to this task is the task of AI.<br>
+ * If a player's character is attacking a mob, his ATTACK may be interrupted by an event, that temporary disable attacking.<br>
+ * But when the possibility to ATTACK will be enabled, the character must continue the ATTACK.<br>
+ * For mobs it may be more complex, since we want them to decide when to use magic, or when to follow the player for physical combat, or when to escape, to help another mob, etc.<br>
+ * This interface is hiding complexity of server<->client interaction and multiple states of a character.<br>
+ * It allows to set a desired, simple "wish" of a character, and the implementation of this interface will take care about the rest.<br>
+ * The goal of a character may be like "ATTACK", "random walk" and so on.<br>
+ * To reach the goal implementation will split it into several small actions, several steps (possibly repeatable).<br>
+ * Like "run to target" then "hit it", then if target is not dead - repeat.<br>
+ * This flow of simpler steps may be interrupted by incoming events.<br>
+ * Like a character's movement was disabled (by Root spell, for instance).<br>
+ * Depending on character's ability AI may choose to wait, or to use magic ATTACK and so on.<br>
+ * Additionally incoming events are compared with client's state of the character,<br>
+ * and required network messages are sent to client's, i.e. if we have incoming event that character's movement was disabled, it causes changing if its behavior,<br>
+ * and if client's state for the character is "moving" we send messages to clients to stop the avatar/mob.
  */
 public interface Ctrl
 {

+ 22 - 17
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/CtrlEvent.java

@@ -19,12 +19,13 @@ package com.l2jserver.gameserver.ai;
  */
 public enum CtrlEvent
 {
-	/** Something has changed, usually a previous step has being completed
-	 * or maybe was completed, the AI must thing on next action
+	/**
+	 * Something has changed, usually a previous step has being completed or maybe was completed, the AI must thing on next action.
 	 */
 	EVT_THINK,
-	/** The actor was attacked. This event comes each time a physical or magical
-	 * attack was done on the actor. NPC may start attack in response, or ignore
+	/**
+	 * The actor was attacked. This event comes each time a physical or magical<br>
+	 * attack was done on the actor. NPC may start attack in response, or ignore<br>
 	 * this event if they already attack someone, or change target and so on.
 	 */
 	EVT_ATTACKED,
@@ -40,27 +41,31 @@ public enum CtrlEvent
 	EVT_ROOTED,
 	/** Actor evaded hit **/
 	EVT_EVADED,
-	/** An event that previous action was completed. The action may be an attempt
-	 * to physically/magically hit an enemy, or an action that discarded
-	 * attack attempt has finished. */
+	/**
+	 * An event that previous action was completed. The action may be an attempt to physically/magically hit an enemy, or an action that discarded attack attempt has finished.
+	 */
 	EVT_READY_TO_ACT,
-	/** User's command, like using a combat magic or changing weapon, etc.
-	 * The command is not intended to change final goal */
+	/**
+	 * User's command, like using a combat magic or changing weapon, etc. The command is not intended to change final goal
+	 */
 	EVT_USER_CMD,
-	/** The actor arrived to assigned location, or it's a time to modify
-	 * movement destination (follow, interact, random move and others intentions). */
+	/**
+	 * The actor arrived to assigned location, or it's a time to modify movement destination (follow, interact, random move and others intentions).
+	 */
 	EVT_ARRIVED,
-	/** The actor arrived to an intermediate point, and needs to revalidate destination.
-	 * This is sent when follow/move to pawn if destination is far away. */
+	/**
+	 * The actor arrived to an intermediate point, and needs to revalidate destination. This is sent when follow/move to pawn if destination is far away.
+	 */
 	EVT_ARRIVED_REVALIDATE,
 	/** The actor cannot move anymore. */
 	EVT_ARRIVED_BLOCKED,
 	/** Forgets an object (if it's used as attack target, follow target and so on */
 	EVT_FORGET_OBJECT,
-	/** Attempt to cancel current step execution, but not change the intention.
-	 * For example, the actor was put into a stun, so it's current attack
-	 * or movement has to be canceled. But after the stun state expired, the
-	 * actor may try to attack again. Another usage for CANCEL is a user's
+	/**
+	 * Attempt to cancel current step execution, but not change the intention.<br>
+	 * For example, the actor was put into a stun, so it's current attack<br>
+	 * or movement has to be canceled. But after the stun state expired,<br>
+	 * the actor may try to attack again. Another usage for CANCEL is a user's<br>
 	 * attempt to cancel a cast/bow attack and so on.
 	 */
 	EVT_CANCEL,

+ 2 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/CtrlIntention.java

@@ -15,8 +15,7 @@
 package com.l2jserver.gameserver.ai;
 
 /**
- * Enumeration of generic intentions of an NPC/PC, an intention may require
- * several steps to be completed
+ * Enumeration of generic intentions of an NPC/PC, an intention may require several steps to be completed.
  */
 public enum CtrlIntention
 {
@@ -26,8 +25,7 @@ public enum CtrlIntention
 	AI_INTENTION_ACTIVE,
 	/** Rest (sit until attacked) */
 	AI_INTENTION_REST,
-	/** Attack target (cast combat magic, go to target, combat), may be ignored,
-	 * if target is locked on another character or a peaceful zone and so on */
+	/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
 	AI_INTENTION_ATTACK,
 	/** Cast a spell, depending on the spell - may start or stop attacking */
 	AI_INTENTION_CAST,

+ 6 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2AirShipAI.java

@@ -45,9 +45,11 @@ public class L2AirShipAI extends L2VehicleAI
 	protected void clientStopMoving(L2CharPosition pos)
 	{
 		if (_actor.isMoving())
+		{
 			_accessor.stopMove(pos);
+		}
 		
-		if (_clientMoving || pos != null)
+		if (_clientMoving || (pos != null))
 		{
 			_clientMoving = false;
 			_actor.broadcastPacket(new ExStopMoveAirShip(getActor()));
@@ -58,12 +60,14 @@ public class L2AirShipAI extends L2VehicleAI
 	public void describeStateToPlayer(L2PcInstance player)
 	{
 		if (_clientMoving)
+		{
 			player.sendPacket(new ExMoveToLocationAirShip(getActor()));
+		}
 	}
 	
 	@Override
 	public L2AirShipInstance getActor()
 	{
-		return (L2AirShipInstance)_actor;
+		return (L2AirShipInstance) _actor;
 	}
 }

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 268 - 140
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2AttackableAI.java


+ 8 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2BoatAI.java

@@ -37,7 +37,9 @@ public class L2BoatAI extends L2VehicleAI
 		if (!_actor.isMovementDisabled())
 		{
 			if (!_clientMoving)
+			{
 				_actor.broadcastPacket(new VehicleStarted(getActor(), 1));
+			}
 			
 			_clientMoving = true;
 			_accessor.moveTo(x, y, z);
@@ -49,9 +51,11 @@ public class L2BoatAI extends L2VehicleAI
 	protected void clientStopMoving(L2CharPosition pos)
 	{
 		if (_actor.isMoving())
+		{
 			_accessor.stopMove(pos);
+		}
 		
-		if (_clientMoving || pos != null)
+		if (_clientMoving || (pos != null))
 		{
 			_clientMoving = false;
 			_actor.broadcastPacket(new VehicleStarted(getActor(), 0));
@@ -63,12 +67,14 @@ public class L2BoatAI extends L2VehicleAI
 	public void describeStateToPlayer(L2PcInstance player)
 	{
 		if (_clientMoving)
+		{
 			player.sendPacket(new VehicleDeparture(getActor()));
+		}
 	}
 	
 	@Override
 	public L2BoatInstance getActor()
 	{
-		return (L2BoatInstance)_actor;
+		return (L2BoatInstance) _actor;
 	}
 }

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 292 - 227
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2CharacterAI.java


+ 4 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2DoorAI.java

@@ -32,7 +32,7 @@ public class L2DoorAI extends L2CharacterAI
 		super(accessor);
 	}
 	
-	// rather stupid AI... well,  it's for doors :D
+	// rather stupid AI... well, it's for doors :D
 	@Override
 	protected void onIntentionIdle()
 	{
@@ -152,8 +152,8 @@ public class L2DoorAI extends L2CharacterAI
 	
 	private class onEventAttackedDoorTask implements Runnable
 	{
-		private L2DoorInstance _door;
-		private L2Character _attacker;
+		private final L2DoorInstance _door;
+		private final L2Character _attacker;
 		
 		public onEventAttackedDoorTask(L2DoorInstance door, L2Character attacker)
 		{
@@ -166,7 +166,7 @@ public class L2DoorAI extends L2CharacterAI
 		{
 			for (L2DefenderInstance guard : _door.getKnownDefenders())
 			{
-				if (_actor.isInsideRadius(guard, guard.getFactionRange(), false, true) && Math.abs(_attacker.getZ() - guard.getZ()) < 200)
+				if (_actor.isInsideRadius(guard, guard.getFactionRange(), false, true) && (Math.abs(_attacker.getZ() - guard.getZ()) < 200))
 				{
 					guard.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, _attacker, 15);
 				}

+ 214 - 100
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2FortSiegeGuardAI.java

@@ -50,11 +50,11 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 {
 	private static final int MAX_ATTACK_TIMEOUT = 300; // int ticks, i.e. 30 seconds
 	
-	/** The L2Attackable AI task executed every 1s (call onEvtThink method)*/
+	/** The L2Attackable AI task executed every 1s (call onEvtThink method) */
 	private Future<?> _aiTask;
 	
 	/** For attack AI, analysis of mob and its targets */
-	private SelfAnalysis _selfAnalysis = new SelfAnalysis();
+	private final SelfAnalysis _selfAnalysis = new SelfAnalysis();
 	
 	/** The delay after which the attacked is stopped */
 	private int _attackTimeout;
@@ -65,13 +65,11 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 	/** The flag used to indicate that a thinking action is in progress */
 	private boolean _thinking; // to prevent recursive thinking
 	
-	private int _attackRange;
+	private final int _attackRange;
 	
 	/**
-	 * Constructor of L2AttackableAI.<BR><BR>
-	 *
+	 * Constructor of L2AttackableAI.
 	 * @param accessor The AI accessor of the L2Character
-	 *
 	 */
 	public L2FortSiegeGuardAI(L2Character.AIAccessor accessor)
 	{
@@ -90,59 +88,71 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 	}
 	
 	/**
-	 * <B><U> Actor is a L2GuardInstance</U> :</B><BR><BR>
+	 * <B><U> Actor is a L2GuardInstance</U> :</B>
+	 * <ul>
 	 * <li>The target isn't a Folk or a Door</li>
 	 * <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
 	 * <li>The target is in the actor Aggro range and is at the same height</li>
 	 * <li>The L2PcInstance target has karma (=PK)</li>
-	 * <li>The L2MonsterInstance target is aggressive</li><BR><BR>
-	 *
-	 * <B><U> Actor is a L2SiegeGuardInstance</U> :</B><BR><BR>
+	 * <li>The L2MonsterInstance target is aggressive</li>
+	 * </ul>
+	 * <B><U> Actor is a L2SiegeGuardInstance</U> :</B>
+	 * <ul>
 	 * <li>The target isn't a Folk or a Door</li>
 	 * <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
 	 * <li>The target is in the actor Aggro range and is at the same height</li>
 	 * <li>A siege is in progress</li>
-	 * <li>The L2PcInstance target isn't a Defender</li><BR><BR>
-	 *
-	 * <B><U> Actor is a L2FriendlyMobInstance</U> :</B><BR><BR>
+	 * <li>The L2PcInstance target isn't a Defender</li>
+	 * </ul>
+	 * <B><U> Actor is a L2FriendlyMobInstance</U> :</B>
+	 * <ul>
 	 * <li>The target isn't a Folk, a Door or another L2NpcInstance</li>
 	 * <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
 	 * <li>The target is in the actor Aggro range and is at the same height</li>
-	 * <li>The L2PcInstance target has karma (=PK)</li><BR><BR>
-	 *
-	 * <B><U> Actor is a L2MonsterInstance</U> :</B><BR><BR>
+	 * <li>The L2PcInstance target has karma (=PK)</li>
+	 * </ul>
+	 * <B><U> Actor is a L2MonsterInstance</U> :</B>
+	 * <ul>
 	 * <li>The target isn't a Folk, a Door or another L2NpcInstance</li>
 	 * <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
 	 * <li>The target is in the actor Aggro range and is at the same height</li>
-	 * <li>The actor is Aggressive</li><BR><BR>
-	 *
+	 * <li>The actor is Aggressive</li>
+	 * </ul>
 	 * @param target The targeted L2Object
 	 * @return True if the target is autoattackable (depends on the actor type).
 	 */
 	private boolean autoAttackCondition(L2Character target)
 	{
 		// Check if the target isn't another guard, folk or a door
-		if (target == null || target instanceof L2DefenderInstance || target instanceof L2NpcInstance || target instanceof L2DoorInstance
-				|| target.isAlikeDead() || target instanceof L2FortBallistaInstance || target instanceof L2FortCommanderInstance
-				|| target instanceof L2Playable)
+		if ((target == null) || (target instanceof L2DefenderInstance) || (target instanceof L2NpcInstance) || (target instanceof L2DoorInstance) || target.isAlikeDead() || (target instanceof L2FortBallistaInstance) || (target instanceof L2FortCommanderInstance) || (target instanceof L2Playable))
 		{
 			L2PcInstance player = null;
 			if (target instanceof L2PcInstance)
-				player = ((L2PcInstance)target);
+			{
+				player = ((L2PcInstance) target);
+			}
 			else if (target instanceof L2Summon)
+			{
 				player = ((L2Summon) target).getOwner();
-			if (player == null || (player.getClan() != null && player.getClan().getFortId() == ((L2Npc) _actor).getFort().getFortId()))
+			}
+			if ((player == null) || ((player.getClan() != null) && (player.getClan().getFortId() == ((L2Npc) _actor).getFort().getFortId())))
+			{
 				return false;
+			}
 		}
 		
 		// Check if the target isn't invulnerable
 		if ((target != null) && target.isInvul())
 		{
 			// However EffectInvincible requires to check GMs specially
-			if (target instanceof L2PcInstance && ((L2PcInstance) target).isGM())
+			if ((target instanceof L2PcInstance) && ((L2PcInstance) target).isGM())
+			{
 				return false;
-			if (target instanceof L2Summon && ((L2Summon) target).getOwner().isGM())
+			}
+			if ((target instanceof L2Summon) && ((L2Summon) target).getOwner().isGM())
+			{
 				return false;
+			}
 		}
 		
 		// Get the owner if the target is a summon
@@ -150,7 +160,9 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 		{
 			L2PcInstance owner = ((L2Summon) target).getOwner();
 			if (_actor.isInsideRadius(owner, 1000, true, false))
+			{
 				target = owner;
+			}
 		}
 		
 		// Check if the target is a L2PcInstance
@@ -158,7 +170,9 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 		{
 			// Check if the target isn't in silent move mode AND too far (>100)
 			if (((L2Playable) target).isSilentMoving() && !_actor.isInsideRadius(target, 250, false, false))
+			{
 				return false;
+			}
 		}
 		// Los Check Here
 		return (_actor.isAutoAttackable(target) && GeoData.getInstance().canSeeTarget(_actor, target));
@@ -166,22 +180,21 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 	}
 	
 	/**
-	 * Set the Intention of this L2CharacterAI and create an  AI Task executed every 1s (call onEvtThink method) for this L2Attackable.<BR><BR>
-	 *
-	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : If actor _knowPlayer isn't EMPTY, AI_INTENTION_IDLE will be change in AI_INTENTION_ACTIVE</B></FONT><BR><BR>
-	 *
+	 * Set the Intention of this L2CharacterAI and create an AI Task executed every 1s (call onEvtThink method) for this L2Attackable.<br>
+	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : If actor _knowPlayer isn't EMPTY, AI_INTENTION_IDLE will be change in AI_INTENTION_ACTIVE</B></FONT>
 	 * @param intention The new Intention to set to the AI
 	 * @param arg0 The first parameter of the Intention
 	 * @param arg1 The second parameter of the Intention
-	 *
 	 */
 	@Override
 	synchronized void changeIntention(CtrlIntention intention, Object arg0, Object arg1)
 	{
 		if (Config.DEBUG)
+		{
 			_log.warning(getClass().getSimpleName() + ": changeIntention(" + intention + ", " + arg0 + ", " + arg1 + ")");
+		}
 		
-		if (intention == AI_INTENTION_IDLE /*|| intention == AI_INTENTION_ACTIVE*/) // active becomes idle if only a summon is present
+		if (intention == AI_INTENTION_IDLE /* || intention == AI_INTENTION_ACTIVE */) // active becomes idle if only a summon is present
 		{
 			// Check if actor is not dead
 			if (!_actor.isAlikeDead())
@@ -190,9 +203,13 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 				
 				// If its _knownPlayer isn't empty set the Intention to AI_INTENTION_ACTIVE
 				if (!npc.getKnownList().getKnownPlayers().isEmpty())
+				{
 					intention = AI_INTENTION_ACTIVE;
+				}
 				else
+				{
 					intention = AI_INTENTION_IDLE;
+				}
 			}
 			
 			if (intention == AI_INTENTION_IDLE)
@@ -225,10 +242,8 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 	}
 	
 	/**
-	 * Manage the Attack Intention : Stop current Attack (if necessary), Calculate attack timeout, Start a new Attack and Launch Think Event.<BR><BR>
-	 *
+	 * Manage the Attack Intention : Stop current Attack (if necessary), Calculate attack timeout, Start a new Attack and Launch Think Event.
 	 * @param target The L2Character to attack
-	 *
 	 */
 	@Override
 	protected void onIntentionAttack(L2Character target)
@@ -237,18 +252,18 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 		_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks();
 		
 		// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
-		//if (_actor.getTarget() != null)
+		// if (_actor.getTarget() != null)
 		super.onIntentionAttack(target);
 	}
 	
 	/**
-	 * Manage AI standard thinks of a L2Attackable (called by onEvtThink).<BR><BR>
-	 *
-	 * <B><U> Actions</U> :</B><BR><BR>
+	 * Manage AI standard thinks of a L2Attackable (called by onEvtThink).<br>
+	 * <B><U> Actions</U> :</B>
+	 * <ul>
 	 * <li>Update every 1s the _globalAggro counter to come close to 0</li>
 	 * <li>If the actor is Aggressive and can attack, add all autoAttackable L2Character in its Aggro Range to its _aggroList, chose a target and order to attack it</li>
-	 * <li>If the actor  can't attack, order to it to return to its home location</li>
-	 *
+	 * <li>If the actor can't attack, order to it to return to its home location</li>
+	 * </ul>
 	 */
 	private void thinkActive()
 	{
@@ -258,9 +273,13 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 		if (_globalAggro != 0)
 		{
 			if (_globalAggro < 0)
+			{
 				_globalAggro++;
+			}
 			else
+			{
 				_globalAggro--;
+			}
 		}
 		
 		// Add all autoAttackable L2Character in L2Attackable Aggro Range to its _aggroList with 0 damage and 1 hate
@@ -270,7 +289,9 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 			for (L2Character target : npc.getKnownList().getKnownCharactersInRadius(_attackRange))
 			{
 				if (target == null)
+				{
 					continue;
+				}
 				if (autoAttackCondition(target)) // check aggression
 				{
 					// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
@@ -278,17 +299,23 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 					
 					// Add the attacker to the L2Attackable _aggroList with 0 damage and 1 hate
 					if (hating == 0)
+					{
 						npc.addDamageHate(target, 0, 1);
+					}
 				}
 			}
 			
 			// Chose a target from its aggroList
 			L2Character hated;
 			if (_actor.isConfused())
+			{
 				hated = getAttackTarget(); // Force mobs to attack anybody if confused
+			}
 			else
+			{
 				hated = npc.getMostHated();
-			//_mostHatedAnalysis.Update(hated);
+				// _mostHatedAnalysis.Update(hated);
+			}
 			
 			// Order to the L2Attackable to attack the target
 			if (hated != null)
@@ -296,11 +323,13 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 				// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
 				int aggro = npc.getHating(hated);
 				
-				if (aggro + _globalAggro > 0)
+				if ((aggro + _globalAggro) > 0)
 				{
 					// Set the L2Character movement type to run and send Server->Client packet ChangeMoveType to all others L2PcInstance
 					if (!_actor.isRunning())
+					{
 						_actor.setRunning();
+					}
 					
 					// Set the AI Intention to AI_INTENTION_ATTACK
 					setIntention(CtrlIntention.AI_INTENTION_ATTACK, hated, null);
@@ -314,28 +343,33 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 		if (_actor.getWalkSpeed() >= 0)
 		{
 			if (_actor instanceof L2DefenderInstance)
+			{
 				((L2DefenderInstance) _actor).returnHome();
+			}
 			else
+			{
 				((L2FortCommanderInstance) _actor).returnHome();
+			}
 		}
 	}
 	
 	/**
-	 * Manage AI attack thinks of a L2Attackable (called by onEvtThink).<BR><BR>
-	 *
-	 * <B><U> Actions</U> :</B><BR><BR>
+	 * Manage AI attack thinks of a L2Attackable (called by onEvtThink).<br>
+	 * <B><U> Actions</U> :</B>
+	 * <ul>
 	 * <li>Update the attack timeout if actor is running</li>
 	 * <li>If target is dead or timeout is expired, stop this attack and set the Intention to AI_INTENTION_ACTIVE</li>
 	 * <li>Call all L2Object of its Faction inside the Faction Range</li>
-	 * <li>Chose a target and order to attack it with magic skill or physical attack</li><BR><BR>
-	 *
+	 * <li>Chose a target and order to attack it with magic skill or physical attack</li>
+	 * </ul>
 	 * TODO: Manage casting rules to healer mobs (like Ant Nurses)
-	 *
 	 */
 	private void thinkAttack()
 	{
 		if (Config.DEBUG)
+		{
 			_log.warning(getClass().getSimpleName() + ": thinkAttack(); timeout=" + (_attackTimeout - GameTimeController.getGameTicks()));
+		}
 		
 		if (_attackTimeout < GameTimeController.getGameTicks())
 		{
@@ -352,7 +386,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 		
 		L2Character attackTarget = getAttackTarget();
 		// Check if target is dead or if timeout is expired to stop this attack
-		if (attackTarget == null || attackTarget.isAlikeDead() || _attackTimeout < GameTimeController.getGameTicks())
+		if ((attackTarget == null) || attackTarget.isAlikeDead() || (_attackTimeout < GameTimeController.getGameTicks()))
 		{
 			// Stop hating this target after the attack timeout or if target is dead
 			if (attackTarget != null)
@@ -380,42 +414,58 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 	{
 		L2Character target = getAttackTarget();
 		// Call all L2Object of its Faction inside the Faction Range
-		if (((L2Npc) _actor).getFactionId() == null || target == null)
+		if ((((L2Npc) _actor).getFactionId() == null) || (target == null))
+		{
 			return;
+		}
 		
 		if (target.isInvul())
+		{
 			return; // speeding it up for siege guards
+		}
 		
 		String faction_id = ((L2Npc) _actor).getFactionId();
 		
 		// Go through all L2Character that belong to its faction
-		//for (L2Character cha : _actor.getKnownList().getKnownCharactersInRadius(((L2NpcInstance) _actor).getFactionRange()+_actor.getTemplate().collisionRadius))
+		// for (L2Character cha : _actor.getKnownList().getKnownCharactersInRadius(((L2NpcInstance) _actor).getFactionRange()+_actor.getTemplate().collisionRadius))
 		for (L2Character cha : _actor.getKnownList().getKnownCharactersInRadius(1000))
 		{
 			if (cha == null)
+			{
 				continue;
+			}
 			
 			if (!(cha instanceof L2Npc))
 			{
-				if (_selfAnalysis.hasHealOrResurrect && cha instanceof L2PcInstance && ((L2Npc) _actor).getFort().getSiege().checkIsDefender(((L2PcInstance) cha).getClan()))
+				if (_selfAnalysis.hasHealOrResurrect && (cha instanceof L2PcInstance) && ((L2Npc) _actor).getFort().getSiege().checkIsDefender(((L2PcInstance) cha).getClan()))
 				{
 					// heal friends
-					if (!_actor.isAttackingDisabled() && cha.getCurrentHp() < cha.getMaxHp() * 0.6 && _actor.getCurrentHp() > _actor.getMaxHp() / 2 && _actor.getCurrentMp() > _actor.getMaxMp() / 2 && cha.isInCombat())
+					if (!_actor.isAttackingDisabled() && (cha.getCurrentHp() < (cha.getMaxHp() * 0.6)) && (_actor.getCurrentHp() > (_actor.getMaxHp() / 2)) && (_actor.getCurrentMp() > (_actor.getMaxMp() / 2)) && cha.isInCombat())
 					{
 						for (L2Skill sk : _selfAnalysis.healSkills)
 						{
 							if (_actor.getCurrentMp() < sk.getMpConsume())
+							{
 								continue;
+							}
 							if (_actor.isSkillDisabled(sk))
+							{
 								continue;
+							}
 							if (!Util.checkIfInRange(sk.getCastRange(), _actor, cha, true))
+							{
 								continue;
+							}
 							
 							int chance = 5;
-							if (chance >= Rnd.get(100)) // chance
+							if (chance >= Rnd.get(100))
+							{
 								continue;
+							}
 							if (!GeoData.getInstance().canSeeTarget(_actor, cha))
+							{
 								break;
+							}
 							
 							L2Object OldTarget = _actor.getTarget();
 							_actor.setTarget(cha);
@@ -432,38 +482,49 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 			L2Npc npc = (L2Npc) cha;
 			
 			if (!faction_id.equals(npc.getFactionId()))
+			{
 				continue;
+			}
 			
 			if (npc.getAI() != null) // TODO: possibly check not needed
 			{
-				if (!npc.isDead() && Math.abs(target.getZ() - npc.getZ()) < 600
-						//&& _actor.getAttackByList().contains(getAttackTarget())
-						&& (npc.getAI()._intention == CtrlIntention.AI_INTENTION_IDLE || npc.getAI()._intention == CtrlIntention.AI_INTENTION_ACTIVE)
-						//limiting aggro for siege guards
-						&& target.isInsideRadius(npc, 1500, true, false) && GeoData.getInstance().canSeeTarget(npc, target))
+				if (!npc.isDead() && (Math.abs(target.getZ() - npc.getZ()) < 600)
+				// && _actor.getAttackByList().contains(getAttackTarget())
+				&& ((npc.getAI()._intention == CtrlIntention.AI_INTENTION_IDLE) || (npc.getAI()._intention == CtrlIntention.AI_INTENTION_ACTIVE))
+				// limiting aggro for siege guards
+				&& target.isInsideRadius(npc, 1500, true, false) && GeoData.getInstance().canSeeTarget(npc, target))
 				{
 					// Notify the L2Object AI with EVT_AGGRESSION
 					npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, getAttackTarget(), 1);
 					return;
 				}
 				// heal friends
-				if (_selfAnalysis.hasHealOrResurrect && !_actor.isAttackingDisabled() && npc.getCurrentHp() < npc.getMaxHp() * 0.6 && _actor.getCurrentHp() > _actor.getMaxHp() / 2 && _actor.getCurrentMp() > _actor.getMaxMp() / 2
-						&& npc.isInCombat())
+				if (_selfAnalysis.hasHealOrResurrect && !_actor.isAttackingDisabled() && (npc.getCurrentHp() < (npc.getMaxHp() * 0.6)) && (_actor.getCurrentHp() > (_actor.getMaxHp() / 2)) && (_actor.getCurrentMp() > (_actor.getMaxMp() / 2)) && npc.isInCombat())
 				{
 					for (L2Skill sk : _selfAnalysis.healSkills)
 					{
 						if (_actor.getCurrentMp() < sk.getMpConsume())
+						{
 							continue;
+						}
 						if (_actor.isSkillDisabled(sk))
+						{
 							continue;
+						}
 						if (!Util.checkIfInRange(sk.getCastRange(), _actor, npc, true))
+						{
 							continue;
+						}
 						
 						int chance = 4;
-						if (chance >= Rnd.get(100)) // chance
+						if (chance >= Rnd.get(100))
+						{
 							continue;
+						}
 						if (!GeoData.getInstance().canSeeTarget(_actor, npc))
+						{
 							break;
+						}
 						
 						L2Object OldTarget = _actor.getTarget();
 						_actor.setTarget(npc);
@@ -485,9 +546,13 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 		int range = 0;
 		L2DefenderInstance sGuard;
 		if (_actor instanceof L2FortCommanderInstance)
+		{
 			sGuard = (L2FortCommanderInstance) _actor;
+		}
 		else
+		{
 			sGuard = (L2DefenderInstance) _actor;
+		}
 		L2Character attackTarget = getAttackTarget();
 		
 		try
@@ -497,18 +562,20 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 			dist_2 = _actor.getPlanDistanceSq(attackTarget.getX(), attackTarget.getY());
 			range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + attackTarget.getTemplate().getCollisionRadius();
 			if (attackTarget.isMoving())
+			{
 				range += 50;
+			}
 		}
 		catch (NullPointerException e)
 		{
-			//_log.warning("AttackableAI: Attack target is NULL.");
+			// _log.warning("AttackableAI: Attack target is NULL.");
 			_actor.setTarget(null);
 			setIntention(AI_INTENTION_IDLE, null, null);
 			return;
 		}
 		
 		// never attack defenders
-		if (attackTarget instanceof L2PcInstance && sGuard.getFort().getSiege().checkIsDefender(((L2PcInstance) attackTarget).getClan()))
+		if ((attackTarget instanceof L2PcInstance) && sGuard.getFort().getSiege().checkIsDefender(((L2PcInstance) attackTarget).getClan()))
 		{
 			// Cancel the target
 			sGuard.stopHating(attackTarget);
@@ -528,21 +595,21 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 		}
 		
 		// Check if the actor isn't muted and if it is far from target
-		if (!_actor.isMuted() && dist_2 > range * range)
+		if (!_actor.isMuted() && (dist_2 > (range * range)))
 		{
 			// check for long ranged skills and heal/buff skills
 			for (L2Skill sk : skills)
 			{
 				int castRange = sk.getCastRange();
 				
-				if ((dist_2 <= castRange * castRange) && castRange > 70 && !_actor.isSkillDisabled(sk) && _actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk) && !sk.isPassive())
+				if ((dist_2 <= (castRange * castRange)) && (castRange > 70) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !sk.isPassive())
 				{
 					
 					L2Object OldTarget = _actor.getTarget();
-					if (sk.getSkillType() == L2SkillType.BUFF || sk.getSkillType() == L2SkillType.HEAL)
+					if ((sk.getSkillType() == L2SkillType.BUFF) || (sk.getSkillType() == L2SkillType.HEAL))
 					{
 						boolean useSkillSelf = true;
-						if (sk.getSkillType() == L2SkillType.HEAL && _actor.getCurrentHp() > (int) (_actor.getMaxHp() / 1.5))
+						if ((sk.getSkillType() == L2SkillType.HEAL) && (_actor.getCurrentHp() > (int) (_actor.getMaxHp() / 1.5)))
 						{
 							useSkillSelf = false;
 							break;
@@ -550,7 +617,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 						if (sk.getSkillType() == L2SkillType.BUFF)
 						{
 							L2Effect[] effects = _actor.getAllEffects();
-							for (int i = 0; effects != null && i < effects.length; i++)
+							for (int i = 0; (effects != null) && (i < effects.length); i++)
 							{
 								L2Effect effect = effects[i];
 								if (effect.getSkill() == sk)
@@ -561,7 +628,9 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 							}
 						}
 						if (useSkillSelf)
+						{
 							_actor.setTarget(_actor);
+						}
 					}
 					
 					clientStopMoving(null);
@@ -588,8 +657,8 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 				double homeY = attackTarget.getY() - sGuard.getSpawn().getLocy();
 				
 				// Check if the L2SiegeGuardInstance isn't too far from it's home location
-				if ((dx * dx + dy * dy > 10000) && (homeX * homeX + homeY * homeY > 3240000) // 1800 * 1800
-						&& (_actor.getKnownList().knowsObject(attackTarget)))
+				if ((((dx * dx) + (dy * dy)) > 10000) && (((homeX * homeX) + (homeY * homeY)) > 3240000) // 1800 * 1800
+					&& (_actor.getKnownList().knowsObject(attackTarget)))
 				{
 					// Cancel the target
 					_actor.getKnownList().removeKnownObject(attackTarget);
@@ -597,20 +666,28 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 					setIntention(AI_INTENTION_IDLE, null, null);
 				}
 				else
-					// Move the actor to Pawn server side AND client side by sending Server->Client packet MoveToPawn (broadcast)
+				// Move the actor to Pawn server side AND client side by sending Server->Client packet MoveToPawn (broadcast)
 				{
 					// Temporary hack for preventing guards jumping off towers,
 					// before replacing this with effective geodata checks and AI modification
-					if (dz * dz < 170 * 170) // normally 130 if guard z coordinates correct
+					if ((dz * dz) < (170 * 170)) // normally 130 if guard z coordinates correct
 					{
 						if (_selfAnalysis.isMage)
+						{
 							range = _selfAnalysis.maxCastRange - 50;
+						}
 						if (_actor.getWalkSpeed() <= 0)
+						{
 							return;
+						}
 						if (attackTarget.isMoving())
+						{
 							moveToPawn(attackTarget, range - 70);
+						}
 						else
+						{
 							moveToPawn(attackTarget, range);
+						}
 					}
 				}
 			}
@@ -619,33 +696,45 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 			
 		}
 		// Else, if the actor is muted and far from target, just "move to pawn"
-		else if (_actor.isMuted() && dist_2 > range * range)
+		else if (_actor.isMuted() && (dist_2 > (range * range)))
 		{
 			// Temporary hack for preventing guards jumping off towers,
 			// before replacing this with effective geodata checks and AI modification
 			double dz = _actor.getZ() - attackTarget.getZ();
-			if (dz * dz < 170 * 170) // normally 130 if guard z coordinates correct
+			if ((dz * dz) < (170 * 170)) // normally 130 if guard z coordinates correct
 			{
 				if (_selfAnalysis.isMage)
+				{
 					range = _selfAnalysis.maxCastRange - 50;
+				}
 				if (_actor.getWalkSpeed() <= 0)
+				{
 					return;
+				}
 				if (attackTarget.isMoving())
+				{
 					moveToPawn(attackTarget, range - 70);
+				}
 				else
+				{
 					moveToPawn(attackTarget, range);
+				}
 			}
 			return;
 		}
 		// Else, if this is close enough to attack
-		else if (dist_2 <= range * range)
+		else if (dist_2 <= (range * range))
 		{
 			// Force mobs to attack anybody if confused
 			L2Character hated = null;
 			if (_actor.isConfused())
+			{
 				hated = attackTarget;
+			}
 			else
+			{
 				hated = ((L2Attackable) _actor).getMostHated();
+			}
 			
 			if (hated == null)
 			{
@@ -653,24 +742,26 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 				return;
 			}
 			if (hated != attackTarget)
+			{
 				attackTarget = hated;
+			}
 			
 			_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks();
 			
 			// check for close combat skills && heal/buff skills
-			if (!_actor.isMuted() && Rnd.nextInt(100) <= 5)
+			if (!_actor.isMuted() && (Rnd.nextInt(100) <= 5))
 			{
 				for (L2Skill sk : skills)
 				{
 					int castRange = sk.getCastRange();
 					
-					if (castRange * castRange >= dist_2 && !sk.isPassive() && _actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk) && !_actor.isSkillDisabled(sk))
+					if (((castRange * castRange) >= dist_2) && !sk.isPassive() && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !_actor.isSkillDisabled(sk))
 					{
 						L2Object OldTarget = _actor.getTarget();
-						if (sk.getSkillType() == L2SkillType.BUFF || sk.getSkillType() == L2SkillType.HEAL)
+						if ((sk.getSkillType() == L2SkillType.BUFF) || (sk.getSkillType() == L2SkillType.HEAL))
 						{
 							boolean useSkillSelf = true;
-							if (sk.getSkillType() == L2SkillType.HEAL && _actor.getCurrentHp() > (int) (_actor.getMaxHp() / 1.5))
+							if ((sk.getSkillType() == L2SkillType.HEAL) && (_actor.getCurrentHp() > (int) (_actor.getMaxHp() / 1.5)))
 							{
 								useSkillSelf = false;
 								break;
@@ -678,7 +769,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 							if (sk.getSkillType() == L2SkillType.BUFF)
 							{
 								L2Effect[] effects = _actor.getAllEffects();
-								for (int i = 0; effects != null && i < effects.length; i++)
+								for (int i = 0; (effects != null) && (i < effects.length); i++)
 								{
 									L2Effect effect = effects[i];
 									if (effect.getSkill() == sk)
@@ -689,7 +780,9 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 								}
 							}
 							if (useSkillSelf)
+							{
 								_actor.setTarget(_actor);
+							}
 						}
 						
 						clientStopMoving(null);
@@ -705,17 +798,19 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 	}
 	
 	/**
-	 * Manage AI thinking actions of a L2Attackable.<BR><BR>
+	 * Manage AI thinking actions of a L2Attackable.
 	 */
 	@Override
 	protected void onEvtThink()
 	{
-		//      if(getIntention() != AI_INTENTION_IDLE && (!_actor.isVisible() || !_actor.hasAI() || !_actor.isKnownPlayers()))
-		//          setIntention(AI_INTENTION_IDLE);
+		// if(getIntention() != AI_INTENTION_IDLE && (!_actor.isVisible() || !_actor.hasAI() || !_actor.isKnownPlayers()))
+		// setIntention(AI_INTENTION_IDLE);
 		
 		// Check if the actor can't use skills and if a thinking action isn't already in progress
 		if (_thinking || _actor.isCastingNow() || _actor.isAllSkillsDisabled())
+		{
 			return;
+		}
 		
 		// Start thinking action
 		_thinking = true;
@@ -724,9 +819,13 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 		{
 			// Manage AI thinks of a L2Attackable
 			if (getIntention() == AI_INTENTION_ACTIVE)
+			{
 				thinkActive();
+			}
 			else if (getIntention() == AI_INTENTION_ATTACK)
+			{
 				thinkAttack();
+			}
 		}
 		finally
 		{
@@ -736,15 +835,14 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 	}
 	
 	/**
-	 * Launch actions corresponding to the Event Attacked.<BR><BR>
-	 *
-	 * <B><U> Actions</U> :</B><BR><BR>
+	 * Launch actions corresponding to the Event Attacked.<br>
+	 * <B><U> Actions</U> :</B>
+	 * <ul>
 	 * <li>Init the attack : Calculate the attack timeout, Set the _globalAggro to 0, Add the attacker to the actor _aggroList</li>
 	 * <li>Set the L2Character movement type to run and send Server->Client packet ChangeMoveType to all others L2PcInstance</li>
-	 * <li>Set the Intention to AI_INTENTION_ATTACK</li><BR><BR>
-	 *
+	 * <li>Set the Intention to AI_INTENTION_ATTACK</li>
+	 * </ul>
 	 * @param attacker The L2Character that attacks the actor
-	 *
 	 */
 	@Override
 	protected void onEvtAttacked(L2Character attacker)
@@ -754,14 +852,18 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 		
 		// Set the _globalAggro to 0 to permit attack even just after spawn
 		if (_globalAggro < 0)
+		{
 			_globalAggro = 0;
+		}
 		
 		// Add the attacker to the _aggroList of the actor
 		((L2Attackable) _actor).addDamageHate(attacker, 0, 1);
 		
 		// Set the L2Character movement type to run and send Server->Client packet ChangeMoveType to all others L2PcInstance
 		if (!_actor.isRunning())
+		{
 			_actor.setRunning();
+		}
 		
 		// Set the Intention to AI_INTENTION_ATTACK
 		if (getIntention() != AI_INTENTION_ATTACK)
@@ -773,20 +875,21 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 	}
 	
 	/**
-	 * Launch actions corresponding to the Event Aggression.<BR><BR>
-	 *
-	 * <B><U> Actions</U> :</B><BR><BR>
-	 * <li>Add the target to the actor _aggroList or update hate if already present </li>
-	 * <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is L2GuardInstance check if it isn't too far from its home location)</li><BR><BR>
-	 *
+	 * Launch actions corresponding to the Event Aggression.<br>
+	 * <B><U> Actions</U> :</B>
+	 * <ul>
+	 * <li>Add the target to the actor _aggroList or update hate if already present</li>
+	 * <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is L2GuardInstance check if it isn't too far from its home location)</li>
+	 * </ul>
 	 * @param aggro The value of hate to add to the actor against the target
-	 *
 	 */
 	@Override
 	protected void onEvtAggression(L2Character target, int aggro)
 	{
 		if (_actor == null)
+		{
 			return;
+		}
 		L2Attackable me = (L2Attackable) _actor;
 		
 		if (target != null)
@@ -813,26 +916,36 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 			{
 				// Set the L2Character movement type to run and send Server->Client packet ChangeMoveType to all others L2PcInstance
 				if (!_actor.isRunning())
+				{
 					_actor.setRunning();
+				}
 				
 				L2DefenderInstance sGuard;
 				if (_actor instanceof L2FortCommanderInstance)
+				{
 					sGuard = (L2FortCommanderInstance) _actor;
+				}
 				else
+				{
 					sGuard = (L2DefenderInstance) _actor;
+				}
 				double homeX = target.getX() - sGuard.getSpawn().getLocx();
 				double homeY = target.getY() - sGuard.getSpawn().getLocy();
 				
 				// Check if the L2SiegeGuardInstance is not too far from its home location
-				if (homeX * homeX + homeY * homeY < 3240000) // 1800 * 1800
+				if (((homeX * homeX) + (homeY * homeY)) < 3240000)
+				{
 					setIntention(CtrlIntention.AI_INTENTION_ATTACK, target, null);
+				}
 			}
 		}
 		else
 		{
 			// currently only for setting lower general aggro
 			if (aggro >= 0)
+			{
 				return;
+			}
 			
 			L2Character mostHated = me.getMostHated();
 			if (mostHated == null)
@@ -842,7 +955,9 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 			}
 			
 			for (L2Character aggroed : me.getAggroList().keySet())
+			{
 				me.addDamageHate(aggroed, 0, aggro);
+			}
 			
 			aggro = me.getHating(mostHated);
 			if (aggro <= 0)
@@ -865,5 +980,4 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 		_accessor.detachAI();
 		super.stopAITask();
 	}
-	
-}
+}

+ 32 - 10
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2NpcWalkerAI.java

@@ -49,8 +49,7 @@ public class L2NpcWalkerAI extends L2CharacterAI implements Runnable
 	private int _currentPos;
 	
 	/**
-	 * Constructor of L2CharacterAI.<BR><BR>
-	 *
+	 * Constructor of L2CharacterAI.
 	 * @param accessor The AI accessor of the L2Character
 	 */
 	public L2NpcWalkerAI(L2Character.AIAccessor accessor)
@@ -58,16 +57,22 @@ public class L2NpcWalkerAI extends L2CharacterAI implements Runnable
 		super(accessor);
 		
 		if (!Config.ALLOW_NPC_WALKERS)
+		{
 			return;
+		}
 		
 		_route = NpcWalkerRoutesData.getInstance().getRouteForNpc(getActor().getNpcId());
 		
 		// Here we need 1 second initial delay cause getActor().hasAI() will return null...
 		// Constructor of L2NpcWalkerAI is called faster then ai object is attached in L2NpcWalkerInstance
 		if (_route != null)
+		{
 			ThreadPoolManager.getInstance().scheduleAiAtFixedRate(this, 1000, 1000);
+		}
 		else
-			_log.warning(getClass().getSimpleName()+": Missing route data! Npc: "+_actor);
+		{
+			_log.warning(getClass().getSimpleName() + ": Missing route data! Npc: " + _actor);
+		}
 	}
 	
 	@Override
@@ -80,7 +85,9 @@ public class L2NpcWalkerAI extends L2CharacterAI implements Runnable
 	protected void onEvtThink()
 	{
 		if (!Config.ALLOW_NPC_WALKERS)
+		{
 			return;
+		}
 		
 		if (isWalkingToNextPoint())
 		{
@@ -89,7 +96,9 @@ public class L2NpcWalkerAI extends L2CharacterAI implements Runnable
 		}
 		
 		if (_nextMoveTime < System.currentTimeMillis())
+		{
 			walkToLocation();
+		}
 	}
 	
 	/**
@@ -120,20 +129,26 @@ public class L2NpcWalkerAI extends L2CharacterAI implements Runnable
 			NpcStringId npcString = _route.get(_currentPos).getNpcString();
 			String chat = null;
 			if (npcString == null)
+			{
 				chat = _route.get(_currentPos).getChatText();
+			}
 			
-			if ((npcString != null) || (chat != null && !chat.isEmpty()))
+			if ((npcString != null) || ((chat != null) && !chat.isEmpty()))
+			{
 				getActor().broadcastChat(chat, npcString);
+			}
 			
-			//time in millis
+			// time in millis
 			long delay = _route.get(_currentPos).getDelay() * 1000;
 			
-			//sleeps between each move
+			// sleeps between each move
 			if (delay < 0)
 			{
 				delay = DEFAULT_MOVE_DELAY;
 				if (Config.DEVELOPER)
+				{
 					_log.warning(getClass().getSimpleName() + ": Wrong Delay Set in Npc Walker Functions = " + delay + " secs, using default delay: " + DEFAULT_MOVE_DELAY + " secs instead.");
+				}
 			}
 			
 			_nextMoveTime = System.currentTimeMillis() + delay;
@@ -144,27 +159,34 @@ public class L2NpcWalkerAI extends L2CharacterAI implements Runnable
 	private void walkToLocation()
 	{
 		if (_currentPos < (_route.size() - 1))
+		{
 			_currentPos++;
+		}
 		else
+		{
 			_currentPos = 0;
+		}
 		
 		boolean moveType = _route.get(_currentPos).getRunning();
 		
 		/**
-		 * false - walking
-		 * true - Running
+		 * false - walking true - Running
 		 */
 		if (moveType)
+		{
 			getActor().setRunning();
+		}
 		else
+		{
 			getActor().setWalking();
+		}
 		
-		//now we define destination
+		// now we define destination
 		int destinationX = _route.get(_currentPos).getMoveX();
 		int destinationY = _route.get(_currentPos).getMoveY();
 		int destinationZ = _route.get(_currentPos).getMoveZ();
 		
-		//notify AI of MOVE_TO
+		// notify AI of MOVE_TO
 		setWalkingToNextPoint(true);
 		
 		setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(destinationX, destinationY, destinationZ, 0));

+ 12 - 35
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2PlayableAI.java

@@ -23,19 +23,12 @@ import com.l2jserver.gameserver.model.zone.ZoneId;
 import com.l2jserver.gameserver.network.SystemMessageId;
 
 /**
- * 
- * This class manages AI of L2Playable.<BR><BR>
- *
- * L2PlayableAI :<BR><BR>
- * <li>L2SummonAI</li>
- * <li>L2PlayerAI</li>
- * <BR> <BR>
- * 
- * @author  JIV
+ * This class manages AI of L2Playable.<br>
+ * L2PlayableAI : <li>L2SummonAI</li> <li>L2PlayerAI</li>
+ * @author JIV
  */
 public abstract class L2PlayableAI extends L2CharacterAI
 {
-	
 	/**
 	 * @param accessor
 	 */
@@ -49,10 +42,7 @@ public abstract class L2PlayableAI extends L2CharacterAI
 	{
 		if (target instanceof L2Playable)
 		{
-			if (target.getActingPlayer().getProtectionBlessing()
-					&& (_actor.getActingPlayer().getLevel() - target.getActingPlayer().getLevel()) >= 10
-					&& _actor.getActingPlayer().getKarma() > 0
-					&& !(target.isInsideZone(ZoneId.PVP)))
+			if (target.getActingPlayer().getProtectionBlessing() && ((_actor.getActingPlayer().getLevel() - target.getActingPlayer().getLevel()) >= 10) && (_actor.getActingPlayer().getKarma() > 0) && !(target.isInsideZone(ZoneId.PVP)))
 			{
 				// If attacker have karma and have level >= 10 than his target and target have
 				// Newbie Protection Buff,
@@ -61,10 +51,7 @@ public abstract class L2PlayableAI extends L2CharacterAI
 				return;
 			}
 			
-			if (_actor.getActingPlayer().getProtectionBlessing()
-					&& (target.getActingPlayer().getLevel() - _actor.getActingPlayer().getLevel()) >= 10
-					&& target.getActingPlayer().getKarma() > 0
-					&& !(target.isInsideZone(ZoneId.PVP)))
+			if (_actor.getActingPlayer().getProtectionBlessing() && ((target.getActingPlayer().getLevel() - _actor.getActingPlayer().getLevel()) >= 10) && (target.getActingPlayer().getKarma() > 0) && !(target.isInsideZone(ZoneId.PVP)))
 			{
 				// If target have karma and have level >= 10 than his target and actor have
 				// Newbie Protection Buff,
@@ -73,16 +60,14 @@ public abstract class L2PlayableAI extends L2CharacterAI
 				return;
 			}
 			
-			if (target.getActingPlayer().isCursedWeaponEquipped()
-					&& _actor.getActingPlayer().getLevel() <= 20)
+			if (target.getActingPlayer().isCursedWeaponEquipped() && (_actor.getActingPlayer().getLevel() <= 20))
 			{
 				_actor.getActingPlayer().sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
 				clientActionFailed();
 				return;
 			}
 			
-			if (_actor.getActingPlayer().isCursedWeaponEquipped()
-					&& target.getActingPlayer().getLevel() <= 20)
+			if (_actor.getActingPlayer().isCursedWeaponEquipped() && (target.getActingPlayer().getLevel() <= 20))
 			{
 				_actor.getActingPlayer().sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
 				clientActionFailed();
@@ -96,12 +81,9 @@ public abstract class L2PlayableAI extends L2CharacterAI
 	@Override
 	protected void onIntentionCast(L2Skill skill, L2Object target)
 	{
-		if (target instanceof L2Playable && skill.isOffensive())
+		if ((target instanceof L2Playable) && skill.isOffensive())
 		{
-			if (target.getActingPlayer().getProtectionBlessing()
-					&& (_actor.getActingPlayer().getLevel() - target.getActingPlayer().getLevel()) >= 10
-					&& _actor.getActingPlayer().getKarma() > 0
-					&& !target.isInsideZone(ZoneId.PVP))
+			if (target.getActingPlayer().getProtectionBlessing() && ((_actor.getActingPlayer().getLevel() - target.getActingPlayer().getLevel()) >= 10) && (_actor.getActingPlayer().getKarma() > 0) && !target.isInsideZone(ZoneId.PVP))
 			{
 				// If attacker have karma and have level >= 10 than his target and target have
 				// Newbie Protection Buff,
@@ -111,10 +93,7 @@ public abstract class L2PlayableAI extends L2CharacterAI
 				return;
 			}
 			
-			if (_actor.getActingPlayer().getProtectionBlessing()
-					&& (target.getActingPlayer().getLevel() - _actor.getActingPlayer().getLevel()) >= 10
-					&& target.getActingPlayer().getKarma() > 0
-					&& !target.isInsideZone(ZoneId.PVP))
+			if (_actor.getActingPlayer().getProtectionBlessing() && ((target.getActingPlayer().getLevel() - _actor.getActingPlayer().getLevel()) >= 10) && (target.getActingPlayer().getKarma() > 0) && !target.isInsideZone(ZoneId.PVP))
 			{
 				// If target have karma and have level >= 10 than his target and actor have
 				// Newbie Protection Buff,
@@ -124,8 +103,7 @@ public abstract class L2PlayableAI extends L2CharacterAI
 				return;
 			}
 			
-			if (target.getActingPlayer().isCursedWeaponEquipped()
-					&& _actor.getActingPlayer().getLevel() <= 20)
+			if (target.getActingPlayer().isCursedWeaponEquipped() && (_actor.getActingPlayer().getLevel() <= 20))
 			{
 				_actor.getActingPlayer().sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
 				clientActionFailed();
@@ -133,8 +111,7 @@ public abstract class L2PlayableAI extends L2CharacterAI
 				return;
 			}
 			
-			if (_actor.getActingPlayer().isCursedWeaponEquipped()
-					&& target.getActingPlayer().getLevel() <= 20)
+			if (_actor.getActingPlayer().isCursedWeaponEquipped() && (target.getActingPlayer().getLevel() <= 20))
 			{
 				_actor.getActingPlayer().sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
 				clientActionFailed();

+ 65 - 36
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2PlayerAI.java

@@ -33,7 +33,6 @@ import com.l2jserver.gameserver.model.skills.targets.L2TargetType;
 
 public class L2PlayerAI extends L2PlayableAI
 {
-	
 	private boolean _thinking; // to prevent recursive thinking
 	
 	IntentionCommand _nextIntention = null;
@@ -55,19 +54,17 @@ public class L2PlayerAI extends L2PlayableAI
 	}
 	
 	/**
-	 * Saves the current Intention for this L2PlayerAI if necessary and calls changeIntention in AbstractAI.<BR><BR>
-	 *
+	 * Saves the current Intention for this L2PlayerAI if necessary and calls changeIntention in AbstractAI.
 	 * @param intention The new Intention to set to the AI
 	 * @param arg0 The first parameter of the Intention
 	 * @param arg1 The second parameter of the Intention
-	 *
 	 */
 	@Override
 	protected synchronized void changeIntention(CtrlIntention intention, Object arg0, Object arg1)
-	{	
+	{
 		// do nothing unless CAST intention
 		// however, forget interrupted actions when starting to use an offensive skill
-		if (intention != AI_INTENTION_CAST || (arg0 != null && ((L2Skill) arg0).isOffensive()))
+		if ((intention != AI_INTENTION_CAST) || ((arg0 != null) && ((L2Skill) arg0).isOffensive()))
 		{
 			_nextIntention = null;
 			super.changeIntention(intention, arg0, arg1);
@@ -75,7 +72,7 @@ public class L2PlayerAI extends L2PlayableAI
 		}
 		
 		// do nothing if next intention is same as current one.
-		if (intention == _intention && arg0 == _intentionArg0 && arg1 == _intentionArg1)
+		if ((intention == _intention) && (arg0 == _intentionArg0) && (arg1 == _intentionArg1))
 		{
 			super.changeIntention(intention, arg0, arg1);
 			return;
@@ -87,11 +84,11 @@ public class L2PlayerAI extends L2PlayableAI
 	}
 	
 	/**
-	 * Launch actions corresponding to the Event ReadyToAct.<BR><BR>
-	 *
-	 * <B><U> Actions</U> :</B><BR><BR>
-	 * <li>Launch actions corresponding to the Event Think</li><BR><BR>
-	 *
+	 * Launch actions corresponding to the Event ReadyToAct.<br>
+	 * <B><U> Actions</U> :</B>
+	 * <ul>
+	 * <li>Launch actions corresponding to the Event Think</li>
+	 * </ul>
 	 */
 	@Override
 	protected void onEvtReadyToAct()
@@ -106,12 +103,12 @@ public class L2PlayerAI extends L2PlayableAI
 	}
 	
 	/**
-	 * Launch actions corresponding to the Event Cancel.<BR><BR>
-	 *
-	 * <B><U> Actions</U> :</B><BR><BR>
+	 * Launch actions corresponding to the Event Cancel.<br>
+	 * <B><U> Actions</U> :</B>
+	 * <ul>
 	 * <li>Stop an AI Follow Task</li>
-	 * <li>Launch actions corresponding to the Event Think</li><BR><BR>
-	 *
+	 * <li>Launch actions corresponding to the Event Think</li>
+	 * </ul>
 	 */
 	@Override
 	protected void onEvtCancel()
@@ -121,11 +118,9 @@ public class L2PlayerAI extends L2PlayableAI
 	}
 	
 	/**
-	 * Finalize the casting of a skill. This method overrides L2CharacterAI method.<BR><BR>
-	 *
-	 * <B>What it does:</B>
-	 * Check if actual intention is set to CAST and, if so, retrieves latest intention
-	 * before the actual CAST and set it as the current intention for the player
+	 * Finalize the casting of a skill. This method overrides L2CharacterAI method.<br>
+	 * <B>What it does:</B><br>
+	 * Check if actual intention is set to CAST and, if so, retrieves latest intention before the actual CAST and set it as the current intention for the player.
 	 */
 	@Override
 	protected void onEvtFinishCasting()
@@ -142,7 +137,9 @@ public class L2PlayerAI extends L2PlayableAI
 					setIntention(nextIntention._crtlIntention, nextIntention._arg0, nextIntention._arg1);
 				}
 				else
+				{
 					setIntention(AI_INTENTION_IDLE);
+				}
 			}
 			else
 			{
@@ -174,13 +171,13 @@ public class L2PlayerAI extends L2PlayableAI
 	}
 	
 	/**
-	 * Manage the Move To Intention : Stop current Attack and Launch a Move to Location Task.<BR><BR>
-	 *
-	 * <B><U> Actions</U> : </B><BR><BR>
-	 * <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast) </li>
-	 * <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO </li>
-	 * <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast) </li><BR><BR>
-	 *
+	 * Manage the Move To Intention : Stop current Attack and Launch a Move to Location Task.<br>
+	 * <B><U> Actions</U> : </B>
+	 * <ul>
+	 * <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
+	 * <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
+	 * <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
+	 * </ul>
 	 */
 	@Override
 	protected void onIntentionMoveTo(L2CharPosition pos)
@@ -225,7 +222,9 @@ public class L2PlayerAI extends L2PlayableAI
 	{
 		L2Character target = getAttackTarget();
 		if (target == null)
+		{
 			return;
+		}
 		if (checkTargetLostOrDead(target))
 		{
 			// Notify the target
@@ -233,7 +232,9 @@ public class L2PlayerAI extends L2PlayableAI
 			return;
 		}
 		if (maybeMoveToPawn(target, _actor.getPhysicalAttackRange()))
+		{
 			return;
+		}
 		
 		_accessor.doAttack(target);
 	}
@@ -241,7 +242,7 @@ public class L2PlayerAI extends L2PlayableAI
 	private void thinkCast()
 	{
 		L2Character target = getCastTarget();
-		if (_skill.getTargetType() == L2TargetType.TARGET_GROUND && _actor instanceof L2PcInstance)
+		if ((_skill.getTargetType() == L2TargetType.TARGET_GROUND) && (_actor instanceof L2PcInstance))
 		{
 			if (maybeMoveToPosition(((L2PcInstance) _actor).getCurrentSkillWorldPosition(), _actor.getMagicalAttackRange(_skill)))
 			{
@@ -253,26 +254,28 @@ public class L2PlayerAI extends L2PlayableAI
 		{
 			if (checkTargetLost(target))
 			{
-				if (_skill.isOffensive() && getAttackTarget() != null)
+				if (_skill.isOffensive() && (getAttackTarget() != null))
 				{
-					//Notify the target
+					// Notify the target
 					setCastTarget(null);
 				}
 				_actor.setIsCastingNow(false);
 				return;
 			}
-			if (target != null && maybeMoveToPawn(target, _actor.getMagicalAttackRange(_skill)))
+			if ((target != null) && maybeMoveToPawn(target, _actor.getMagicalAttackRange(_skill)))
 			{
 				_actor.setIsCastingNow(false);
 				return;
 			}
 		}
 		
-		if (_skill.getHitTime() > 50 && !_skill.isSimultaneousCast())
+		if ((_skill.getHitTime() > 50) && !_skill.isSimultaneousCast())
+		{
 			clientStopMoving(null);
+		}
 		
 		L2Object oldTarget = _actor.getTarget();
-		if (oldTarget != null && target != null && oldTarget != target)
+		if ((oldTarget != null) && (target != null) && (oldTarget != target))
 		{
 			// Replace the current target by the cast target
 			_actor.setTarget(getCastTarget());
@@ -282,18 +285,26 @@ public class L2PlayerAI extends L2PlayableAI
 			_actor.setTarget(oldTarget);
 		}
 		else
+		{
 			_accessor.doCast(_skill);
+		}
 	}
 	
 	private void thinkPickUp()
 	{
 		if (_actor.isAllSkillsDisabled() || _actor.isCastingNow())
+		{
 			return;
+		}
 		L2Object target = getTarget();
 		if (checkTargetLost(target))
+		{
 			return;
+		}
 		if (maybeMoveToPawn(target, 36))
+		{
 			return;
+		}
 		setIntention(AI_INTENTION_IDLE);
 		((L2PcInstance.AIAccessor) _accessor).doPickupItem(target);
 	}
@@ -301,34 +312,52 @@ public class L2PlayerAI extends L2PlayableAI
 	private void thinkInteract()
 	{
 		if (_actor.isAllSkillsDisabled() || _actor.isCastingNow())
+		{
 			return;
+		}
 		L2Object target = getTarget();
 		if (checkTargetLost(target))
+		{
 			return;
+		}
 		if (maybeMoveToPawn(target, 36))
+		{
 			return;
+		}
 		if (!(target instanceof L2StaticObjectInstance))
+		{
 			((L2PcInstance.AIAccessor) _accessor).doInteract((L2Character) target);
+		}
 		setIntention(AI_INTENTION_IDLE);
 	}
 	
 	@Override
 	protected void onEvtThink()
 	{
-		if (_thinking && getIntention() != AI_INTENTION_CAST) // casting must always continue
+		if (_thinking && (getIntention() != AI_INTENTION_CAST))
+		{
 			return;
+		}
 		
 		_thinking = true;
 		try
 		{
 			if (getIntention() == AI_INTENTION_ATTACK)
+			{
 				thinkAttack();
+			}
 			else if (getIntention() == AI_INTENTION_CAST)
+			{
 				thinkCast();
+			}
 			else if (getIntention() == AI_INTENTION_PICK_UP)
+			{
 				thinkPickUp();
+			}
 			else if (getIntention() == AI_INTENTION_INTERACT)
+			{
 				thinkInteract();
+			}
 		}
 		finally
 		{

+ 197 - 98
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2SiegeGuardAI.java

@@ -48,12 +48,12 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 {
 	private static final int MAX_ATTACK_TIMEOUT = 300; // int ticks, i.e. 30 seconds
 	
-	/** The L2Attackable AI task executed every 1s (call onEvtThink method)*/
+	/** The L2Attackable AI task executed every 1s (call onEvtThink method) */
 	private Future<?> _aiTask;
 	
 	/** For attack AI, analysis of mob and its targets */
-	private SelfAnalysis _selfAnalysis = new SelfAnalysis();
-	//private TargetAnalysis _mostHatedAnalysis = new TargetAnalysis();
+	private final SelfAnalysis _selfAnalysis = new SelfAnalysis();
+	// private TargetAnalysis _mostHatedAnalysis = new TargetAnalysis();
 	
 	/** The delay after which the attacked is stopped */
 	private int _attackTimeout;
@@ -64,13 +64,11 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 	/** The flag used to indicate that a thinking action is in progress */
 	private boolean _thinking; // to prevent recursive thinking
 	
-	private int _attackRange;
+	private final int _attackRange;
 	
 	/**
-	 * Constructor of L2AttackableAI.<BR><BR>
-	 *
+	 * Constructor of L2AttackableAI.
 	 * @param accessor The AI accessor of the L2Character
-	 *
 	 */
 	public L2SiegeGuardAI(L2Character.AIAccessor accessor)
 	{
@@ -90,50 +88,59 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 	}
 	
 	/**
-	 * <B><U> Actor is a L2GuardInstance</U> :</B><BR><BR>
+	 * <B><U> Actor is a L2GuardInstance</U> :</B>
+	 * <ul>
 	 * <li>The target isn't a Folk or a Door</li>
 	 * <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
 	 * <li>The target is in the actor Aggro range and is at the same height</li>
 	 * <li>The L2PcInstance target has karma (=PK)</li>
-	 * <li>The L2MonsterInstance target is aggressive</li><BR><BR>
-	 *
-	 * <B><U> Actor is a L2SiegeGuardInstance</U> :</B><BR><BR>
+	 * <li>The L2MonsterInstance target is aggressive</li>
+	 * </ul>
+	 * <B><U> Actor is a L2SiegeGuardInstance</U> :</B>
+	 * <ul>
 	 * <li>The target isn't a Folk or a Door</li>
 	 * <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
 	 * <li>The target is in the actor Aggro range and is at the same height</li>
 	 * <li>A siege is in progress</li>
-	 * <li>The L2PcInstance target isn't a Defender</li><BR><BR>
-	 *
-	 * <B><U> Actor is a L2FriendlyMobInstance</U> :</B><BR><BR>
+	 * <li>The L2PcInstance target isn't a Defender</li>
+	 * </ul>
+	 * <B><U> Actor is a L2FriendlyMobInstance</U> :</B>
+	 * <ul>
 	 * <li>The target isn't a Folk, a Door or another L2NpcInstance</li>
 	 * <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
 	 * <li>The target is in the actor Aggro range and is at the same height</li>
-	 * <li>The L2PcInstance target has karma (=PK)</li><BR><BR>
-	 *
-	 * <B><U> Actor is a L2MonsterInstance</U> :</B><BR><BR>
+	 * <li>The L2PcInstance target has karma (=PK)</li>
+	 * </ul>
+	 * <B><U> Actor is a L2MonsterInstance</U> :</B>
+	 * <ul>
 	 * <li>The target isn't a Folk, a Door or another L2NpcInstance</li>
 	 * <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
 	 * <li>The target is in the actor Aggro range and is at the same height</li>
-	 * <li>The actor is Aggressive</li><BR><BR>
-	 *
+	 * <li>The actor is Aggressive</li>
+	 * </ul>
 	 * @param target The targeted L2Object
 	 * @return True if the target is autoattackable (depends on the actor type).
 	 */
 	protected boolean autoAttackCondition(L2Character target)
 	{
 		// Check if the target isn't another guard, folk or a door
-		if (target == null || target instanceof L2DefenderInstance || target instanceof L2NpcInstance || target instanceof L2DoorInstance
-				|| target.isAlikeDead())
+		if ((target == null) || (target instanceof L2DefenderInstance) || (target instanceof L2NpcInstance) || (target instanceof L2DoorInstance) || target.isAlikeDead())
+		{
 			return false;
+		}
 		
 		// Check if the target isn't invulnerable
 		if (target.isInvul())
 		{
 			// However EffectInvincible requires to check GMs specially
-			if (target instanceof L2PcInstance && ((L2PcInstance) target).isGM())
+			if ((target instanceof L2PcInstance) && ((L2PcInstance) target).isGM())
+			{
 				return false;
-			if (target instanceof L2Summon && ((L2Summon) target).getOwner().isGM())
+			}
+			if ((target instanceof L2Summon) && ((L2Summon) target).getOwner().isGM())
+			{
 				return false;
+			}
 		}
 		
 		// Get the owner if the target is a summon
@@ -141,7 +148,9 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 		{
 			L2PcInstance owner = ((L2Summon) target).getOwner();
 			if (_actor.isInsideRadius(owner, 1000, true, false))
+			{
 				target = owner;
+			}
 		}
 		
 		// Check if the target is a L2PcInstance
@@ -149,7 +158,9 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 		{
 			// Check if the target isn't in silent move mode AND too far (>100)
 			if (((L2Playable) target).isSilentMoving() && !_actor.isInsideRadius(target, 250, false, false))
+			{
 				return false;
+			}
 		}
 		// Los Check Here
 		return (_actor.isAutoAttackable(target) && GeoData.getInstance().canSeeTarget(_actor, target));
@@ -157,22 +168,21 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 	}
 	
 	/**
-	 * Set the Intention of this L2CharacterAI and create an  AI Task executed every 1s (call onEvtThink method) for this L2Attackable.<BR><BR>
-	 *
-	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : If actor _knowPlayer isn't EMPTY, AI_INTENTION_IDLE will be change in AI_INTENTION_ACTIVE</B></FONT><BR><BR>
-	 *
+	 * Set the Intention of this L2CharacterAI and create an AI Task executed every 1s (call onEvtThink method) for this L2Attackable.<br>
+	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : If actor _knowPlayer isn't EMPTY, AI_INTENTION_IDLE will be change in AI_INTENTION_ACTIVE</B></FONT>
 	 * @param intention The new Intention to set to the AI
 	 * @param arg0 The first parameter of the Intention
 	 * @param arg1 The second parameter of the Intention
-	 *
 	 */
 	@Override
 	synchronized void changeIntention(CtrlIntention intention, Object arg0, Object arg1)
 	{
 		if (Config.DEBUG)
+		{
 			_log.info(getClass().getSimpleName() + ": changeIntention(" + intention + ", " + arg0 + ", " + arg1 + ")");
+		}
 		
-		if (intention == AI_INTENTION_IDLE /*|| intention == AI_INTENTION_ACTIVE*/) // active becomes idle if only a summon is present
+		if (intention == AI_INTENTION_IDLE /* || intention == AI_INTENTION_ACTIVE */) // active becomes idle if only a summon is present
 		{
 			// Check if actor is not dead
 			if (!_actor.isAlikeDead())
@@ -181,9 +191,13 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 				
 				// If its _knownPlayer isn't empty set the Intention to AI_INTENTION_ACTIVE
 				if (!npc.getKnownList().getKnownPlayers().isEmpty())
+				{
 					intention = AI_INTENTION_ACTIVE;
+				}
 				else
+				{
 					intention = AI_INTENTION_IDLE;
+				}
 			}
 			
 			if (intention == AI_INTENTION_IDLE)
@@ -216,10 +230,8 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 	}
 	
 	/**
-	 * Manage the Attack Intention : Stop current Attack (if necessary), Calculate attack timeout, Start a new Attack and Launch Think Event.<BR><BR>
-	 *
+	 * Manage the Attack Intention : Stop current Attack (if necessary), Calculate attack timeout, Start a new Attack and Launch Think Event.
 	 * @param target The L2Character to attack
-	 *
 	 */
 	@Override
 	protected void onIntentionAttack(L2Character target)
@@ -228,18 +240,18 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 		_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks();
 		
 		// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
-		//if (_actor.getTarget() != null)
+		// if (_actor.getTarget() != null)
 		super.onIntentionAttack(target);
 	}
 	
 	/**
-	 * Manage AI standard thinks of a L2Attackable (called by onEvtThink).<BR><BR>
-	 *
-	 * <B><U> Actions</U> :</B><BR><BR>
+	 * Manage AI standard thinks of a L2Attackable (called by onEvtThink).<br>
+	 * <B><U> Actions</U> :</B>
+	 * <ul>
 	 * <li>Update every 1s the _globalAggro counter to come close to 0</li>
 	 * <li>If the actor is Aggressive and can attack, add all autoAttackable L2Character in its Aggro Range to its _aggroList, chose a target and order to attack it</li>
-	 * <li>If the actor  can't attack, order to it to return to its home location</li>
-	 *
+	 * <li>If the actor can't attack, order to it to return to its home location</li>
+	 * </ul>
 	 */
 	private void thinkActive()
 	{
@@ -249,9 +261,13 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 		if (_globalAggro != 0)
 		{
 			if (_globalAggro < 0)
+			{
 				_globalAggro++;
+			}
 			else
+			{
 				_globalAggro--;
+			}
 		}
 		
 		// Add all autoAttackable L2Character in L2Attackable Aggro Range to its _aggroList with 0 damage and 1 hate
@@ -261,7 +277,9 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 			for (L2Character target : npc.getKnownList().getKnownCharactersInRadius(_attackRange))
 			{
 				if (target == null)
+				{
 					continue;
+				}
 				if (autoAttackCondition(target)) // check aggression
 				{
 					// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
@@ -269,17 +287,23 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 					
 					// Add the attacker to the L2Attackable _aggroList with 0 damage and 1 hate
 					if (hating == 0)
+					{
 						npc.addDamageHate(target, 0, 1);
+					}
 				}
 			}
 			
 			// Chose a target from its aggroList
 			L2Character hated;
 			if (_actor.isConfused())
+			{
 				hated = getAttackTarget(); // Force mobs to attack anybody if confused
+			}
 			else
+			{
 				hated = npc.getMostHated();
-			//_mostHatedAnalysis.Update(hated);
+				// _mostHatedAnalysis.Update(hated);
+			}
 			
 			// Order to the L2Attackable to attack the target
 			if (hated != null)
@@ -287,11 +311,13 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 				// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
 				int aggro = npc.getHating(hated);
 				
-				if (aggro + _globalAggro > 0)
+				if ((aggro + _globalAggro) > 0)
 				{
 					// Set the L2Character movement type to run and send Server->Client packet ChangeMoveType to all others L2PcInstance
 					if (!_actor.isRunning())
+					{
 						_actor.setRunning();
+					}
 					
 					// Set the AI Intention to AI_INTENTION_ATTACK
 					setIntention(CtrlIntention.AI_INTENTION_ATTACK, hated, null);
@@ -306,21 +332,22 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 	}
 	
 	/**
-	 * Manage AI attack thinks of a L2Attackable (called by onEvtThink).<BR><BR>
-	 *
-	 * <B><U> Actions</U> :</B><BR><BR>
+	 * Manage AI attack thinks of a L2Attackable (called by onEvtThink).<br>
+	 * <B><U> Actions</U> :</B>
+	 * <ul>
 	 * <li>Update the attack timeout if actor is running</li>
 	 * <li>If target is dead or timeout is expired, stop this attack and set the Intention to AI_INTENTION_ACTIVE</li>
 	 * <li>Call all L2Object of its Faction inside the Faction Range</li>
-	 * <li>Chose a target and order to attack it with magic skill or physical attack</li><BR><BR>
-	 *
+	 * <li>Chose a target and order to attack it with magic skill or physical attack</li>
+	 * </ul>
 	 * TODO: Manage casting rules to healer mobs (like Ant Nurses)
-	 *
 	 */
 	private void thinkAttack()
 	{
 		if (Config.DEBUG)
+		{
 			_log.info(getClass().getSimpleName() + ": thinkAttack(); timeout=" + (_attackTimeout - GameTimeController.getGameTicks()));
+		}
 		
 		if (_attackTimeout < GameTimeController.getGameTicks())
 		{
@@ -337,7 +364,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 		
 		L2Character attackTarget = getAttackTarget();
 		// Check if target is dead or if timeout is expired to stop this attack
-		if (attackTarget == null || attackTarget.isAlikeDead() || _attackTimeout < GameTimeController.getGameTicks())
+		if ((attackTarget == null) || attackTarget.isAlikeDead() || (_attackTimeout < GameTimeController.getGameTicks()))
 		{
 			// Stop hating this target after the attack timeout or if target is dead
 			if (attackTarget != null)
@@ -365,42 +392,58 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 	{
 		L2Character target = getAttackTarget();
 		// Call all L2Object of its Faction inside the Faction Range
-		if (((L2Npc) _actor).getFactionId() == null || target == null)
+		if ((((L2Npc) _actor).getFactionId() == null) || (target == null))
+		{
 			return;
+		}
 		
 		if (target.isInvul())
+		{
 			return; // speeding it up for siege guards
+		}
 		
 		String faction_id = ((L2Npc) _actor).getFactionId();
 		
 		// Go through all L2Character that belong to its faction
-		//for (L2Character cha : _actor.getKnownList().getKnownCharactersInRadius(((L2NpcInstance) _actor).getFactionRange()+_actor.getTemplate().collisionRadius))
+		// for (L2Character cha : _actor.getKnownList().getKnownCharactersInRadius(((L2NpcInstance) _actor).getFactionRange()+_actor.getTemplate().collisionRadius))
 		for (L2Character cha : _actor.getKnownList().getKnownCharactersInRadius(1000))
 		{
 			if (cha == null)
+			{
 				continue;
+			}
 			
 			if (!(cha instanceof L2Npc))
 			{
-				if (_selfAnalysis.hasHealOrResurrect && cha instanceof L2PcInstance && (((L2Npc) _actor).getCastle().getSiege().checkIsDefender(((L2PcInstance) cha).getClan())))
+				if (_selfAnalysis.hasHealOrResurrect && (cha instanceof L2PcInstance) && (((L2Npc) _actor).getCastle().getSiege().checkIsDefender(((L2PcInstance) cha).getClan())))
 				{
 					// heal friends
-					if (!_actor.isAttackingDisabled() && cha.getCurrentHp() < cha.getMaxHp() * 0.6 && _actor.getCurrentHp() > _actor.getMaxHp() / 2 && _actor.getCurrentMp() > _actor.getMaxMp() / 2 && cha.isInCombat())
+					if (!_actor.isAttackingDisabled() && (cha.getCurrentHp() < (cha.getMaxHp() * 0.6)) && (_actor.getCurrentHp() > (_actor.getMaxHp() / 2)) && (_actor.getCurrentMp() > (_actor.getMaxMp() / 2)) && cha.isInCombat())
 					{
 						for (L2Skill sk : _selfAnalysis.healSkills)
 						{
 							if (_actor.getCurrentMp() < sk.getMpConsume())
+							{
 								continue;
+							}
 							if (_actor.isSkillDisabled(sk))
+							{
 								continue;
+							}
 							if (!Util.checkIfInRange(sk.getCastRange(), _actor, cha, true))
+							{
 								continue;
+							}
 							
 							int chance = 5;
-							if (chance >= Rnd.get(100)) // chance
+							if (chance >= Rnd.get(100))
+							{
 								continue;
+							}
 							if (!GeoData.getInstance().canSeeTarget(_actor, cha))
+							{
 								break;
+							}
 							
 							L2Object OldTarget = _actor.getTarget();
 							_actor.setTarget(cha);
@@ -417,38 +460,49 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 			L2Npc npc = (L2Npc) cha;
 			
 			if (!faction_id.equals(npc.getFactionId()))
+			{
 				continue;
+			}
 			
 			if (npc.getAI() != null) // TODO: possibly check not needed
 			{
-				if (!npc.isDead() && Math.abs(target.getZ() - npc.getZ()) < 600
-						//&& _actor.getAttackByList().contains(getAttackTarget())
-						&& (npc.getAI()._intention == CtrlIntention.AI_INTENTION_IDLE || npc.getAI()._intention == CtrlIntention.AI_INTENTION_ACTIVE)
-						//limiting aggro for siege guards
-						&& target.isInsideRadius(npc, 1500, true, false) && GeoData.getInstance().canSeeTarget(npc, target))
+				if (!npc.isDead() && (Math.abs(target.getZ() - npc.getZ()) < 600)
+				// && _actor.getAttackByList().contains(getAttackTarget())
+				&& ((npc.getAI()._intention == CtrlIntention.AI_INTENTION_IDLE) || (npc.getAI()._intention == CtrlIntention.AI_INTENTION_ACTIVE))
+				// limiting aggro for siege guards
+				&& target.isInsideRadius(npc, 1500, true, false) && GeoData.getInstance().canSeeTarget(npc, target))
 				{
 					// Notify the L2Object AI with EVT_AGGRESSION
 					npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, getAttackTarget(), 1);
 					return;
 				}
 				// heal friends
-				if (_selfAnalysis.hasHealOrResurrect && !_actor.isAttackingDisabled() && npc.getCurrentHp() < npc.getMaxHp() * 0.6 && _actor.getCurrentHp() > _actor.getMaxHp() / 2 && _actor.getCurrentMp() > _actor.getMaxMp() / 2
-						&& npc.isInCombat())
+				if (_selfAnalysis.hasHealOrResurrect && !_actor.isAttackingDisabled() && (npc.getCurrentHp() < (npc.getMaxHp() * 0.6)) && (_actor.getCurrentHp() > (_actor.getMaxHp() / 2)) && (_actor.getCurrentMp() > (_actor.getMaxMp() / 2)) && npc.isInCombat())
 				{
 					for (L2Skill sk : _selfAnalysis.healSkills)
 					{
 						if (_actor.getCurrentMp() < sk.getMpConsume())
+						{
 							continue;
+						}
 						if (_actor.isSkillDisabled(sk))
+						{
 							continue;
+						}
 						if (!Util.checkIfInRange(sk.getCastRange(), _actor, npc, true))
+						{
 							continue;
+						}
 						
 						int chance = 4;
-						if (chance >= Rnd.get(100)) // chance
+						if (chance >= Rnd.get(100))
+						{
 							continue;
+						}
 						if (!GeoData.getInstance().canSeeTarget(_actor, npc))
+						{
 							break;
+						}
 						
 						L2Object OldTarget = _actor.getTarget();
 						_actor.setTarget(npc);
@@ -478,7 +532,9 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 			dist_2 = _actor.getPlanDistanceSq(attackTarget.getX(), attackTarget.getY());
 			range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + attackTarget.getTemplate().getCollisionRadius();
 			if (attackTarget.isMoving())
+			{
 				range += 50;
+			}
 		}
 		catch (NullPointerException e)
 		{
@@ -488,10 +544,10 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 		}
 		
 		// never attack defenders
-		if (attackTarget instanceof L2PcInstance) 
+		if (attackTarget instanceof L2PcInstance)
 		{
-			if(sGuard.getConquerableHall() == null && sGuard.getCastle().getSiege().checkIsDefender(((L2PcInstance) attackTarget).getClan()))
-			{	
+			if ((sGuard.getConquerableHall() == null) && sGuard.getCastle().getSiege().checkIsDefender(((L2PcInstance) attackTarget).getClan()))
+			{
 				// Cancel the target
 				sGuard.stopHating(attackTarget);
 				_actor.setTarget(null);
@@ -511,21 +567,21 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 		}
 		
 		// Check if the actor isn't muted and if it is far from target
-		if (!_actor.isMuted() && dist_2 > range * range)
+		if (!_actor.isMuted() && (dist_2 > (range * range)))
 		{
 			// check for long ranged skills and heal/buff skills
 			for (L2Skill sk : skills)
 			{
 				int castRange = sk.getCastRange();
 				
-				if ((dist_2 <= castRange * castRange) && castRange > 70 && !_actor.isSkillDisabled(sk) && _actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk) && !sk.isPassive())
+				if ((dist_2 <= (castRange * castRange)) && (castRange > 70) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !sk.isPassive())
 				{
 					
 					L2Object OldTarget = _actor.getTarget();
-					if (sk.getSkillType() == L2SkillType.BUFF || sk.getSkillType() == L2SkillType.HEAL)
+					if ((sk.getSkillType() == L2SkillType.BUFF) || (sk.getSkillType() == L2SkillType.HEAL))
 					{
 						boolean useSkillSelf = true;
-						if (sk.getSkillType() == L2SkillType.HEAL && _actor.getCurrentHp() > (int) (_actor.getMaxHp() / 1.5))
+						if ((sk.getSkillType() == L2SkillType.HEAL) && (_actor.getCurrentHp() > (int) (_actor.getMaxHp() / 1.5)))
 						{
 							useSkillSelf = false;
 							break;
@@ -533,7 +589,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 						if (sk.getSkillType() == L2SkillType.BUFF)
 						{
 							L2Effect[] effects = _actor.getAllEffects();
-							for (int i = 0; effects != null && i < effects.length; i++)
+							for (int i = 0; (effects != null) && (i < effects.length); i++)
 							{
 								L2Effect effect = effects[i];
 								if (effect.getSkill() == sk)
@@ -544,7 +600,9 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 							}
 						}
 						if (useSkillSelf)
+						{
 							_actor.setTarget(_actor);
+						}
 					}
 					
 					clientStopMoving(null);
@@ -571,8 +629,8 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 				double homeY = attackTarget.getY() - sGuard.getSpawn().getLocy();
 				
 				// Check if the L2SiegeGuardInstance isn't too far from it's home location
-				if ((dx * dx + dy * dy > 10000) && (homeX * homeX + homeY * homeY > 3240000) // 1800 * 1800
-						&& (_actor.getKnownList().knowsObject(attackTarget)))
+				if ((((dx * dx) + (dy * dy)) > 10000) && (((homeX * homeX) + (homeY * homeY)) > 3240000) // 1800 * 1800
+					&& (_actor.getKnownList().knowsObject(attackTarget)))
 				{
 					// Cancel the target
 					_actor.getKnownList().removeKnownObject(attackTarget);
@@ -580,20 +638,28 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 					setIntention(AI_INTENTION_IDLE, null, null);
 				}
 				else
-					// Move the actor to Pawn server side AND client side by sending Server->Client packet MoveToPawn (broadcast)
+				// Move the actor to Pawn server side AND client side by sending Server->Client packet MoveToPawn (broadcast)
 				{
 					// Temporary hack for preventing guards jumping off towers,
 					// before replacing this with effective geodata checks and AI modification
-					if (dz * dz < 170 * 170) // normally 130 if guard z coordinates correct
+					if ((dz * dz) < (170 * 170)) // normally 130 if guard z coordinates correct
 					{
 						if (_selfAnalysis.isHealer)
+						{
 							return;
+						}
 						if (_selfAnalysis.isMage)
+						{
 							range = _selfAnalysis.maxCastRange - 50;
+						}
 						if (attackTarget.isMoving())
+						{
 							moveToPawn(attackTarget, range - 70);
+						}
 						else
+						{
 							moveToPawn(attackTarget, range);
+						}
 					}
 				}
 			}
@@ -602,31 +668,41 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 			
 		}
 		// Else, if the actor is muted and far from target, just "move to pawn"
-		else if (_actor.isMuted() && dist_2 > range * range && !_selfAnalysis.isHealer)
+		else if (_actor.isMuted() && (dist_2 > (range * range)) && !_selfAnalysis.isHealer)
 		{
 			// Temporary hack for preventing guards jumping off towers,
 			// before replacing this with effective geodata checks and AI modification
 			double dz = _actor.getZ() - attackTarget.getZ();
-			if (dz * dz < 170 * 170) // normally 130 if guard z coordinates correct
+			if ((dz * dz) < (170 * 170)) // normally 130 if guard z coordinates correct
 			{
 				if (_selfAnalysis.isMage)
+				{
 					range = _selfAnalysis.maxCastRange - 50;
+				}
 				if (attackTarget.isMoving())
+				{
 					moveToPawn(attackTarget, range - 70);
+				}
 				else
+				{
 					moveToPawn(attackTarget, range);
+				}
 			}
 			return;
 		}
 		// Else, if this is close enough to attack
-		else if (dist_2 <= range * range)
+		else if (dist_2 <= (range * range))
 		{
 			// Force mobs to attack anybody if confused
 			L2Character hated = null;
 			if (_actor.isConfused())
+			{
 				hated = attackTarget;
+			}
 			else
+			{
 				hated = ((L2Attackable) _actor).getMostHated();
+			}
 			
 			if (hated == null)
 			{
@@ -634,24 +710,26 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 				return;
 			}
 			if (hated != attackTarget)
+			{
 				attackTarget = hated;
+			}
 			
 			_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks();
 			
 			// check for close combat skills && heal/buff skills
-			if (!_actor.isMuted() && Rnd.nextInt(100) <= 5)
+			if (!_actor.isMuted() && (Rnd.nextInt(100) <= 5))
 			{
 				for (L2Skill sk : skills)
 				{
 					int castRange = sk.getCastRange();
 					
-					if (castRange * castRange >= dist_2 && !sk.isPassive() && _actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk) && !_actor.isSkillDisabled(sk))
+					if (((castRange * castRange) >= dist_2) && !sk.isPassive() && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !_actor.isSkillDisabled(sk))
 					{
 						L2Object OldTarget = _actor.getTarget();
-						if (sk.getSkillType() == L2SkillType.BUFF || sk.getSkillType() == L2SkillType.HEAL)
+						if ((sk.getSkillType() == L2SkillType.BUFF) || (sk.getSkillType() == L2SkillType.HEAL))
 						{
 							boolean useSkillSelf = true;
-							if (sk.getSkillType() == L2SkillType.HEAL && _actor.getCurrentHp() > (int) (_actor.getMaxHp() / 1.5))
+							if ((sk.getSkillType() == L2SkillType.HEAL) && (_actor.getCurrentHp() > (int) (_actor.getMaxHp() / 1.5)))
 							{
 								useSkillSelf = false;
 								break;
@@ -659,7 +737,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 							if (sk.getSkillType() == L2SkillType.BUFF)
 							{
 								L2Effect[] effects = _actor.getAllEffects();
-								for (int i = 0; effects != null && i < effects.length; i++)
+								for (int i = 0; (effects != null) && (i < effects.length); i++)
 								{
 									L2Effect effect = effects[i];
 									if (effect.getSkill() == sk)
@@ -670,7 +748,9 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 								}
 							}
 							if (useSkillSelf)
+							{
 								_actor.setTarget(_actor);
+							}
 						}
 						
 						clientStopMoving(null);
@@ -682,22 +762,26 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 			}
 			// Finally, do the physical attack itself
 			if (!_selfAnalysis.isHealer)
+			{
 				_accessor.doAttack(attackTarget);
+			}
 		}
 	}
 	
 	/**
-	 * Manage AI thinking actions of a L2Attackable.<BR><BR>
+	 * Manage AI thinking actions of a L2Attackable.
 	 */
 	@Override
 	protected void onEvtThink()
 	{
-		//      if(getIntention() != AI_INTENTION_IDLE && (!_actor.isVisible() || !_actor.hasAI() || !_actor.isKnownPlayers()))
-		//          setIntention(AI_INTENTION_IDLE);
+		// if(getIntention() != AI_INTENTION_IDLE && (!_actor.isVisible() || !_actor.hasAI() || !_actor.isKnownPlayers()))
+		// setIntention(AI_INTENTION_IDLE);
 		
 		// Check if the thinking action is already in progress
 		if (_thinking || _actor.isCastingNow() || _actor.isAllSkillsDisabled())
+		{
 			return;
+		}
 		
 		// Start thinking action
 		_thinking = true;
@@ -706,9 +790,13 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 		{
 			// Manage AI thinks of a L2Attackable
 			if (getIntention() == AI_INTENTION_ACTIVE)
+			{
 				thinkActive();
+			}
 			else if (getIntention() == AI_INTENTION_ATTACK)
+			{
 				thinkAttack();
+			}
 		}
 		finally
 		{
@@ -718,15 +806,14 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 	}
 	
 	/**
-	 * Launch actions corresponding to the Event Attacked.<BR><BR>
-	 *
-	 * <B><U> Actions</U> :</B><BR><BR>
+	 * Launch actions corresponding to the Event Attacked.<br>
+	 * <B><U> Actions</U> :</B>
+	 * <ul>
 	 * <li>Init the attack : Calculate the attack timeout, Set the _globalAggro to 0, Add the attacker to the actor _aggroList</li>
 	 * <li>Set the L2Character movement type to run and send Server->Client packet ChangeMoveType to all others L2PcInstance</li>
-	 * <li>Set the Intention to AI_INTENTION_ATTACK</li><BR><BR>
-	 *
+	 * <li>Set the Intention to AI_INTENTION_ATTACK</li>
+	 * </ul>
 	 * @param attacker The L2Character that attacks the actor
-	 *
 	 */
 	@Override
 	protected void onEvtAttacked(L2Character attacker)
@@ -736,14 +823,18 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 		
 		// Set the _globalAggro to 0 to permit attack even just after spawn
 		if (_globalAggro < 0)
+		{
 			_globalAggro = 0;
+		}
 		
 		// Add the attacker to the _aggroList of the actor
 		((L2Attackable) _actor).addDamageHate(attacker, 0, 1);
 		
 		// Set the L2Character movement type to run and send Server->Client packet ChangeMoveType to all others L2PcInstance
 		if (!_actor.isRunning())
+		{
 			_actor.setRunning();
+		}
 		
 		// Set the Intention to AI_INTENTION_ATTACK
 		if (getIntention() != AI_INTENTION_ATTACK)
@@ -755,20 +846,21 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 	}
 	
 	/**
-	 * Launch actions corresponding to the Event Aggression.<BR><BR>
-	 *
-	 * <B><U> Actions</U> :</B><BR><BR>
-	 * <li>Add the target to the actor _aggroList or update hate if already present </li>
-	 * <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is L2GuardInstance check if it isn't too far from its home location)</li><BR><BR>
-	 *
+	 * Launch actions corresponding to the Event Aggression.<br>
+	 * <B><U> Actions</U> :</B>
+	 * <ul>
+	 * <li>Add the target to the actor _aggroList or update hate if already present</li>
+	 * <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is L2GuardInstance check if it isn't too far from its home location)</li>
+	 * </ul>
 	 * @param aggro The value of hate to add to the actor against the target
-	 *
 	 */
 	@Override
 	protected void onEvtAggression(L2Character target, int aggro)
 	{
 		if (_actor == null)
+		{
 			return;
+		}
 		L2Attackable me = (L2Attackable) _actor;
 		
 		if (target != null)
@@ -795,22 +887,28 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 			{
 				// Set the L2Character movement type to run and send Server->Client packet ChangeMoveType to all others L2PcInstance
 				if (!_actor.isRunning())
+				{
 					_actor.setRunning();
+				}
 				
 				L2DefenderInstance sGuard = (L2DefenderInstance) _actor;
 				double homeX = target.getX() - sGuard.getSpawn().getLocx();
 				double homeY = target.getY() - sGuard.getSpawn().getLocy();
 				
 				// Check if the L2SiegeGuardInstance is not too far from its home location
-				if (homeX * homeX + homeY * homeY < 3240000) // 1800 * 1800
+				if (((homeX * homeX) + (homeY * homeY)) < 3240000)
+				{
 					setIntention(CtrlIntention.AI_INTENTION_ATTACK, target, null);
+				}
 			}
 		}
 		else
 		{
 			// currently only for setting lower general aggro
 			if (aggro >= 0)
+			{
 				return;
+			}
 			
 			L2Character mostHated = me.getMostHated();
 			if (mostHated == null)
@@ -820,7 +918,9 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 			}
 			
 			for (L2Character aggroed : me.getAggroList().keySet())
+			{
 				me.addDamageHate(aggroed, 0, aggro);
+			}
 			
 			aggro = me.getHating(mostHated);
 			if (aggro <= 0)
@@ -843,5 +943,4 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 		_accessor.detachAI();
 		super.stopAITask();
 	}
-	
 }

+ 4 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2SpecialSiegeGuardAI.java

@@ -21,11 +21,10 @@ import com.l2jserver.gameserver.model.actor.L2Character.AIAccessor;
 
 /**
  * @author BiggBoss
- *
  */
 public final class L2SpecialSiegeGuardAI extends L2SiegeGuardAI
 {
-	private ArrayList<Integer> _allied;
+	private final ArrayList<Integer> _allied;
 	
 	/**
 	 * @param accessor
@@ -44,8 +43,10 @@ public final class L2SpecialSiegeGuardAI extends L2SiegeGuardAI
 	@Override
 	protected boolean autoAttackCondition(L2Character target)
 	{
-		if(_allied.contains(target.getObjectId()))
+		if (_allied.contains(target.getObjectId()))
+		{
 			return false;
+		}
 		
 		return super.autoAttackCondition(target);
 	}

+ 35 - 10
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2SummonAI.java

@@ -59,9 +59,13 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
 	{
 		L2Summon summon = (L2Summon) _actor;
 		if (_startFollow)
+		{
 			setIntention(AI_INTENTION_FOLLOW, summon.getOwner());
+		}
 		else
+		{
 			super.onIntentionActive();
+		}
 	}
 	
 	@Override
@@ -88,7 +92,9 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
 			return;
 		}
 		if (maybeMoveToPawn(getAttackTarget(), _actor.getPhysicalAttackRange()))
+		{
 			return;
+		}
 		clientStopMoving(null);
 		_accessor.doAttack(getAttackTarget());
 	}
@@ -103,7 +109,9 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
 		}
 		boolean val = _startFollow;
 		if (maybeMoveToPawn(getCastTarget(), _actor.getMagicalAttackRange(_skill)))
+		{
 			return;
+		}
 		clientStopMoving(null);
 		summon.setFollowStatus(false);
 		setIntention(AI_INTENTION_IDLE);
@@ -114,9 +122,13 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
 	private void thinkPickUp()
 	{
 		if (checkTargetLost(getTarget()))
+		{
 			return;
+		}
 		if (maybeMoveToPawn(getTarget(), 36))
+		{
 			return;
+		}
 		setIntention(AI_INTENTION_IDLE);
 		((L2Summon.AIAccessor) _accessor).doPickupItem(getTarget());
 	}
@@ -124,9 +136,13 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
 	private void thinkInteract()
 	{
 		if (checkTargetLost(getTarget()))
+		{
 			return;
+		}
 		if (maybeMoveToPawn(getTarget(), 36))
+		{
 			return;
+		}
 		setIntention(AI_INTENTION_IDLE);
 	}
 	
@@ -134,7 +150,9 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
 	protected void onEvtThink()
 	{
 		if (_thinking || _actor.isCastingNow() || _actor.isAllSkillsDisabled())
+		{
 			return;
+		}
 		_thinking = true;
 		try
 		{
@@ -164,7 +182,9 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
 	protected void onEvtFinishCasting()
 	{
 		if (_lastAttack == null)
+		{
 			((L2Summon) _actor).setFollowStatus(_startFollow);
+		}
 		else
 		{
 			setIntention(CtrlIntention.AI_INTENTION_ATTACK, _lastAttack);
@@ -191,10 +211,10 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
 	private void avoidAttack(L2Character attacker)
 	{
 		// trying to avoid if summon near owner
-		if (((L2Summon) _actor).getOwner() != null
-				&& ((L2Summon) _actor).getOwner() != attacker
-				&& ((L2Summon) _actor).getOwner().isInsideRadius(_actor, 2 * AVOID_RADIUS, true, false))
+		if ((((L2Summon) _actor).getOwner() != null) && (((L2Summon) _actor).getOwner() != attacker) && ((L2Summon) _actor).getOwner().isInsideRadius(_actor, 2 * AVOID_RADIUS, true, false))
+		{
 			_startAvoid = true;
+		}
 	}
 	
 	@Override
@@ -204,19 +224,18 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
 		{
 			_startAvoid = false;
 			
-			if (!_clientMoving
-					&& !_actor.isDead()
-					&& !_actor.isMovementDisabled())
+			if (!_clientMoving && !_actor.isDead() && !_actor.isMovementDisabled())
 			{
 				final int ownerX = ((L2Summon) _actor).getOwner().getX();
 				final int ownerY = ((L2Summon) _actor).getOwner().getY();
 				final double angle = Math.toRadians(Rnd.get(-90, 90)) + Math.atan2(ownerY - _actor.getY(), ownerX - _actor.getX());
 				
-				final int targetX = ownerX + (int)(AVOID_RADIUS * Math.cos(angle));
-				final int targetY = ownerY + (int)(AVOID_RADIUS * Math.sin(angle));
-				if (Config.GEODATA == 0
-						|| GeoData.getInstance().canMoveFromToTarget(_actor.getX(), _actor.getY(), _actor.getZ(), targetX, targetY, _actor.getZ(), _actor.getInstanceId()))
+				final int targetX = ownerX + (int) (AVOID_RADIUS * Math.cos(angle));
+				final int targetY = ownerY + (int) (AVOID_RADIUS * Math.sin(angle));
+				if ((Config.GEODATA == 0) || GeoData.getInstance().canMoveFromToTarget(_actor.getX(), _actor.getY(), _actor.getZ(), targetX, targetY, _actor.getZ(), _actor.getInstanceId()))
+				{
 					moveTo(targetX, targetY, _actor.getZ());
+				}
 			}
 		}
 	}
@@ -244,16 +263,22 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
 	protected void onIntentionCast(L2Skill skill, L2Object target)
 	{
 		if (getIntention() == AI_INTENTION_ATTACK)
+		{
 			_lastAttack = getAttackTarget();
+		}
 		else
+		{
 			_lastAttack = null;
+		}
 		super.onIntentionCast(skill, target);
 	}
 	
 	private void startAvoidTask()
 	{
 		if (_avoidTask == null)
+		{
 			_avoidTask = ThreadPoolManager.getInstance().scheduleAiAtFixedRate(this, 100, 100);
+		}
 	}
 	
 	private void stopAvoidTask()

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2VehicleAI.java

@@ -26,7 +26,7 @@ public abstract class L2VehicleAI extends L2CharacterAI
 {
 	/**
 	 * Simple AI for vehicles
-	 * @param accessor 
+	 * @param accessor
 	 */
 	public L2VehicleAI(L2Vehicle.AIAccessor accessor)
 	{

+ 8 - 10
L2J_Server_BETA/java/com/l2jserver/gameserver/cache/FastMRUCache.java

@@ -23,22 +23,19 @@ import javolution.util.FastMap;
 
 /**
  * @author Layane
- * @param <K> 
- * @param <V> 
+ * @param <K>
+ * @param <V>
  */
-@SuppressWarnings({ "rawtypes" })
+@SuppressWarnings("rawtypes")
 public class FastMRUCache<K, V> extends FastCollection implements Reusable
 {
-	/**
-	 * Comment for <code>serialVersionUID</code>
-	 */
 	private static final long serialVersionUID = 1L;
 	private static final int DEFAULT_CAPACITY = 50;
-	private static final int DEFAULT_FORGET_TIME = 300000; //5 Minutes
+	private static final int DEFAULT_FORGET_TIME = 300000; // 5 Minutes
 	
-	private FastMap<K, CacheNode> _cache = new FastMap<K, CacheNode>().setKeyComparator(FastComparator.DIRECT);
+	private final FastMap<K, CacheNode> _cache = new FastMap<K, CacheNode>().setKeyComparator(FastComparator.DIRECT);
 	private FastMap<K, V> _map;
-	private FastList<K> _mruList = new FastList<>();
+	private final FastList<K> _mruList = new FastList<>();
 	private int _cacheSize;
 	private int _forgetTime;
 	
@@ -63,7 +60,8 @@ public class FastMRUCache<K, V> extends FastCollection implements Reusable
 	/**
 	 * Holds the set factory.
 	 */
-	private static final ObjectFactory FACTORY = new ObjectFactory() {
+	private static final ObjectFactory FACTORY = new ObjectFactory()
+	{
 		
 		@Override
 		public Object create()

+ 1 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/cache/WarehouseCacheManager.java

@@ -22,7 +22,6 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.util.L2FastMap;
 
 /**
- *
  * @author -Nemesiss-
  */
 public class WarehouseCacheManager
@@ -53,7 +52,7 @@ public class WarehouseCacheManager
 			long cTime = System.currentTimeMillis();
 			for (L2PcInstance pc : _cachedWh.keySet())
 			{
-				if (cTime - _cachedWh.get(pc) > _cacheTime)
+				if ((cTime - _cachedWh.get(pc)) > _cacheTime)
 				{
 					pc.clearWarehouse();
 					_cachedWh.remove(pc);

+ 8 - 20
L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/BB/Forum.java

@@ -31,36 +31,32 @@ import com.l2jserver.gameserver.communitybbs.Manager.TopicBBSManager;
 
 public class Forum
 {
-	//type
+	// type
 	public static final int ROOT = 0;
 	public static final int NORMAL = 1;
 	public static final int CLAN = 2;
 	public static final int MEMO = 3;
 	public static final int MAIL = 4;
-	//perm
+	// perm
 	public static final int INVISIBLE = 0;
 	public static final int ALL = 1;
 	public static final int CLANMEMBERONLY = 2;
 	public static final int OWNERONLY = 3;
 	
 	private static Logger _log = Logger.getLogger(Forum.class.getName());
-	private List<Forum> _children;
-	private Map<Integer, Topic> _topic;
-	private int _forumId;
+	private final List<Forum> _children;
+	private final Map<Integer, Topic> _topic;
+	private final int _forumId;
 	private String _forumName;
-	//private int _ForumParent;
 	private int _forumType;
 	private int _forumPost;
 	private int _forumPerm;
-	private Forum _fParent;
+	private final Forum _fParent;
 	private int _ownerID;
 	private boolean _loaded = false;
 	
 	/**
-	 * Creates new instance of Forum. When you create new forum, use
-	 * {@link com.l2jserver.gameserver.communitybbs.Manager.ForumsBBSManager#
-	 * addForum(com.l2jserver.gameserver.communitybbs.BB.Forum)} to add forum
-	 * to the forums manager.
+	 * Creates new instance of Forum. When you create new forum, use {@link com.l2jserver.gameserver.communitybbs.Manager.ForumsBBSManager# addForum(com.l2jserver.gameserver.communitybbs.BB.Forum)} to add forum to the forums manager.
 	 * @param Forumid
 	 * @param FParent
 	 */
@@ -70,9 +66,6 @@ public class Forum
 		_fParent = FParent;
 		_children = new FastList<>();
 		_topic = new FastMap<>();
-		
-		/*load();
-		getChildren();	*/
 	}
 	
 	/**
@@ -80,13 +73,12 @@ public class Forum
 	 * @param parent
 	 * @param type
 	 * @param perm
-	 * @param OwnerID 
+	 * @param OwnerID
 	 */
 	public Forum(String name, Forum parent, int type, int perm, int OwnerID)
 	{
 		_forumName = name;
 		_forumId = ForumsBBSManager.getInstance().getANewID();
-		//_ForumParent = parent.getID();
 		_forumType = type;
 		_forumPost = 0;
 		_forumPerm = perm;
@@ -110,7 +102,6 @@ public class Forum
 				if (rs.next())
 				{
 					_forumName = rs.getString("forum_name");
-					//_ForumParent = result.getInt("forum_parent");
 					_forumPost = rs.getInt("forum_post");
 					_forumType = rs.getInt("forum_type");
 					_forumPerm = rs.getInt("forum_perm");
@@ -252,9 +243,6 @@ public class Forum
 		}
 	}
 	
-	/**
-	 *
-	 */
 	public void vload()
 	{
 		if (!_loaded)

+ 6 - 7
L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/BB/Post.java

@@ -44,8 +44,7 @@ public class Post
 		public String postTxt;
 	}
 	
-	private List<CPost> _post;
-	//public enum ConstructorType {REPLY, CREATE };
+	private final List<CPost> _post;
 	
 	/**
 	 * @param _PostOwner
@@ -55,7 +54,7 @@ public class Post
 	 * @param _PostForumID
 	 * @param txt
 	 */
-	public Post(String _PostOwner,int _PostOwnerID,long date,int tid,int _PostForumID,String txt)
+	public Post(String _PostOwner, int _PostOwnerID, long date, int tid, int _PostForumID, String txt)
 	{
 		_post = new FastList<>();
 		CPost cp = new CPost();
@@ -100,9 +99,9 @@ public class Post
 	public CPost getCPost(int id)
 	{
 		int i = 0;
-		for(CPost cp : _post)
+		for (CPost cp : _post)
 		{
-			if(i++ == id)
+			if (i++ == id)
 			{
 				return cp;
 			}
@@ -138,7 +137,7 @@ public class Post
 			ps.setInt(2, t.getID());
 			try (ResultSet rs = ps.executeQuery())
 			{
-				while(rs.next())
+				while (rs.next())
 				{
 					CPost cp = new CPost();
 					cp.postId = rs.getInt("post_id");
@@ -154,7 +153,7 @@ public class Post
 		}
 		catch (Exception e)
 		{
-			_log.log(Level.WARNING, "Data error on Post " + t.getForumID() + "/"+t.getID()+" : " + e.getMessage(), e);
+			_log.log(Level.WARNING, "Data error on Post " + t.getForumID() + "/" + t.getID() + " : " + e.getMessage(), e);
 		}
 	}
 	

+ 9 - 10
L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/BB/Topic.java

@@ -22,7 +22,6 @@ import java.util.logging.Logger;
 import com.l2jserver.L2DatabaseFactory;
 import com.l2jserver.gameserver.communitybbs.Manager.TopicBBSManager;
 
-
 public class Topic
 {
 	private static final Logger _log = Logger.getLogger(Topic.class.getName());
@@ -30,14 +29,14 @@ public class Topic
 	public static final int MORMAL = 0;
 	public static final int MEMO = 1;
 	
-	private int _id;
-	private int _forumId;
-	private String _topicName;
-	private long _date;
-	private String _ownerName;
-	private int _ownerId;
-	private int _type;
-	private int _cReply;
+	private final int _id;
+	private final int _forumId;
+	private final String _topicName;
+	private final long _date;
+	private final String _ownerName;
+	private final int _ownerId;
+	private final int _type;
+	private final int _cReply;
 	
 	/**
 	 * @param ct
@@ -123,7 +122,7 @@ public class Topic
 	}
 	
 	/**
-	 * @param f 
+	 * @param f
 	 */
 	public void deleteme(Forum f)
 	{

+ 7 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/CommunityBoard.java

@@ -36,12 +36,14 @@ public class CommunityBoard
 	{
 		L2PcInstance activeChar = client.getActiveChar();
 		if (activeChar == null)
+		{
 			return;
+		}
 		
 		switch (Config.COMMUNITY_TYPE)
 		{
 			default:
-			case 0: //disabled
+			case 0: // disabled
 				activeChar.sendPacket(SystemMessageId.CB_OFFLINE);
 				break;
 			case 1: // old
@@ -78,8 +80,7 @@ public class CommunityBoard
 				}
 				else
 				{
-					ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + command
-							+ " is not implemented yet</center><br><br></body></html>", "101");
+					ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + command + " is not implemented yet</center><br><br></body></html>", "101");
 					activeChar.sendPacket(sb);
 					activeChar.sendPacket(new ShowBoard(null, "102"));
 					activeChar.sendPacket(new ShowBoard(null, "103"));
@@ -101,7 +102,9 @@ public class CommunityBoard
 	{
 		L2PcInstance activeChar = client.getActiveChar();
 		if (activeChar == null)
+		{
 			return;
+		}
 		
 		switch (Config.COMMUNITY_TYPE)
 		{
@@ -124,8 +127,7 @@ public class CommunityBoard
 				}
 				else
 				{
-					ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + url
-							+ " is not implemented yet</center><br><br></body></html>", "101");
+					ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + url + " is not implemented yet</center><br><br></body></html>", "101");
 					activeChar.sendPacket(sb);
 					activeChar.sendPacket(new ShowBoard(null, "102"));
 					activeChar.sendPacket(new ShowBoard(null, "103"));

+ 2 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/Manager/AdminBBSManager.java

@@ -37,13 +37,11 @@ public class AdminBBSManager extends BaseBBSManager
 		}
 		if (command.startsWith("admin_bbs"))
 		{
-			separateAndSend("<html><body><br><br><center>This Page is only an exemple :)<br><br>command=" + command
-					+ "</center></body></html>", activeChar);
+			separateAndSend("<html><body><br><br><center>This Page is only an exemple :)<br><br>command=" + command + "</center></body></html>", activeChar);
 		}
 		else
 		{
-			ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + command
-					+ " is not implemented yet</center><br><br></body></html>", "101");
+			ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + command + " is not implemented yet</center><br><br></body></html>", "101");
 			activeChar.sendPacket(sb);
 			activeChar.sendPacket(new ShowBoard(null, "102"));
 			activeChar.sendPacket(new ShowBoard(null, "103"));

+ 5 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/Manager/BaseBBSManager.java

@@ -30,7 +30,9 @@ public abstract class BaseBBSManager
 	protected void separateAndSend(String html, L2PcInstance acha)
 	{
 		if (html == null)
+		{
 			return;
+		}
 		if (html.length() < 4090)
 		{
 			acha.sendPacket(new ShowBoard(html, "101"));
@@ -56,7 +58,7 @@ public abstract class BaseBBSManager
 	
 	/**
 	 * @param html
-	 * @param acha 
+	 * @param acha
 	 */
 	protected void send1001(String html, L2PcInstance acha)
 	{
@@ -67,7 +69,7 @@ public abstract class BaseBBSManager
 	}
 	
 	/**
-	 * @param acha 
+	 * @param acha
 	 */
 	protected void send1002(L2PcInstance acha)
 	{
@@ -78,7 +80,7 @@ public abstract class BaseBBSManager
 	 * @param activeChar
 	 * @param string
 	 * @param string2
-	 * @param string3 
+	 * @param string3
 	 */
 	protected void send1002(L2PcInstance activeChar, String string, String string2, String string3)
 	{

+ 39 - 134
L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/Manager/ClanBBSManager.java

@@ -38,10 +38,14 @@ public class ClanBBSManager extends BaseBBSManager
 	{
 		if (command.equals("_bbsclan"))
 		{
-			if (activeChar.getClan() == null || activeChar.getClan().getLevel() < 2)
+			if ((activeChar.getClan() == null) || (activeChar.getClan().getLevel() < 2))
+			{
 				clanlist(activeChar, 1);
+			}
 			else
+			{
 				clanhome(activeChar);
+			}
 		}
 		else if (command.startsWith("_bbsclan_clanlist"))
 		{
@@ -78,13 +82,17 @@ public class ClanBBSManager extends BaseBBSManager
 		else if (command.startsWith("_bbsclan_clannotice_enable"))
 		{
 			if (activeChar.getClan() != null)
+			{
 				activeChar.getClan().setNoticeEnabled(true);
+			}
 			clanNotice(activeChar, activeChar.getClanId());
 		}
 		else if (command.startsWith("_bbsclan_clannotice_disable"))
 		{
 			if (activeChar.getClan() != null)
+			{
 				activeChar.getClan().setNoticeEnabled(false);
+			}
 			clanNotice(activeChar, activeChar.getClanId());
 		}
 		else
@@ -105,63 +113,38 @@ public class ClanBBSManager extends BaseBBSManager
 			}
 			else
 			{
-				final StringBuilder html = StringUtil.startAppend(2000, "<html><body><br><br>"
-						+ "<table border=0 width=610><tr><td width=10></td><td width=600 align=left>"
-						+ "<a action=\"bypass _bbshome\">HOME</a> &gt; "
-						+ "<a action=\"bypass _bbsclan_clanlist\"> CLAN COMMUNITY </a>  &gt; " + "<a action=\"bypass _bbsclan_clanhome;", String.valueOf(clanId), "\"> &amp;$802; </a>"
-						+ "</td></tr>" + "</table>");
+				final StringBuilder html = StringUtil.startAppend(2000, "<html><body><br><br><table border=0 width=610><tr><td width=10></td><td width=600 align=left><a action=\"bypass _bbshome\">HOME</a> &gt; <a action=\"bypass _bbsclan_clanlist\"> CLAN COMMUNITY </a>  &gt; <a action=\"bypass _bbsclan_clanhome;", String.valueOf(clanId), "\"> &amp;$802; </a></td></tr></table>");
 				if (activeChar.isClanLeader())
 				{
-					StringUtil.append(html, "<br><br><center>"
-							+ "<table width=610 border=0 cellspacing=0 cellpadding=0>"
-							+ "<tr><td fixwidth=610><font color=\"AAAAAA\">The Clan Notice function allows the clan leader to send messages through a pop-up window to clan members at login.</font> </td></tr>"
-							+ "<tr><td height=20></td></tr>");
+					StringUtil.append(html, "<br><br><center><table width=610 border=0 cellspacing=0 cellpadding=0><tr><td fixwidth=610><font color=\"AAAAAA\">The Clan Notice function allows the clan leader to send messages through a pop-up window to clan members at login.</font> </td></tr><tr><td height=20></td></tr>");
 					
 					if (activeChar.getClan().isNoticeEnabled())
+					{
 						StringUtil.append(html, "<tr><td fixwidth=610> Clan Notice Function:&nbsp;&nbsp;&nbsp;on&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;<a action=\"bypass _bbsclan_clannotice_disable\">off</a>");
+					}
 					else
+					{
 						StringUtil.append(html, "<tr><td fixwidth=610> Clan Notice Function:&nbsp;&nbsp;&nbsp;<a action=\"bypass _bbsclan_clannotice_enable\">on</a>&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;off");
+					}
 					
-					StringUtil.append(html, "</td></tr>"
-							+ "</table>"
-							+ "<img src=\"L2UI.Squaregray\" width=\"610\" height=\"1\">"
-							+ "<br> <br>"
-							+ "<table width=610 border=0 cellspacing=2 cellpadding=0>"
-							+ "<tr><td>Edit Notice: </td></tr>"
-							+ "<tr><td height=5></td></tr>"
-							+ "<tr><td>"
-							+ "<MultiEdit var =\"Content\" width=610 height=100>"
-							+ "</td></tr>"
-							+ "</table>"
-							+ "<br>"
-							+ "<table width=610 border=0 cellspacing=0 cellpadding=0>"
-							+ "<tr><td height=5></td></tr>"
-							+ "<tr>"
-							+ "<td align=center FIXWIDTH=65><button value=\"&$140;\" action=\"Write Notice Set _ Content Content Content\" back=\"l2ui_ch3.smallbutton2_down\" width=65 height=20 fore=\"l2ui_ch3.smallbutton2\" ></td>"
-							+ "<td align=center FIXWIDTH=45></td>" + "<td align=center FIXWIDTH=500></td>" + "</tr>" + "</table>"
-							+ "</center>" + "</body>" + "</html>");
+					StringUtil.append(html, "</td></tr></table><img src=\"L2UI.Squaregray\" width=\"610\" height=\"1\"><br> <br><table width=610 border=0 cellspacing=2 cellpadding=0><tr><td>Edit Notice: </td></tr><tr><td height=5></td></tr><tr><td><MultiEdit var =\"Content\" width=610 height=100></td></tr></table><br><table width=610 border=0 cellspacing=0 cellpadding=0><tr><td height=5></td></tr><tr><td align=center FIXWIDTH=65><button value=\"&$140;\" action=\"Write Notice Set _ Content Content Content\" back=\"l2ui_ch3.smallbutton2_down\" width=65 height=20 fore=\"l2ui_ch3.smallbutton2\" ></td><td align=center FIXWIDTH=45></td><td align=center FIXWIDTH=500></td></tr></table></center></body></html>");
 					send1001(html.toString(), activeChar);
 					send1002(activeChar, activeChar.getClan().getNotice(), " ", "0");
 				}
 				else
 				{
-					StringUtil.append(html, "<img src=\"L2UI.squareblank\" width=\"1\" height=\"10\">" + "<center>"
-							+ "<table border=0 cellspacing=0 cellpadding=0><tr>"
-							+ "<td>You are not your clan's leader, and therefore cannot change the clan notice</td>" + "</tr></table>");
+					StringUtil.append(html, "<img src=\"L2UI.squareblank\" width=\"1\" height=\"10\"><center><table border=0 cellspacing=0 cellpadding=0><tr><td>You are not your clan's leader, and therefore cannot change the clan notice</td></tr></table>");
 					if (activeChar.getClan().isNoticeEnabled())
 					{
-						StringUtil.append(html, "<table border=0 cellspacing=0 cellpadding=0>" + "<tr>"
-								+ "<td>The current clan notice:</td>" + "</tr>" + "<tr><td fixwidth=5></td>"
-								+ "<td FIXWIDTH=600 align=left>" + activeChar.getClan().getNotice() + "</td>" + "<td fixqqwidth=5></td>"
-								+ "</tr>" + "</table>");
+						StringUtil.append(html, "<table border=0 cellspacing=0 cellpadding=0><tr><td>The current clan notice:</td></tr><tr><td fixwidth=5></td><td FIXWIDTH=600 align=left>" + activeChar.getClan().getNotice() + "</td><td fixqqwidth=5></td></tr></table>");
 					}
-					StringUtil.append(html, "</center>" + "</body>" + "</html>");
+					StringUtil.append(html, "</center></body></html>");
 					separateAndSend(html.toString(), activeChar);
 				}
 			}
 		}
 	}
-
+	
 	/**
 	 * @param activeChar
 	 * @param index
@@ -173,50 +156,24 @@ public class ClanBBSManager extends BaseBBSManager
 			index = 1;
 		}
 		
-		//header
-		final StringBuilder html = StringUtil.startAppend(2000, "<html><body><br><br><center>"
-				+ "<br1><br1><table border=0 cellspacing=0 cellpadding=0>" + "<tr><td FIXWIDTH=15>&nbsp;</td>"
-				+ "<td width=610 height=30 align=left>" + "<a action=\"bypass _bbsclan_clanlist\"> CLAN COMMUNITY </a>"
-				+ "</td></tr></table>" + "<table border=0 cellspacing=0 cellpadding=0 width=610 bgcolor=434343>"
-				+ "<tr><td height=10></td></tr>" + "<tr>" + "<td fixWIDTH=5></td>" + "<td fixWIDTH=600>"
-				+ "<a action=\"bypass _bbsclan_clanhome;", String.valueOf((activeChar.getClan() != null) ? activeChar.getClan().getClanId() : 0), "\">[GO TO MY CLAN]</a>&nbsp;&nbsp;"
-				+ "</td>"
-				+ "<td fixWIDTH=5></td>"
-				+ "</tr>"
-				+ "<tr><td height=10></td></tr>"
-				+ "</table>"
-				+ "<br>"
-				+ "<table border=0 cellspacing=0 cellpadding=2 bgcolor=5A5A5A width=610>"
-				+ "<tr>"
-				+ "<td FIXWIDTH=5></td>"
-				+ "<td FIXWIDTH=200 align=center>CLAN NAME</td>"
-				+ "<td FIXWIDTH=200 align=center>CLAN LEADER</td>"
-				+ "<td FIXWIDTH=100 align=center>CLAN LEVEL</td>"
-				+ "<td FIXWIDTH=100 align=center>CLAN MEMBERS</td>"
-				+ "<td FIXWIDTH=5></td>" + "</tr>" + "</table>" + "<img src=\"L2UI.Squareblank\" width=\"1\" height=\"5\">");
+		// header
+		final StringBuilder html = StringUtil.startAppend(2000, "<html><body><br><br><center><br1><br1><table border=0 cellspacing=0 cellpadding=0><tr><td FIXWIDTH=15>&nbsp;</td><td width=610 height=30 align=left><a action=\"bypass _bbsclan_clanlist\"> CLAN COMMUNITY </a></td></tr></table><table border=0 cellspacing=0 cellpadding=0 width=610 bgcolor=434343><tr><td height=10></td></tr><tr><td fixWIDTH=5></td><td fixWIDTH=600><a action=\"bypass _bbsclan_clanhome;", String.valueOf((activeChar.getClan() != null) ? activeChar.getClan().getClanId() : 0), "\">[GO TO MY CLAN]</a>&nbsp;&nbsp;</td><td fixWIDTH=5></td></tr><tr><td height=10></td></tr></table><br><table border=0 cellspacing=0 cellpadding=2 bgcolor=5A5A5A width=610><tr><td FIXWIDTH=5></td><td FIXWIDTH=200 align=center>CLAN NAME</td><td FIXWIDTH=200 align=center>CLAN LEADER</td><td FIXWIDTH=100 align=center>CLAN LEVEL</td><td FIXWIDTH=100 align=center>CLAN MEMBERS</td><td FIXWIDTH=5></td></tr></table><img src=\"L2UI.Squareblank\" width=\"1\" height=\"5\">");
 		
 		int i = 0;
 		for (L2Clan cl : ClanTable.getInstance().getClans())
 		{
-			if (i > (index + 1) * 7)
+			if (i > ((index + 1) * 7))
 			{
 				break;
 			}
 			
-			if (i++ >= (index - 1) * 7)
+			if (i++ >= ((index - 1) * 7))
 			{
-				StringUtil.append(html, "<img src=\"L2UI.SquareBlank\" width=\"610\" height=\"3\">"
-						+ "<table border=0 cellspacing=0 cellpadding=0 width=610>" + "<tr> " + "<td FIXWIDTH=5></td>"
-						+ "<td FIXWIDTH=200 align=center><a action=\"bypass _bbsclan_clanhome;", String.valueOf(cl.getClanId()), "\">", cl.getName(), "</a></td>"
-						+ "<td FIXWIDTH=200 align=center>", cl.getLeaderName(), "</td>" + "<td FIXWIDTH=100 align=center>", String.valueOf(cl.getLevel()), "</td>"
-						+ "<td FIXWIDTH=100 align=center>", String.valueOf(cl.getMembersCount()), "</td>" + "<td FIXWIDTH=5></td>"
-						+ "</tr>" + "<tr><td height=5></td></tr>" + "</table>"
-						+ "<img src=\"L2UI.SquareBlank\" width=\"610\" height=\"3\">"
-						+ "<img src=\"L2UI.SquareGray\" width=\"610\" height=\"1\">");
+				StringUtil.append(html, "<img src=\"L2UI.SquareBlank\" width=\"610\" height=\"3\"><table border=0 cellspacing=0 cellpadding=0 width=610><tr> <td FIXWIDTH=5></td><td FIXWIDTH=200 align=center><a action=\"bypass _bbsclan_clanhome;", String.valueOf(cl.getClanId()), "\">", cl.getName(), "</a></td><td FIXWIDTH=200 align=center>", cl.getLeaderName(), "</td><td FIXWIDTH=100 align=center>", String.valueOf(cl.getLevel()), "</td><td FIXWIDTH=100 align=center>", String.valueOf(cl.getMembersCount()), "</td><td FIXWIDTH=5></td></tr><tr><td height=5></td></tr></table><img src=\"L2UI.SquareBlank\" width=\"610\" height=\"3\"><img src=\"L2UI.SquareGray\" width=\"610\" height=\"1\">");
 			}
 		}
 		
-		html.append("<img src=\"L2UI.SquareBlank\" width=\"610\" height=\"2\">" + "<table cellpadding=0 cellspacing=2 border=0><tr>");
+		html.append("<img src=\"L2UI.SquareBlank\" width=\"610\" height=\"2\"><table cellpadding=0 cellspacing=2 border=0><tr>");
 		
 		if (index == 1)
 		{
@@ -230,7 +187,7 @@ public class ClanBBSManager extends BaseBBSManager
 		i = 0;
 		int nbp;
 		nbp = ClanTable.getInstance().getClans().length / 8;
-		if (nbp * 8 != ClanTable.getInstance().getClans().length)
+		if ((nbp * 8) != ClanTable.getInstance().getClans().length)
 		{
 			nbp++;
 		}
@@ -254,15 +211,9 @@ public class ClanBBSManager extends BaseBBSManager
 		{
 			StringUtil.append(html, "<td><button action=\"bypass _bbsclan_clanlist;", String.valueOf(index + 1), "\" back=\"l2ui_ch3.next1_down\" fore=\"l2ui_ch3.next1\" width=16 height=16 ></td>");
 		}
-		html.append("</tr></table>"
-				+ "<table border=0 cellspacing=0 cellpadding=0>"
-				+ "<tr><td width=610><img src=\"sek.cbui141\" width=\"610\" height=\"1\"></td></tr>"
-				+ "</table>"
-				+ "<table border=0><tr><td><combobox width=65 var=keyword list=\"Name;Ruler\"></td><td><edit var = \"Search\" width=130 height=11 length=\"16\"></td>"
-				+
-				//TODO: search (Write in BBS)
-				"<td><button value=\"&$420;\" action=\"Write 5 -1 0 Search keyword keyword\" back=\"l2ui_ch3.smallbutton2_down\" width=65 height=20 fore=\"l2ui_ch3.smallbutton2\"> </td> </tr></table>"
-				+ "<br>" + "<br>" + "</center>" + "</body>" + "</html>");
+		html.append("</tr></table><table border=0 cellspacing=0 cellpadding=0><tr><td width=610><img src=\"sek.cbui141\" width=\"610\" height=\"1\"></td></tr></table><table border=0><tr><td><combobox width=65 var=keyword list=\"Name;Ruler\"></td><td><edit var = \"Search\" width=130 height=11 length=\"16\"></td>" +
+		// TODO: search (Write in BBS)
+		"<td><button value=\"&$420;\" action=\"Write 5 -1 0 Search keyword keyword\" back=\"l2ui_ch3.smallbutton2_down\" width=65 height=20 fore=\"l2ui_ch3.smallbutton2\"> </td> </tr></table><br><br></center></body></html>");
 		separateAndSend(html.toString(), activeChar);
 	}
 	
@@ -295,61 +246,15 @@ public class ClanBBSManager extends BaseBBSManager
 			}
 			else
 			{
-				final String html = StringUtil.concat("<html><body><center><br><br>"
-						+ "<br1><br1><table border=0 cellspacing=0 cellpadding=0>"
-						+ "<tr><td FIXWIDTH=15>&nbsp;</td>"
-						+ "<td width=610 height=30 align=left>"
-						+ "<a action=\"bypass _bbshome\">HOME</a> &gt; <a action=\"bypass _bbsclan_clanlist\"> CLAN COMMUNITY </a>  &gt; <a action=\"bypass _bbsclan_clanhome;", String.valueOf(clanId), "\"> &amp;$802; </a>"
-						+ "</td></tr></table>"
-						+ "<table border=0 cellspacing=0 cellpadding=0 width=610 bgcolor=434343>"
-						+ "<tr><td height=10></td></tr>"
-						+ "<tr>"
-						+ "<td fixWIDTH=5></td>"
-						+ "<td fixwidth=600>"
-						+ "<a action=\"bypass _bbsclan_clanhome;", String.valueOf(clanId), ";announce\">[CLAN ANNOUNCEMENT]</a> <a action=\"bypass _bbsclan_clanhome;", String.valueOf(clanId), ";cbb\">[CLAN BULLETIN BOARD]</a>"
-						+ "<a action=\"bypass _bbsclan_clanhome;", String.valueOf(clanId), ";cmail\">[CLAN MAIL]</a>&nbsp;&nbsp;"
-						+ "<a action=\"bypass _bbsclan_clannotice_edit;", String.valueOf(clanId), ";cnotice\">[CLAN NOTICE]</a>&nbsp;&nbsp;"
-						+ "</td>"
-						+ "<td fixWIDTH=5></td>"
-						+ "</tr>"
-						+ "<tr><td height=10></td></tr>"
-						+ "</table>"
-						+ "<table border=0 cellspacing=0 cellpadding=0 width=610>"
-						+ "<tr><td height=10></td></tr>"
-						+ "<tr><td fixWIDTH=5></td>"
-						+ "<td fixwidth=290 valign=top>"
-						+ "</td>"
-						+ "<td fixWIDTH=5></td>"
-						+ "<td fixWIDTH=5 align=center valign=top><img src=\"l2ui.squaregray\" width=2  height=128></td>"
-						+ "<td fixWIDTH=5></td>"
-						+ "<td fixwidth=295>"
-						+ "<table border=0 cellspacing=0 cellpadding=0 width=295>"
-						+ "<tr>"
-						+ "<td fixWIDTH=100 align=left>CLAN NAME</td>" + "<td fixWIDTH=195 align=left>", cl.getName(), "</td>" + "</tr>"
-						+ "<tr><td height=7></td></tr>" + "<tr>" + "<td fixWIDTH=100 align=left>CLAN LEVEL</td>"
-						+ "<td fixWIDTH=195 align=left height=16>", String.valueOf(cl.getLevel()), "</td>" + "</tr>"
-						+ "<tr><td height=7></td></tr>" + "<tr>" + "<td fixWIDTH=100 align=left>CLAN MEMBERS</td>"
-						+ "<td fixWIDTH=195 align=left height=16>", String.valueOf(cl.getMembersCount()), "</td>" + "</tr>"
-						+ "<tr><td height=7></td></tr>" + "<tr>" + "<td fixWIDTH=100 align=left>CLAN LEADER</td>"
-						+ "<td fixWIDTH=195 align=left height=16>", cl.getLeaderName(), "</td>" + "</tr>" + "<tr><td height=7></td></tr>"
-						+
-						//ADMINISTRATOR ??
-						/*html.append("<tr>");
-						 html.append("<td fixWIDTH=100 align=left>ADMINISTRATOR</td>");
-						 html.append("<td fixWIDTH=195 align=left height=16>"+cl.getLeaderName()+"</td>");
-						 html.append("</tr>");*/
-						"<tr><td height=7></td></tr>" + "<tr>" + "<td fixWIDTH=100 align=left>ALLIANCE</td>"
-						+ "<td fixWIDTH=195 align=left height=16>", (cl.getAllyName() != null) ? cl.getAllyName() : "", "</td>" + "</tr>"
-								+ "</table>" + "</td>" + "<td fixWIDTH=5></td>"
-								+ "</tr>"
-								+ "<tr><td height=10></td></tr>"
-								+ "</table>"
-								+
-								//TODO: the BB for clan :)
-								//html.append("<table border=0 cellspacing=0 cellpadding=0 width=610  bgcolor=333333>");
-								"<img src=\"L2UI.squareblank\" width=\"1\" height=\"5\">"
-								+ "<img src=\"L2UI.squaregray\" width=\"610\" height=\"1\">" + "<br>" + "</center>" + "<br> <br>" + "</body>"
-								+ "</html>");
+				final String html = StringUtil.concat("<html><body><center><br><br><br1><br1><table border=0 cellspacing=0 cellpadding=0><tr><td FIXWIDTH=15>&nbsp;</td><td width=610 height=30 align=left><a action=\"bypass _bbshome\">HOME</a> &gt; <a action=\"bypass _bbsclan_clanlist\"> CLAN COMMUNITY </a>  &gt; <a action=\"bypass _bbsclan_clanhome;", String.valueOf(clanId), "\"> &amp;$802; </a></td></tr></table><table border=0 cellspacing=0 cellpadding=0 width=610 bgcolor=434343><tr><td height=10></td></tr><tr><td fixWIDTH=5></td><td fixwidth=600><a action=\"bypass _bbsclan_clanhome;", String.valueOf(clanId), ";announce\">[CLAN ANNOUNCEMENT]</a> <a action=\"bypass _bbsclan_clanhome;", String.valueOf(clanId), ";cbb\">[CLAN BULLETIN BOARD]</a><a action=\"bypass _bbsclan_clanhome;", String.valueOf(clanId), ";cmail\">[CLAN MAIL]</a>&nbsp;&nbsp;<a action=\"bypass _bbsclan_clannotice_edit;", String.valueOf(clanId), ";cnotice\">[CLAN NOTICE]</a>&nbsp;&nbsp;</td><td fixWIDTH=5></td></tr><tr><td height=10></td></tr></table><table border=0 cellspacing=0 cellpadding=0 width=610><tr><td height=10></td></tr><tr><td fixWIDTH=5></td><td fixwidth=290 valign=top></td><td fixWIDTH=5></td><td fixWIDTH=5 align=center valign=top><img src=\"l2ui.squaregray\" width=2  height=128></td><td fixWIDTH=5></td><td fixwidth=295><table border=0 cellspacing=0 cellpadding=0 width=295><tr><td fixWIDTH=100 align=left>CLAN NAME</td><td fixWIDTH=195 align=left>", cl.getName(), "</td></tr><tr><td height=7></td></tr><tr><td fixWIDTH=100 align=left>CLAN LEVEL</td><td fixWIDTH=195 align=left height=16>", String.valueOf(cl.getLevel()), "</td></tr><tr><td height=7></td></tr><tr><td fixWIDTH=100 align=left>CLAN MEMBERS</td><td fixWIDTH=195 align=left height=16>", String.valueOf(cl.getMembersCount()), "</td></tr><tr><td height=7></td></tr><tr><td fixWIDTH=100 align=left>CLAN LEADER</td><td fixWIDTH=195 align=left height=16>", cl.getLeaderName(), "</td></tr><tr><td height=7></td></tr>" +
+				// ADMINISTRATOR ??
+				/*
+				 * html.append("<tr>"); html.append("<td fixWIDTH=100 align=left>ADMINISTRATOR</td>"); html.append("<td fixWIDTH=195 align=left height=16>"+cl.getLeaderName()+"</td>"); html.append("</tr>");
+				 */
+				"<tr><td height=7></td></tr><tr><td fixWIDTH=100 align=left>ALLIANCE</td><td fixWIDTH=195 align=left height=16>", (cl.getAllyName() != null) ? cl.getAllyName() : "", "</td></tr></table></td><td fixWIDTH=5></td></tr><tr><td height=10></td></tr></table>" +
+				// TODO: the BB for clan :)
+				// html.append("<table border=0 cellspacing=0 cellpadding=0 width=610  bgcolor=333333>");
+				"<img src=\"L2UI.squareblank\" width=\"1\" height=\"5\"><img src=\"L2UI.squaregray\" width=\"610\" height=\"1\"><br></center><br> <br></body></html>");
 				separateAndSend(html, activeChar);
 			}
 		}

+ 14 - 10
L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/Manager/ForumsBBSManager.java

@@ -30,18 +30,9 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 public class ForumsBBSManager extends BaseBBSManager
 {
 	private static Logger _log = Logger.getLogger(ForumsBBSManager.class.getName());
-	private List<Forum> _table;
+	private final List<Forum> _table;
 	private int _lastid = 1;
 	
-	/**
-	 * Gets the single instance of ForumsBBSManager.
-	 * @return single instance of ForumsBBSManager
-	 */
-	public static ForumsBBSManager getInstance()
-	{
-		return SingletonHolder._instance;
-	}
-	
 	/**
 	 * Instantiates a new forums bbs manager.
 	 */
@@ -71,7 +62,9 @@ public class ForumsBBSManager extends BaseBBSManager
 	public void initRoot()
 	{
 		for (Forum f : _table)
+		{
 			f.vload();
+		}
 		_log.info("Loaded " + _table.size() + " forums. Last forum id used: " + _lastid);
 	}
 	
@@ -82,7 +75,9 @@ public class ForumsBBSManager extends BaseBBSManager
 	public void addForum(Forum ff)
 	{
 		if (ff == null)
+		{
 			return;
+		}
 		
 		_table.add(ff);
 		
@@ -162,6 +157,15 @@ public class ForumsBBSManager extends BaseBBSManager
 		
 	}
 	
+	/**
+	 * Gets the single instance of ForumsBBSManager.
+	 * @return single instance of ForumsBBSManager
+	 */
+	public static ForumsBBSManager getInstance()
+	{
+		return SingletonHolder._instance;
+	}
+	
 	private static class SingletonHolder
 	{
 		protected static final ForumsBBSManager _instance = new ForumsBBSManager();

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 6 - 37
L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/Manager/PostBBSManager.java


+ 55 - 69
L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/Manager/RegionBBSManager.java

@@ -14,8 +14,6 @@
  */
 package com.l2jserver.gameserver.communitybbs.Manager;
 
-import gnu.trove.iterator.TIntObjectIterator;
-
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.StringTokenizer;
@@ -41,11 +39,13 @@ import com.l2jserver.gameserver.network.serverpackets.ShowBoard;
 import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
 import com.l2jserver.util.StringUtil;
 
+import gnu.trove.iterator.TIntObjectIterator;
+
 public class RegionBBSManager extends BaseBBSManager
 {
 	private static Logger _logChat = Logger.getLogger("chat");
 	
-	private static final Comparator<L2PcInstance> playerNameComparator = new Comparator<L2PcInstance>()
+	private static final Comparator<L2PcInstance> PLAYER_NAME_COMPARATOR = new Comparator<L2PcInstance>()
 	{
 		@Override
 		public int compare(L2PcInstance p1, L2PcInstance p2)
@@ -94,8 +94,7 @@ public class RegionBBSManager extends BaseBBSManager
 			}
 			else
 			{
-				ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + command
-						+ " is not implemented yet</center><br><br></body></html>", "101");
+				ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + command + " is not implemented yet</center><br><br></body></html>", "101");
 				activeChar.sendPacket(sb);
 				activeChar.sendPacket(new ShowBoard(null, "102"));
 				activeChar.sendPacket(new ShowBoard(null, "103"));
@@ -110,8 +109,7 @@ public class RegionBBSManager extends BaseBBSManager
 	 */
 	private void showOldCommunityPI(L2PcInstance activeChar, String name)
 	{
-		final StringBuilder htmlCode = StringUtil.startAppend(1000, "<html><body><br>"
-				+ "<table border=0><tr><td FIXWIDTH=15></td><td align=center>L2J Community Board<img src=\"sek.cbui355\" width=610 height=1></td></tr><tr><td FIXWIDTH=15></td><td>");
+		final StringBuilder htmlCode = StringUtil.startAppend(1000, "<html><body><br><table border=0><tr><td FIXWIDTH=15></td><td align=center>L2J Community Board<img src=\"sek.cbui355\" width=610 height=1></td></tr><tr><td FIXWIDTH=15></td><td>");
 		L2PcInstance player = L2World.getInstance().getPlayer(name);
 		
 		if (player != null)
@@ -123,17 +121,21 @@ public class RegionBBSManager extends BaseBBSManager
 			}
 			String levelApprox = "low";
 			if (player.getLevel() >= 60)
+			{
 				levelApprox = "very high";
+			}
 			else if (player.getLevel() >= 40)
+			{
 				levelApprox = "high";
+			}
 			else if (player.getLevel() >= 20)
+			{
 				levelApprox = "medium";
+			}
 			
-			StringUtil.append(htmlCode, "<table border=0><tr><td>", player.getName(), " (", sex, " ", ClassListData.getInstance().getClass(player.getClassId()).getClientCode(), "):</td></tr>"
-					+ "<tr><td>Level: ", levelApprox, "</td></tr>" + "<tr><td><br></td></tr>");
+			StringUtil.append(htmlCode, "<table border=0><tr><td>", player.getName(), " (", sex, " ", ClassListData.getInstance().getClass(player.getClassId()).getClientCode(), "):</td></tr><tr><td>Level: ", levelApprox, "</td></tr><tr><td><br></td></tr>");
 			
-			if (activeChar != null
-					&& (activeChar.isGM() || player.getObjectId() == activeChar.getObjectId() || Config.SHOW_LEVEL_COMMUNITYBOARD))
+			if ((activeChar != null) && (activeChar.isGM() || (player.getObjectId() == activeChar.getObjectId()) || Config.SHOW_LEVEL_COMMUNITYBOARD))
 			{
 				long nextLevelExp = 0;
 				long nextLevelExpNeeded = 0;
@@ -143,9 +145,7 @@ public class RegionBBSManager extends BaseBBSManager
 					nextLevelExpNeeded = nextLevelExp - player.getExp();
 				}
 				
-				StringUtil.append(htmlCode, "<tr><td>Level: ", String.valueOf(player.getLevel()), "</td></tr>" + "<tr><td>Experience: ", String.valueOf(player.getExp()), "/", String.valueOf(nextLevelExp), "</td></tr>"
-						+ "<tr><td>Experience needed for level up: ", String.valueOf(nextLevelExpNeeded), "</td></tr>"
-						+ "<tr><td><br></td></tr>");
+				StringUtil.append(htmlCode, "<tr><td>Level: ", String.valueOf(player.getLevel()), "</td></tr><tr><td>Experience: ", String.valueOf(player.getExp()), "/", String.valueOf(nextLevelExp), "</td></tr><tr><td>Experience needed for level up: ", String.valueOf(nextLevelExpNeeded), "</td></tr><tr><td><br></td></tr>");
 			}
 			
 			int uptime = (int) player.getUptime() / 1000;
@@ -153,16 +153,14 @@ public class RegionBBSManager extends BaseBBSManager
 			int m = (uptime - (h * 3600)) / 60;
 			int s = ((uptime - (h * 3600)) - (m * 60));
 			
-			StringUtil.append(htmlCode, "<tr><td>Uptime: ", String.valueOf(h), "h ", String.valueOf(m), "m ", String.valueOf(s), "s</td></tr>"
-					+ "<tr><td><br></td></tr>");
+			StringUtil.append(htmlCode, "<tr><td>Uptime: ", String.valueOf(h), "h ", String.valueOf(m), "m ", String.valueOf(s), "s</td></tr><tr><td><br></td></tr>");
 			
 			if (player.getClan() != null)
 			{
-				StringUtil.append(htmlCode, "<tr><td>Clan: ", player.getClan().getName(), "</td></tr>" + "<tr><td><br></td></tr>");
+				StringUtil.append(htmlCode, "<tr><td>Clan: ", player.getClan().getName(), "</td></tr><tr><td><br></td></tr>");
 			}
 			
-			StringUtil.append(htmlCode, "<tr><td><multiedit var=\"pm\" width=240 height=40><button value=\"Send PM\" action=\"Write Region PM ", player.getName(), " pm pm pm\" width=110 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><br><button value=\"Back\" action=\"bypass _bbsloc\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table>"
-					+ "</td></tr></table>" + "</body></html>");
+			StringUtil.append(htmlCode, "<tr><td><multiedit var=\"pm\" width=240 height=40><button value=\"Send PM\" action=\"Write Region PM ", player.getName(), " pm pm pm\" width=110 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><br><button value=\"Back\" action=\"bypass _bbsloc\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table></td></tr></table></body></html>");
 			separateAndSend(htmlCode.toString(), activeChar);
 		}
 		else
@@ -188,12 +186,13 @@ public class RegionBBSManager extends BaseBBSManager
 	public void parsewrite(String ar1, String ar2, String ar3, String ar4, String ar5, L2PcInstance activeChar)
 	{
 		if (activeChar == null)
+		{
 			return;
+		}
 		
 		if (ar1.equals("PM"))
 		{
-			final StringBuilder htmlCode = StringUtil.startAppend(500, "<html><body><br>"
-					+ "<table border=0><tr><td FIXWIDTH=15></td><td align=center>L2J Community Board<img src=\"sek.cbui355\" width=610 height=1></td></tr><tr><td FIXWIDTH=15></td><td>");
+			final StringBuilder htmlCode = StringUtil.startAppend(500, "<html><body><br><table border=0><tr><td FIXWIDTH=15></td><td align=center>L2J Community Board<img src=\"sek.cbui355\" width=610 height=1></td></tr><tr><td FIXWIDTH=15></td><td>");
 			
 			try
 			{
@@ -201,8 +200,7 @@ public class RegionBBSManager extends BaseBBSManager
 				L2PcInstance receiver = L2World.getInstance().getPlayer(ar2);
 				if (receiver == null)
 				{
-					StringUtil.append(htmlCode, "Player not found!<br><button value=\"Back\" action=\"bypass _bbsloc;playerinfo;", ar2, "\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
-							+ "</td></tr></table></body></html>");
+					StringUtil.append(htmlCode, "Player not found!<br><button value=\"Back\" action=\"bypass _bbsloc;playerinfo;", ar2, "\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table></body></html>");
 					separateAndSend(htmlCode.toString(), activeChar);
 					return;
 				}
@@ -231,16 +229,19 @@ public class RegionBBSManager extends BaseBBSManager
 				{
 					LogRecord record = new LogRecord(Level.INFO, ar3);
 					record.setLoggerName("chat");
-					record.setParameters(new Object[] { "TELL", "[" + activeChar.getName() + " to " + receiver.getName() + "]" });
+					record.setParameters(new Object[]
+					{
+						"TELL",
+						"[" + activeChar.getName() + " to " + receiver.getName() + "]"
+					});
 					_logChat.log(record);
 				}
 				CreatureSay cs = new CreatureSay(activeChar.getObjectId(), Say2.TELL, activeChar.getName(), ar3);
-				if (!receiver.isSilenceMode(activeChar.getObjectId()) && !BlockList.isBlocked(receiver, activeChar) )
+				if (!receiver.isSilenceMode(activeChar.getObjectId()) && !BlockList.isBlocked(receiver, activeChar))
 				{
 					receiver.sendPacket(cs);
 					activeChar.sendPacket(new CreatureSay(activeChar.getObjectId(), Say2.TELL, "->" + receiver.getName(), ar3));
-					StringUtil.append(htmlCode, "Message Sent<br><button value=\"Back\" action=\"bypass _bbsloc;playerinfo;", receiver.getName(), "\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
-							+ "</td></tr></table></body></html>");
+					StringUtil.append(htmlCode, "Message Sent<br><button value=\"Back\" action=\"bypass _bbsloc;playerinfo;", receiver.getName(), "\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table></body></html>");
 					separateAndSend(htmlCode.toString(), activeChar);
 				}
 				else
@@ -264,6 +265,7 @@ public class RegionBBSManager extends BaseBBSManager
 		}
 		
 	}
+	
 	private int _onlineCount = 0;
 	private int _onlineCountGm = 0;
 	private static FastMap<Integer, FastList<L2PcInstance>> _onlinePlayers = new FastMap<Integer, FastList<L2PcInstance>>().shared();
@@ -293,7 +295,7 @@ public class RegionBBSManager extends BaseBBSManager
 				sortedPlayers.add(it.value());
 			}
 		}
-		Collections.sort(sortedPlayers, playerNameComparator);
+		Collections.sort(sortedPlayers, PLAYER_NAME_COMPARATOR);
 		
 		_onlinePlayers.clear();
 		_onlineCount = 0;
@@ -307,7 +309,7 @@ public class RegionBBSManager extends BaseBBSManager
 		_communityPages.clear();
 		writeCommunityPages();
 	}
-
+	
 	/**
 	 * Adds the online player.
 	 * @param player the player
@@ -324,7 +326,9 @@ public class RegionBBSManager extends BaseBBSManager
 				{
 					page.add(player);
 					if (!player.getAppearance().getInvisible())
+					{
 						_onlineCount++;
+					}
 					_onlineCountGm++;
 				}
 				added = true;
@@ -345,7 +349,9 @@ public class RegionBBSManager extends BaseBBSManager
 			{
 				_onlinePlayers.put(page, temp);
 				if (!player.getAppearance().getInvisible())
+				{
 					_onlineCount++;
+				}
 				_onlineCountGm++;
 			}
 		}
@@ -367,22 +373,7 @@ public class RegionBBSManager extends BaseBBSManager
 		{
 			FastMap<String, String> communityPage = new FastMap<>();
 			htmlCode.setLength(0);
-			StringUtil.append(htmlCode, "<html><body><br>" + "<table>" + trOpen + "<td align=left valign=top>Server Restarted: ", String.valueOf(GameServer.dateTimeServerStarted.getTime()), tdClose
-					+ trClose + "</table>" + "<table>" + trOpen + tdOpen + "XP Rate: x", String.valueOf(Config.RATE_XP), tdClose
-					+ colSpacer + tdOpen + "Party XP Rate: x", String.valueOf(Config.RATE_XP * Config.RATE_PARTY_XP), tdClose + colSpacer
-					+ tdOpen + "XP Exponent: ", String.valueOf(Config.ALT_GAME_EXPONENT_XP), tdClose + trClose + trOpen + tdOpen
-					+ "SP Rate: x", String.valueOf(Config.RATE_SP), tdClose + colSpacer + tdOpen + "Party SP Rate: x", String.valueOf(Config.RATE_SP
-							* Config.RATE_PARTY_SP), tdClose + colSpacer + tdOpen + "SP Exponent: ", String.valueOf(Config.ALT_GAME_EXPONENT_SP), tdClose
-							+ trClose + trOpen + tdOpen + "Drop Rate: ", String.valueOf(Config.RATE_DROP_ITEMS), tdClose + colSpacer + tdOpen
-							+ "Spoil Rate: ", String.valueOf(Config.RATE_DROP_SPOIL), tdClose + colSpacer + tdOpen + "Adena Rate: ", String.valueOf(Config.RATE_DROP_ITEMS_ID.get(PcInventory.ADENA_ID)), tdClose
-							+ trClose
-							+ "</table>"
-							+ "<table>"
-							+ trOpen
-							+ "<td><img src=\"sek.cbui355\" width=600 height=1><br></td>"
-							+ trClose
-							+ trOpen + tdOpen, String.valueOf(L2World.getInstance().getAllVisibleObjectsCount()), " Object count</td>" + trClose
-							+ trOpen + tdOpen, String.valueOf(getOnlineCount("gm")), " Player(s) Online</td>" + trClose + "</table>");
+			StringUtil.append(htmlCode, "<html><body><br><table>" + trOpen + "<td align=left valign=top>Server Restarted: ", String.valueOf(GameServer.dateTimeServerStarted.getTime()), tdClose + trClose + "</table><table>" + trOpen + tdOpen + "XP Rate: x", String.valueOf(Config.RATE_XP), tdClose + colSpacer + tdOpen + "Party XP Rate: x", String.valueOf(Config.RATE_XP * Config.RATE_PARTY_XP), tdClose + colSpacer + tdOpen + "XP Exponent: ", String.valueOf(Config.ALT_GAME_EXPONENT_XP), tdClose + trClose + trOpen + tdOpen + "SP Rate: x", String.valueOf(Config.RATE_SP), tdClose + colSpacer + tdOpen + "Party SP Rate: x", String.valueOf(Config.RATE_SP * Config.RATE_PARTY_SP), tdClose + colSpacer + tdOpen + "SP Exponent: ", String.valueOf(Config.ALT_GAME_EXPONENT_SP), tdClose + trClose + trOpen + tdOpen + "Drop Rate: ", String.valueOf(Config.RATE_DROP_ITEMS), tdClose + colSpacer + tdOpen + "Spoil Rate: ", String.valueOf(Config.RATE_DROP_SPOIL), tdClose + colSpacer + tdOpen + "Adena Rate: ", String.valueOf(Config.RATE_DROP_ITEMS_ID.get(PcInventory.ADENA_ID)), tdClose + trClose + "</table><table>" + trOpen + "<td><img src=\"sek.cbui355\" width=600 height=1><br></td>" + trClose + trOpen + tdOpen, String.valueOf(L2World.getInstance().getAllVisibleObjectsCount()), " Object count</td>" + trClose + trOpen + tdOpen, String.valueOf(getOnlineCount("gm")), " Player(s) Online</td>" + trClose + "</table>");
 			
 			int cell = 0;
 			if (Config.BBS_SHOW_PLAYERLIST)
@@ -412,7 +403,9 @@ public class RegionBBSManager extends BaseBBSManager
 					htmlCode.append("</a></td>");
 					
 					if (cell < Config.NAME_PER_ROW_COMMUNITYBOARD)
+					{
 						htmlCode.append(colSpacer);
+					}
 					
 					if (cell == Config.NAME_PER_ROW_COMMUNITYBOARD)
 					{
@@ -420,13 +413,12 @@ public class RegionBBSManager extends BaseBBSManager
 						htmlCode.append(trClose);
 					}
 				}
-				if (cell > 0 && cell < Config.NAME_PER_ROW_COMMUNITYBOARD)
+				if ((cell > 0) && (cell < Config.NAME_PER_ROW_COMMUNITYBOARD))
 				{
 					htmlCode.append(trClose);
 				}
 				
-				htmlCode.append("</table><br></td></tr>" + trOpen + "<td><img src=\"sek.cbui355\" width=600 height=1><br></td>" + trClose
-						+ "</table>");
+				htmlCode.append("</table><br></td></tr>" + trOpen + "<td><img src=\"sek.cbui355\" width=600 height=1><br></td>" + trClose + "</table>");
 			}
 			
 			if (getOnlineCount("gm") > Config.NAME_PAGE_SIZE_COMMUNITYBOARD)
@@ -441,8 +433,7 @@ public class RegionBBSManager extends BaseBBSManager
 					StringUtil.append(htmlCode, "<td align=right width=190><button value=\"Prev\" action=\"bypass _bbsloc;page;", String.valueOf(page - 1), "\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
 				}
 				
-				StringUtil.append(htmlCode, "<td FIXWIDTH=10></td>" + "<td align=center valign=top width=200>Displaying ", String.valueOf(((page - 1) * Config.NAME_PAGE_SIZE_COMMUNITYBOARD) + 1), " - ", String.valueOf(((page - 1) * Config.NAME_PAGE_SIZE_COMMUNITYBOARD)
-						+ getOnlinePlayers(page).size()), " player(s)</td>" + "<td FIXWIDTH=10></td>");
+				StringUtil.append(htmlCode, "<td FIXWIDTH=10></td><td align=center valign=top width=200>Displaying ", String.valueOf(((page - 1) * Config.NAME_PAGE_SIZE_COMMUNITYBOARD) + 1), " - ", String.valueOf(((page - 1) * Config.NAME_PAGE_SIZE_COMMUNITYBOARD) + getOnlinePlayers(page).size()), " player(s)</td><td FIXWIDTH=10></td>");
 				if (getOnlineCount("gm") <= (page * Config.NAME_PAGE_SIZE_COMMUNITYBOARD))
 				{
 					htmlCode.append("<td width=190><button value=\"Next\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
@@ -459,20 +450,7 @@ public class RegionBBSManager extends BaseBBSManager
 			communityPage.put("gm", htmlCode.toString());
 			
 			htmlCode.setLength(0);
-			StringUtil.append(htmlCode, "<html><body><br>" + "<table>" + trOpen + "<td align=left valign=top>Server Restarted: ", String.valueOf(GameServer.dateTimeServerStarted.getTime()), tdClose
-					+ trClose + "</table>" + "<table>" + trOpen + tdOpen + "XP Rate: ", String.valueOf(Config.RATE_XP), tdClose + colSpacer
-					+ tdOpen + "Party XP Rate: ", String.valueOf(Config.RATE_PARTY_XP), tdClose + colSpacer + tdOpen + "XP Exponent: ", String.valueOf(Config.ALT_GAME_EXPONENT_XP), tdClose
-					+ trClose + trOpen + tdOpen + "SP Rate: ", String.valueOf(Config.RATE_SP), tdClose + colSpacer + tdOpen
-					+ "Party SP Rate: ", String.valueOf(Config.RATE_PARTY_SP), tdClose + colSpacer + tdOpen + "SP Exponent: ", String.valueOf(Config.ALT_GAME_EXPONENT_SP), tdClose
-					+ trClose + trOpen + tdOpen + "Drop Rate: ", String.valueOf(Config.RATE_DROP_ITEMS), tdClose + colSpacer + tdOpen
-					+ "Spoil Rate: ", String.valueOf(Config.RATE_DROP_SPOIL), tdClose + colSpacer + tdOpen + "Adena Rate: ", String.valueOf(Config.RATE_DROP_ITEMS_ID.get(PcInventory.ADENA_ID)), tdClose
-					+ trClose
-					+ "</table>"
-					+ "<table>"
-					+ trOpen
-					+ "<td><img src=\"sek.cbui355\" width=600 height=1><br></td>"
-					+ trClose
-					+ trOpen + tdOpen, String.valueOf(getOnlineCount("pl")), " Player(s) Online</td>" + trClose + "</table>");
+			StringUtil.append(htmlCode, "<html><body><br><table>" + trOpen + "<td align=left valign=top>Server Restarted: ", String.valueOf(GameServer.dateTimeServerStarted.getTime()), tdClose + trClose + "</table><table>" + trOpen + tdOpen + "XP Rate: ", String.valueOf(Config.RATE_XP), tdClose + colSpacer + tdOpen + "Party XP Rate: ", String.valueOf(Config.RATE_PARTY_XP), tdClose + colSpacer + tdOpen + "XP Exponent: ", String.valueOf(Config.ALT_GAME_EXPONENT_XP), tdClose + trClose + trOpen + tdOpen + "SP Rate: ", String.valueOf(Config.RATE_SP), tdClose + colSpacer + tdOpen + "Party SP Rate: ", String.valueOf(Config.RATE_PARTY_SP), tdClose + colSpacer + tdOpen + "SP Exponent: ", String.valueOf(Config.ALT_GAME_EXPONENT_SP), tdClose + trClose + trOpen + tdOpen + "Drop Rate: ", String.valueOf(Config.RATE_DROP_ITEMS), tdClose + colSpacer + tdOpen + "Spoil Rate: ", String.valueOf(Config.RATE_DROP_SPOIL), tdClose + colSpacer + tdOpen + "Adena Rate: ", String.valueOf(Config.RATE_DROP_ITEMS_ID.get(PcInventory.ADENA_ID)), tdClose + trClose + "</table><table>" + trOpen + "<td><img src=\"sek.cbui355\" width=600 height=1><br></td>" + trClose + trOpen + tdOpen, String.valueOf(getOnlineCount("pl")), " Player(s) Online</td>" + trClose + "</table>");
 			
 			if (Config.BBS_SHOW_PLAYERLIST)
 			{
@@ -482,7 +460,9 @@ public class RegionBBSManager extends BaseBBSManager
 				for (L2PcInstance player : getOnlinePlayers(page))
 				{
 					if ((player == null) || (player.getAppearance().getInvisible()))
+					{
 						continue; // Go to next
+					}
 					
 					cell++;
 					
@@ -505,7 +485,9 @@ public class RegionBBSManager extends BaseBBSManager
 					htmlCode.append("</a></td>");
 					
 					if (cell < Config.NAME_PER_ROW_COMMUNITYBOARD)
+					{
 						htmlCode.append(colSpacer);
+					}
 					
 					if (cell == Config.NAME_PER_ROW_COMMUNITYBOARD)
 					{
@@ -513,11 +495,12 @@ public class RegionBBSManager extends BaseBBSManager
 						htmlCode.append(trClose);
 					}
 				}
-				if (cell > 0 && cell < Config.NAME_PER_ROW_COMMUNITYBOARD)
+				if ((cell > 0) && (cell < Config.NAME_PER_ROW_COMMUNITYBOARD))
+				{
 					htmlCode.append(trClose);
+				}
 				
-				htmlCode.append("</table><br></td></tr>" + trOpen + "<td><img src=\"sek.cbui355\" width=600 height=1><br></td>" + trClose
-						+ "</table>");
+				htmlCode.append("</table><br></td></tr>" + trOpen + "<td><img src=\"sek.cbui355\" width=600 height=1><br></td>" + trClose + "</table>");
 			}
 			
 			if (getOnlineCount("pl") > Config.NAME_PAGE_SIZE_COMMUNITYBOARD)
@@ -533,8 +516,7 @@ public class RegionBBSManager extends BaseBBSManager
 					StringUtil.append(htmlCode, "<td align=right width=190><button value=\"Prev\" action=\"bypass _bbsloc;page;", String.valueOf(page - 1), "\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
 				}
 				
-				StringUtil.append(htmlCode, "<td FIXWIDTH=10></td>" + "<td align=center valign=top width=200>Displaying ", String.valueOf(((page - 1) * Config.NAME_PAGE_SIZE_COMMUNITYBOARD) + 1), " - ", String.valueOf(((page - 1) * Config.NAME_PAGE_SIZE_COMMUNITYBOARD)
-						+ getOnlinePlayers(page).size()), " player(s)</td>" + "<td FIXWIDTH=10></td>");
+				StringUtil.append(htmlCode, "<td FIXWIDTH=10></td><td align=center valign=top width=200>Displaying ", String.valueOf(((page - 1) * Config.NAME_PAGE_SIZE_COMMUNITYBOARD) + 1), " - ", String.valueOf(((page - 1) * Config.NAME_PAGE_SIZE_COMMUNITYBOARD) + getOnlinePlayers(page).size()), " player(s)</td><td FIXWIDTH=10></td>");
 				
 				if (getOnlineCount("pl") <= (page * Config.NAME_PAGE_SIZE_COMMUNITYBOARD))
 				{
@@ -564,7 +546,9 @@ public class RegionBBSManager extends BaseBBSManager
 	private int getOnlineCount(String type)
 	{
 		if (type.equalsIgnoreCase("gm"))
+		{
 			return _onlineCountGm;
+		}
 		
 		return _onlineCount;
 	}
@@ -588,7 +572,9 @@ public class RegionBBSManager extends BaseBBSManager
 	public String getCommunityPage(int page, String type)
 	{
 		if (_communityPages.get(page) != null)
+		{
 			return _communityPages.get(page).get(type);
+		}
 		
 		return null;
 	}

+ 2 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/Manager/TopBBSManager.java

@@ -20,7 +20,6 @@ import com.l2jserver.gameserver.cache.HtmCache;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.network.serverpackets.ShowBoard;
 
-
 public class TopBBSManager extends BaseBBSManager
 {
 	@Override
@@ -52,15 +51,13 @@ public class TopBBSManager extends BaseBBSManager
 			String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/" + idp + ".htm");
 			if (content == null)
 			{
-				content = "<html><body><br><br><center>404 :File not found: 'data/html/CommunityBoard/" + idp
-				+ ".htm' </center></body></html>";
+				content = "<html><body><br><br><center>404 :File not found: 'data/html/CommunityBoard/" + idp + ".htm' </center></body></html>";
 			}
 			separateAndSend(content, activeChar);
 		}
 		else
 		{
-			ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + command
-					+ " is not implemented yet</center><br><br></body></html>", "101");
+			ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + command + " is not implemented yet</center><br><br></body></html>", "101");
 			activeChar.sendPacket(sb);
 			activeChar.sendPacket(new ShowBoard(null, "102"));
 			activeChar.sendPacket(new ShowBoard(null, "103"));

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 14 - 67
L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/Manager/TopicBBSManager.java


+ 3 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/AugmentationData.java

@@ -108,7 +108,7 @@ public class AugmentationData
 	private final Map<Integer, SkillHolder> _allSkills = new HashMap<>();
 	
 	protected AugmentationData()
-	{		
+	{
 		for (int i = 0; i < 10; i++)
 		{
 			if (i < STAT_NUMBEROF_BLOCKS)
@@ -184,7 +184,7 @@ public class AugmentationData
 			_log.info(getClass().getSimpleName() + ": Loaded: " + _blueSkills.get(i).size() + " blue, " + _purpleSkills.get(i).size() + " purple and " + _redSkills.get(i).size() + " red skills for lifeStoneLevel " + i);
 		}
 	}
-		
+	
 	public static class AugmentationStat
 	{
 		private final Stats _stat;
@@ -911,7 +911,7 @@ public class AugmentationData
 	}
 	
 	/**
-	 * @param augmentationId 
+	 * @param augmentationId
 	 * @return skill by augmentation Id or null if not valid or not found.
 	 */
 	public L2Skill getAugSkillById(int augmentationId)

+ 21 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/CharNameTable.java

@@ -32,7 +32,6 @@ import com.l2jserver.util.L2FastMap;
 
 /**
  * This class ...
- *
  * @version $Revision: 1.3.2.2.2.1 $ $Date: 2005/03/27 15:29:18 $
  */
 public class CharNameTable
@@ -45,7 +44,9 @@ public class CharNameTable
 	protected CharNameTable()
 	{
 		if (Config.CACHE_CHAR_NAMES)
+		{
 			loadAll();
+		}
 	}
 	
 	public static CharNameTable getInstance()
@@ -67,7 +68,9 @@ public class CharNameTable
 		if (name != null)
 		{
 			if (!name.equals(_chars.get(objectId)))
+			{
 				_chars.put(objectId, name);
+			}
 		}
 	}
 	
@@ -79,8 +82,10 @@ public class CharNameTable
 	
 	public final int getIdByName(String name)
 	{
-		if (name == null || name.isEmpty())
+		if ((name == null) || name.isEmpty())
+		{
 			return -1;
+		}
 		
 		Iterator<Entry<Integer, String>> it = _chars.entrySet().iterator();
 		
@@ -89,11 +94,15 @@ public class CharNameTable
 		{
 			pair = it.next();
 			if (pair.getValue().equalsIgnoreCase(name))
+			{
 				return pair.getKey();
+			}
 		}
 		
 		if (Config.CACHE_CHAR_NAMES)
+		{
 			return -1;
+		}
 		
 		int id = -1;
 		int accessLevel = 0;
@@ -129,14 +138,20 @@ public class CharNameTable
 	public final String getNameById(int id)
 	{
 		if (id <= 0)
+		{
 			return null;
+		}
 		
 		String name = _chars.get(id);
 		if (name != null)
+		{
 			return name;
+		}
 		
 		if (Config.CACHE_CHAR_NAMES)
+		{
 			return null;
+		}
 		
 		int accessLevel = 0;
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
@@ -157,20 +172,22 @@ public class CharNameTable
 			_log.log(Level.WARNING, getClass().getSimpleName() + ": Could not check existing char id: " + e.getMessage(), e);
 		}
 		
-		if (name != null && !name.isEmpty())
+		if ((name != null) && !name.isEmpty())
 		{
 			_chars.put(id, name);
 			_accessLevels.put(id, accessLevel);
 			return name;
 		}
 		
-		return null; //not found
+		return null; // not found
 	}
 	
 	public final int getAccessLevelById(int objectId)
 	{
 		if (getNameById(objectId) != null)
+		{
 			return _accessLevels.get(objectId);
+		}
 		
 		return 0;
 	}

+ 22 - 8
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/CharSummonTable.java

@@ -14,8 +14,6 @@
  */
 package com.l2jserver.gameserver.datatables;
 
-import gnu.trove.map.hash.TIntIntHashMap;
-
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -38,6 +36,8 @@ import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
 import com.l2jserver.gameserver.model.skills.l2skills.L2SkillSummon;
 import com.l2jserver.gameserver.network.serverpackets.PetItemList;
 
+import gnu.trove.map.hash.TIntIntHashMap;
+
 /**
  * @author Nyaran
  */
@@ -109,8 +109,10 @@ public class CharSummonTable
 	
 	public void saveSummon(L2ServitorInstance summon)
 	{
-		if (summon == null || summon.getTimeRemaining() <= 0)
+		if ((summon == null) || (summon.getTimeRemaining() <= 0))
+		{
 			return;
+		}
 		_servitors.put(summon.getOwner().getObjectId(), summon.getReferenceSkill());
 		
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
@@ -127,7 +129,7 @@ public class CharSummonTable
 		{
 			_log.log(Level.SEVERE, getClass().getSimpleName() + ": Failed to store summon [SummonId: " + summon.getNpcId() + "] from Char [CharId: " + summon.getOwner().getObjectId() + "] data", e);
 		}
-			
+		
 	}
 	
 	public void restoreServitor(L2PcInstance activeChar)
@@ -140,7 +142,7 @@ public class CharSummonTable
 			ps.setInt(2, skillId);
 			try (ResultSet rs = ps.executeQuery())
 			{
-			
+				
 				L2NpcTemplate summonTemplate;
 				L2ServitorInstance summon;
 				L2SkillSummon skill;
@@ -188,8 +190,8 @@ public class CharSummonTable
 					
 					if (summon.getLevel() >= ExperienceTable.getInstance().getMaxPetLevel())
 					{
-						summon.getStat().setExp(ExperienceTable.getInstance().getExpForLevel(ExperienceTable.getInstance().getMaxPetLevel()-1));
-						_log.warning(getClass().getSimpleName() + ": Summon (" + summon.getName() + ") NpcID: " + summon.getNpcId() + " has a level above "+ExperienceTable.getInstance().getMaxPetLevel()+". Please rectify.");
+						summon.getStat().setExp(ExperienceTable.getInstance().getExpForLevel(ExperienceTable.getInstance().getMaxPetLevel() - 1));
+						_log.warning(getClass().getSimpleName() + ": Summon (" + summon.getName() + ") NpcID: " + summon.getNpcId() + " has a level above " + ExperienceTable.getInstance().getMaxPetLevel() + ". Please rectify.");
 					}
 					else
 					{
@@ -200,11 +202,13 @@ public class CharSummonTable
 					summon.setHeading(activeChar.getHeading());
 					summon.setRunning();
 					if (!(summon instanceof L2MerchantSummonInstance))
+					{
 						activeChar.setPet(summon);
+					}
 					
 					summon.setTimeRemaining(time);
 					
-					//L2World.getInstance().storeObject(summon);
+					// L2World.getInstance().storeObject(summon);
 					summon.spawnMe(activeChar.getX() + 20, activeChar.getY() + 20, activeChar.getZ());
 				}
 			}
@@ -237,11 +241,15 @@ public class CharSummonTable
 		L2NpcTemplate npcTemplate = NpcTable.getInstance().getTemplate(sitem.getNpcId());
 		
 		if (npcTemplate == null)
+		{
 			return;
+		}
 		
 		final L2PetInstance petSummon = L2PetInstance.spawnPet(npcTemplate, activeChar, item);
 		if (petSummon == null)
+		{
 			return;
+		}
 		
 		petSummon.setShowSummonAnimation(true);
 		petSummon.setTitle(activeChar.getName());
@@ -257,7 +265,9 @@ public class CharSummonTable
 		petSummon.setRunning();
 		
 		if (!petSummon.isRespawned())
+		{
 			petSummon.store();
+		}
 		
 		activeChar.setPet(petSummon);
 		
@@ -266,9 +276,13 @@ public class CharSummonTable
 		item.setEnchantLevel(petSummon.getLevel());
 		
 		if (petSummon.getCurrentFed() <= 0)
+		{
 			petSummon.unSummon(activeChar);
+		}
 		else
+		{
 			petSummon.startFeed();
+		}
 		
 		petSummon.setFollowStatus(true);
 		

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/EventDroplist.java

@@ -29,7 +29,7 @@ import com.l2jserver.gameserver.script.EventDrop;
  * Each Special Event has a start and end date to stop to drop extra Items automatically.
  */
 public class EventDroplist
-{	
+{
 	/**
 	 * The table containing all DataDrop object
 	 */

+ 15 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/HerbDropTable.java

@@ -30,14 +30,13 @@ import com.l2jserver.gameserver.model.L2DropData;
 
 /**
  * This class ...
- *
  * @version $Revision$ $Date$
  */
 public class HerbDropTable
 {
 	private static Logger _log = Logger.getLogger(HerbDropTable.class.getName());
 	
-	private Map<Integer, List<L2DropCategory>> _herbGroups = new HashMap<>();
+	private final Map<Integer, List<L2DropCategory>> _herbGroups = new HashMap<>();
 	
 	protected HerbDropTable()
 	{
@@ -47,9 +46,15 @@ public class HerbDropTable
 	private void restoreData()
 	{
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
-			PreparedStatement statement = con.prepareStatement("SELECT "
-				+ L2DatabaseFactory.getInstance().safetyString(new String[] { "groupId", "itemId", "min", "max", "category", "chance" })
-				+ " FROM herb_droplist_groups ORDER BY groupId, chance DESC");
+			PreparedStatement statement = con.prepareStatement("SELECT " + L2DatabaseFactory.getInstance().safetyString(new String[]
+			{
+				"groupId",
+				"itemId",
+				"min",
+				"max",
+				"category",
+				"chance"
+			}) + " FROM herb_droplist_groups ORDER BY groupId, chance DESC");
 			ResultSet dropData = statement.executeQuery())
 		{
 			L2DropData dropDat = null;
@@ -58,7 +63,9 @@ public class HerbDropTable
 				int groupId = dropData.getInt("groupId");
 				List<L2DropCategory> category;
 				if (_herbGroups.containsKey(groupId))
+				{
 					category = _herbGroups.get(groupId);
+				}
 				else
 				{
 					category = new ArrayList<>();
@@ -76,12 +83,13 @@ public class HerbDropTable
 				
 				if (ItemTable.getInstance().getTemplate(dropDat.getItemId()) == null)
 				{
-					_log.warning(getClass().getSimpleName() + ": Data for undefined item template! GroupId: " + groupId+" itemId: "+dropDat.getItemId());
+					_log.warning(getClass().getSimpleName() + ": Data for undefined item template! GroupId: " + groupId + " itemId: " + dropDat.getItemId());
 					continue;
 				}
 				
 				boolean catExists = false;
 				for (L2DropCategory cat : category)
+				{
 					// if the category exists, add the drop to this category.
 					if (cat.getCategoryType() == categoryType)
 					{
@@ -89,6 +97,7 @@ public class HerbDropTable
 						catExists = true;
 						break;
 					}
+				}
 				// if the category doesn't exit, create it and add the drop
 				if (!catExists)
 				{

+ 71 - 43
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/ItemTable.java

@@ -53,7 +53,6 @@ import com.l2jserver.gameserver.util.GMAudit;
 
 /**
  * This class ...
- *
  * @version $Revision: 1.9.2.6.2.9 $ $Date: 2005/04/02 15:57:34 $
  */
 public class ItemTable
@@ -69,11 +68,10 @@ public class ItemTable
 	public static final Map<String, L2WeaponType> _weaponTypes = new FastMap<>();
 	public static final Map<String, L2ArmorType> _armorTypes = new FastMap<>();
 	
-	
 	private L2Item[] _allTemplates;
-	private Map<Integer, L2EtcItem> _etcItems;
-	private Map<Integer, L2Armor> _armors;
-	private Map<Integer, L2Weapon> _weapons;
+	private final Map<Integer, L2EtcItem> _etcItems;
+	private final Map<Integer, L2Armor> _armors;
+	private final Map<Integer, L2Weapon> _weapons;
 	
 	static
 	{
@@ -156,7 +154,7 @@ public class ItemTable
 		_slots.put("babypet", L2Item.SLOT_BABYPET);
 		_slots.put("none", L2Item.SLOT_NONE);
 		
-		//retail compatibility
+		// retail compatibility
 		_slots.put("onepiece", L2Item.SLOT_FULL_ARMOR);
 		_slots.put("hair2", L2Item.SLOT_HAIR2);
 		_slots.put("dhair", L2Item.SLOT_HAIRALL);
@@ -200,27 +198,35 @@ public class ItemTable
 		_armors.clear();
 		_etcItems.clear();
 		_weapons.clear();
-		for (L2Item item :  DocumentEngine.getInstance().loadItems())
+		for (L2Item item : DocumentEngine.getInstance().loadItems())
 		{
 			if (highest < item.getItemId())
+			{
 				highest = item.getItemId();
+			}
 			if (item instanceof L2EtcItem)
+			{
 				_etcItems.put(item.getItemId(), (L2EtcItem) item);
+			}
 			else if (item instanceof L2Armor)
+			{
 				_armors.put(item.getItemId(), (L2Armor) item);
+			}
 			else
+			{
 				_weapons.put(item.getItemId(), (L2Weapon) item);
+			}
 		}
 		buildFastLookupTable(highest);
 		_log.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + _etcItems.size() + " Etc Items");
 		_log.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + _armors.size() + " Armor Items");
 		_log.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + _weapons.size() + " Weapon Items");
-		_log.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + (_etcItems.size() + _armors.size() + _weapons.size())  + " Items in total.");
+		_log.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + (_etcItems.size() + _armors.size() + _weapons.size()) + " Items in total.");
 	}
 	
 	/**
 	 * Builds a variable in which all items are putting in in function of their ID.
-	 * @param size 
+	 * @param size
 	 */
 	private void buildFastLookupTable(int size)
 	{
@@ -254,20 +260,17 @@ public class ItemTable
 	 */
 	public L2Item getTemplate(int id)
 	{
-		if (id >= _allTemplates.length || id < 0)
+		if ((id >= _allTemplates.length) || (id < 0))
+		{
 			return null;
+		}
 		
 		return _allTemplates[id];
 	}
 	
 	/**
-	 * Create the L2ItemInstance corresponding to the Item Identifier and quantitiy add logs the activity.<BR><BR>
-	 *
-	 * <B><U> Actions</U> :</B><BR><BR>
-	 * <li>Create and Init the L2ItemInstance corresponding to the Item Identifier and quantity </li>
-	 * <li>Add the L2ItemInstance object to _allObjects of L2world </li>
-	 * <li>Logs Item creation according to log settings</li><BR><BR>
-	 *
+	 * Create the L2ItemInstance corresponding to the Item Identifier and quantitiy add logs the activity. <B><U> Actions</U> :</B> <li>Create and Init the L2ItemInstance corresponding to the Item Identifier and quantity</li> <li>Add the L2ItemInstance object to _allObjects of L2world</li> <li>Logs
+	 * Item creation according to log settings</li>
 	 * @param process : String Identifier of process triggering this action
 	 * @param itemId : int Item Identifier of the item to be created
 	 * @param count : int Quantity of items to be created for stackable items
@@ -277,7 +280,7 @@ public class ItemTable
 	 */
 	public L2ItemInstance createItem(String process, int itemId, long count, L2PcInstance actor, Object reference)
 	{
-		if(!fireNewItemListeners(process,itemId,count,actor,reference))
+		if (!fireNewItemListeners(process, itemId, count, actor, reference))
 		{
 			return null;
 		}
@@ -288,18 +291,18 @@ public class ItemTable
 		if (process.equalsIgnoreCase("loot"))
 		{
 			ScheduledFuture<?> itemLootShedule;
-			if (reference instanceof L2Attackable && ((L2Attackable) reference).isRaid()) // loot privilege for raids
+			if ((reference instanceof L2Attackable) && ((L2Attackable) reference).isRaid()) // loot privilege for raids
 			{
 				L2Attackable raid = (L2Attackable) reference;
 				// if in CommandChannel and was killing a World/RaidBoss
-				if (raid.getFirstCommandChannelAttacked() != null && !Config.AUTO_LOOT_RAIDS)
+				if ((raid.getFirstCommandChannelAttacked() != null) && !Config.AUTO_LOOT_RAIDS)
 				{
 					item.setOwnerId(raid.getFirstCommandChannelAttacked().getLeaderObjectId());
 					itemLootShedule = ThreadPoolManager.getInstance().scheduleGeneral(new ResetOwner(item), Config.LOOT_RAIDS_PRIVILEGE_INTERVAL);
 					item.setItemLootShedule(itemLootShedule);
 				}
 			}
-			else if (!Config.AUTO_LOOT || (reference instanceof L2EventMonsterInstance && ((L2EventMonsterInstance)reference).eventDropOnGround()))
+			else if (!Config.AUTO_LOOT || ((reference instanceof L2EventMonsterInstance) && ((L2EventMonsterInstance) reference).eventDropOnGround()))
 			{
 				item.setOwnerId(actor.getObjectId());
 				itemLootShedule = ThreadPoolManager.getInstance().scheduleGeneral(new ResetOwner(item), 15000);
@@ -308,22 +311,31 @@ public class ItemTable
 		}
 		
 		if (Config.DEBUG)
+		{
 			_log.fine(getClass().getSimpleName() + ": Item created  oid:" + item.getObjectId() + " itemid:" + itemId);
+		}
 		
 		// Add the L2ItemInstance object to _allObjects of L2world
 		L2World.getInstance().storeObject(item);
 		
 		// Set Item parameters
-		if (item.isStackable() && count > 1)
+		if (item.isStackable() && (count > 1))
+		{
 			item.setCount(count);
+		}
 		
 		if (Config.LOG_ITEMS && !process.equals("Reset"))
 		{
-			if (!Config.LOG_ITEMS_SMALL_LOG || (Config.LOG_ITEMS_SMALL_LOG && (item.isEquipable() || item.getItemId() == ADENA_ID)))
+			if (!Config.LOG_ITEMS_SMALL_LOG || (Config.LOG_ITEMS_SMALL_LOG && (item.isEquipable() || (item.getItemId() == ADENA_ID))))
 			{
 				LogRecord record = new LogRecord(Level.INFO, "CREATE:" + process);
 				record.setLoggerName("item");
-				record.setParameters(new Object[] { item, actor, reference });
+				record.setParameters(new Object[]
+				{
+					item,
+					actor,
+					reference
+				});
 				_logItems.log(record);
 			}
 		}
@@ -335,14 +347,17 @@ public class ItemTable
 				String referenceName = "no-reference";
 				if (reference instanceof L2Object)
 				{
-					referenceName = (((L2Object)reference).getName() != null?((L2Object)reference).getName():"no-name");
+					referenceName = (((L2Object) reference).getName() != null ? ((L2Object) reference).getName() : "no-name");
 				}
 				else if (reference instanceof String)
-					referenceName = (String)reference;
+				{
+					referenceName = (String) reference;
+				}
 				String targetName = (actor.getTarget() != null ? actor.getTarget().getName() : "no-target");
 				if (Config.GMAUDIT)
-					GMAudit.auditGMAction(actor.getName()+" ["+actor.getObjectId()+"]", process + "(id: " + itemId + " count: " + count + " name: " + item.getItemName()
-							+ " objId: " + item.getObjectId() + ")", targetName, "L2Object referencing this action is: " + referenceName);
+				{
+					GMAudit.auditGMAction(actor.getName() + " [" + actor.getObjectId() + "]", process + "(id: " + itemId + " count: " + count + " name: " + item.getItemName() + " objId: " + item.getObjectId() + ")", targetName, "L2Object referencing this action is: " + referenceName);
+				}
 			}
 		}
 		
@@ -355,7 +370,7 @@ public class ItemTable
 	}
 	
 	/**
-	 * Returns a dummy (fr = factice) item.<BR><BR>
+	 * Returns a dummy item.<br>
 	 * <U><I>Concept :</I></U><BR>
 	 * Dummy item is created by setting the ID of the object in the world at null value
 	 * @param itemId : int designating the item
@@ -365,18 +380,21 @@ public class ItemTable
 	{
 		L2Item item = getTemplate(itemId);
 		if (item == null)
+		{
 			return null;
+		}
 		L2ItemInstance temp = new L2ItemInstance(0, item);
 		return temp;
 	}
 	
 	/**
-	 * Destroys the L2ItemInstance.<BR><BR>
-	 *
-	 * <B><U> Actions</U> :</B><BR><BR>
-	 * <li>Sets L2ItemInstance parameters to be unusable </li>
-	 * <li>Removes the L2ItemInstance object to _allObjects of L2world </li>
-	 * <li>Logs Item deletion according to log settings</li><BR><BR>
+	 * Destroys the L2ItemInstance.<br>
+	 * <B><U> Actions</U> :</B>
+	 * <ul>
+	 * <li>Sets L2ItemInstance parameters to be unusable</li>
+	 * <li>Removes the L2ItemInstance object to _allObjects of L2world</li>
+	 * <li>Logs Item deletion according to log settings</li>
+	 * </ul>
 	 * @param process a string identifier of process triggering this action.
 	 * @param item the item instance to be destroyed.
 	 * @param actor the player requesting the item destroy.
@@ -397,11 +415,17 @@ public class ItemTable
 			
 			if (Config.LOG_ITEMS)
 			{
-				if (!Config.LOG_ITEMS_SMALL_LOG || (Config.LOG_ITEMS_SMALL_LOG && (item.isEquipable() || item.getItemId() == ADENA_ID)))
+				if (!Config.LOG_ITEMS_SMALL_LOG || (Config.LOG_ITEMS_SMALL_LOG && (item.isEquipable() || (item.getItemId() == ADENA_ID))))
 				{
 					LogRecord record = new LogRecord(Level.INFO, "DELETE:" + process);
 					record.setLoggerName("item");
-					record.setParameters(new Object[] { item, "PrevCount("+old+")", actor, reference });
+					record.setParameters(new Object[]
+					{
+						item,
+						"PrevCount(" + old + ")",
+						actor,
+						reference
+					});
 					_logItems.log(record);
 				}
 			}
@@ -413,15 +437,17 @@ public class ItemTable
 					String referenceName = "no-reference";
 					if (reference instanceof L2Object)
 					{
-						referenceName = (((L2Object)reference).getName() != null?((L2Object)reference).getName():"no-name");
+						referenceName = (((L2Object) reference).getName() != null ? ((L2Object) reference).getName() : "no-name");
 					}
 					else if (reference instanceof String)
-						referenceName = (String)reference;
+					{
+						referenceName = (String) reference;
+					}
 					String targetName = (actor.getTarget() != null ? actor.getTarget().getName() : "no-target");
 					if (Config.GMAUDIT)
-						GMAudit.auditGMAction(actor.getName()+" ["+actor.getObjectId()+"]", process + "(id: " + item.getItemId() + " count: " + item.getCount()
-								+ " itemObjId: " + item.getObjectId() + ")", targetName, "L2Object referencing this action is: "
-								+ referenceName);
+					{
+						GMAudit.auditGMAction(actor.getName() + " [" + actor.getObjectId() + "]", process + "(id: " + item.getItemId() + " count: " + item.getCount() + " itemObjId: " + item.getObjectId() + ")", targetName, "L2Object referencing this action is: " + referenceName);
+					}
 				}
 			}
 			
@@ -499,7 +525,7 @@ public class ItemTable
 	 */
 	private boolean fireNewItemListeners(String process, int itemId, long count, L2PcInstance actor, Object reference)
 	{
-		if (!newItemListeners.isEmpty() && actor != null)
+		if (!newItemListeners.isEmpty() && (actor != null))
 		{
 			ItemCreateEvent event = new ItemCreateEvent();
 			event.setItemId(itemId);
@@ -512,7 +538,9 @@ public class ItemTable
 				if (listener.containsItemId(itemId))
 				{
 					if (!listener.onCreate(event))
+					{
 						return false;
+					}
 				}
 			}
 		}

+ 8 - 10
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/MerchantPriceConfigTable.java

@@ -36,7 +36,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance;
 import com.l2jserver.gameserver.model.entity.Castle;
 
 /**
- * @author  KenM
+ * @author KenM
  */
 public class MerchantPriceConfigTable implements InstanceListManager
 {
@@ -49,14 +49,14 @@ public class MerchantPriceConfigTable implements InstanceListManager
 	
 	private static final String MPCS_FILE = "MerchantPriceConfig.xml";
 	
-	private Map<Integer, MerchantPriceConfig> _mpcs = new FastMap<>();
+	private final Map<Integer, MerchantPriceConfig> _mpcs = new FastMap<>();
 	private MerchantPriceConfig _defaultMpc;
 	
 	public MerchantPriceConfig getMerchantPriceConfig(L2MerchantInstance npc)
 	{
 		for (MerchantPriceConfig mpc : _mpcs.values())
 		{
-			if (npc.getWorldRegion() != null && npc.getWorldRegion().containsZone(mpc.getZoneId()))
+			if ((npc.getWorldRegion() != null) && npc.getWorldRegion().containsZone(mpc.getZoneId()))
 			{
 				return mpc;
 			}
@@ -91,7 +91,7 @@ public class MerchantPriceConfigTable implements InstanceListManager
 			MerchantPriceConfig mpc;
 			for (n = n.getFirstChild(); n != null; n = n.getNextSibling())
 			{
-				mpc = this.parseMerchantPriceConfig(n);
+				mpc = parseMerchantPriceConfig(n);
 				if (mpc != null)
 				{
 					_mpcs.put(mpc.getId(), mpc);
@@ -184,9 +184,7 @@ public class MerchantPriceConfigTable implements InstanceListManager
 	}
 	
 	/**
-	 * 
-	 *
-	 * @author  KenM
+	 * @author KenM
 	 */
 	public static final class MerchantPriceConfig
 	{
@@ -261,17 +259,17 @@ public class MerchantPriceConfigTable implements InstanceListManager
 		
 		public double getCastleTaxRate()
 		{
-			return this.hasCastle() ? this.getCastle().getTaxRate() : 0.0;
+			return hasCastle() ? getCastle().getTaxRate() : 0.0;
 		}
 		
 		public int getTotalTax()
 		{
-			return this.hasCastle() ? (getCastle().getTaxPercent() + getBaseTax()) : getBaseTax();
+			return hasCastle() ? (getCastle().getTaxPercent() + getBaseTax()) : getBaseTax();
 		}
 		
 		public double getTotalTaxRate()
 		{
-			return this.getTotalTax() / 100.0;
+			return getTotalTax() / 100.0;
 		}
 		
 		public void updateReferences()

+ 71 - 41
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/MultiSell.java

@@ -47,13 +47,13 @@ import com.l2jserver.util.file.filter.XMLFilter;
 public class MultiSell
 {
 	private static final Logger _log = Logger.getLogger(MultiSell.class.getName());
-
+	
 	public static final int PAGE_SIZE = 40;
 	
 	public static final int PC_BANG_POINTS = -100;
 	public static final int CLAN_REPUTATION = -200;
 	public static final int FAME = -300;
-		
+	
 	private final Map<Integer, ListContainer> _entries = new HashMap<>();
 	
 	protected MultiSell()
@@ -68,32 +68,33 @@ public class MultiSell
 	}
 	
 	/**
-	 * This will generate the multisell list for the items.  There exist various
-	 * parameters in multisells that affect the way they will appear:
-	 * 1) inventory only:
-	 * 		* if true, only show items of the multisell for which the
-	 * 		  "primary" ingredients are already in the player's inventory.  By "primary"
-	 * 		  ingredients we mean weapon and armor.
-	 * 		* if false, show the entire list.
-	 * 2) maintain enchantment: presumably, only lists with "inventory only" set to true
-	 * 		should sometimes have this as true.  This makes no sense otherwise...
-	 * 		* If true, then the product will match the enchantment level of the ingredient.
-	 * 		  if the player has multiple items that match the ingredient list but the enchantment
-	 * 		  levels differ, then the entries need to be duplicated to show the products and
-	 * 		  ingredients for each enchantment level.
-	 * 		  For example: If the player has a crystal staff +1 and a crystal staff +3 and goes
-	 * 		  to exchange it at the mammon, the list should have all exchange possibilities for
-	 * 		  the +1 staff, followed by all possibilities for the +3 staff.
-	 * 		* If false, then any level ingredient will be considered equal and product will always
-	 * 		  be at +0
-	 * 3) apply taxes: Uses the "taxIngredient" entry in order to add a certain amount of adena to the ingredients
-	 * 4) additional product and ingredient multipliers
-	 * @param listId 
-	 * @param player 
-	 * @param npc 
-	 * @param inventoryOnly 
-	 * @param productMultiplier 
-	 * @param ingredientMultiplier 
+	 * This will generate the multisell list for the items.<br>
+	 * There exist various parameters in multisells that affect the way they will appear:
+	 * <ol>
+	 * <li>Inventory only:
+	 * <ul>
+	 * <li>If true, only show items of the multisell for which the "primary" ingredients are already in the player's inventory. By "primary" ingredients we mean weapon and armor.</li>
+	 * <li>If false, show the entire list.</li>
+	 * </ul>
+	 * </li>
+	 * <li>Maintain enchantment: presumably, only lists with "inventory only" set to true should sometimes have this as true. This makes no sense otherwise...
+	 * <ul>
+	 * <li>If true, then the product will match the enchantment level of the ingredient.<br>
+	 * If the player has multiple items that match the ingredient list but the enchantment levels differ, then the entries need to be duplicated to show the products and ingredients for each enchantment level.<br>
+	 * For example: If the player has a crystal staff +1 and a crystal staff +3 and goes to exchange it at the mammon, the list should have all exchange possibilities for the +1 staff, followed by all possibilities for the +3 staff.</li>
+	 * <li>If false, then any level ingredient will be considered equal and product will always be at +0</li>
+	 * </ul>
+	 * </li>
+	 * <li>Apply taxes: Uses the "taxIngredient" entry in order to add a certain amount of adena to the ingredients.
+	 * <li>
+	 * <li>Additional product and ingredient multipliers.</li>
+	 * </ol>
+	 * @param listId
+	 * @param player
+	 * @param npc
+	 * @param inventoryOnly
+	 * @param productMultiplier
+	 * @param ingredientMultiplier
 	 */
 	public final void separateAndSend(int listId, L2PcInstance player, L2Npc npc, boolean inventoryOnly, double productMultiplier, double ingredientMultiplier)
 	{
@@ -107,18 +108,18 @@ public class MultiSell
 		final PreparedListContainer list = new PreparedListContainer(template, inventoryOnly, player, npc);
 		
 		// Pass through this only when multipliers are different from 1
-		if (productMultiplier != 1 || ingredientMultiplier != 1)
+		if ((productMultiplier != 1) || (ingredientMultiplier != 1))
 		{
-			for(Entry entry : list.getEntries())
+			for (Entry entry : list.getEntries())
 			{
-				for(Ingredient product : entry.getProducts())
+				for (Ingredient product : entry.getProducts())
 				{
-					//Math.max used here to avoid dropping count to 0
-					product.setItemCount((long) Math.max(product.getItemCount() * productMultiplier,1));
+					// Math.max used here to avoid dropping count to 0
+					product.setItemCount((long) Math.max(product.getItemCount() * productMultiplier, 1));
 				}
-				for(Ingredient ingredient : entry.getIngredients())
+				for (Ingredient ingredient : entry.getIngredients())
 				{
-					//Math.max used here to avoid dropping count to 0
+					// Math.max used here to avoid dropping count to 0
 					ingredient.setItemCount((long) Math.max(ingredient.getItemCount() * ingredientMultiplier, 1));
 				}
 			}
@@ -134,9 +135,10 @@ public class MultiSell
 		
 		player.setMultiSell(list);
 	}
+	
 	public final void separateAndSend(int listId, L2PcInstance player, L2Npc npc, boolean inventoryOnly)
 	{
-		separateAndSend(listId,  player, npc, inventoryOnly, 1, 1);
+		separateAndSend(listId, player, npc, inventoryOnly, 1, 1);
 	}
 	
 	public static final boolean checkSpecialIngredient(int id, long amount, L2PcInstance player)
@@ -212,7 +214,9 @@ public class MultiSell
 		List<File> files = new FastList<>();
 		hashFiles("data/multisell", files);
 		if (Config.CUSTOM_MULTISELL_LOAD)
+		{
 			hashFiles("data/multisell/custom", files);
+		}
 		
 		for (File f : files)
 		{
@@ -257,9 +261,13 @@ public class MultiSell
 			{
 				attribute = n.getAttributes().getNamedItem("applyTaxes");
 				if (attribute == null)
+				{
 					list.setApplyTaxes(false);
+				}
 				else
+				{
 					list.setApplyTaxes(Boolean.parseBoolean(attribute.getNodeValue()));
+				}
 				
 				attribute = n.getAttributes().getNamedItem("useRate");
 				if (attribute != null)
@@ -268,12 +276,14 @@ public class MultiSell
 					{
 						
 						list.setUseRate(Double.valueOf(attribute.getNodeValue()));
-						if(list.getUseRate() <= 1e-6)
-							throw new NumberFormatException("The value cannot be 0"); //threat 0 as invalid value
+						if (list.getUseRate() <= 1e-6)
+						{
+							throw new NumberFormatException("The value cannot be 0"); // threat 0 as invalid value
+						}
 					}
 					catch (NumberFormatException e)
 					{
-
+						
 						try
 						{
 							list.setUseRate(Config.class.getField(attribute.getNodeValue()).getDouble(Config.class));
@@ -283,9 +293,9 @@ public class MultiSell
 							_log.warning(e.getMessage() + doc.getLocalName());
 							list.setUseRate(1.0);
 						}
-
+						
 					}
-					catch (DOMException e) 
+					catch (DOMException e)
 					{
 						_log.warning(e.getMessage() + doc.getLocalName());
 					}
@@ -293,9 +303,13 @@ public class MultiSell
 				
 				attribute = n.getAttributes().getNamedItem("maintainEnchantment");
 				if (attribute == null)
+				{
 					list.setMaintainEnchantment(false);
+				}
 				else
+				{
 					list.setMaintainEnchantment(Boolean.parseBoolean(attribute.getNodeValue()));
+				}
 				
 				for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
 				{
@@ -332,15 +346,23 @@ public class MultiSell
 				
 				attribute = n.getAttributes().getNamedItem("isTaxIngredient");
 				if (attribute != null)
+				{
 					isTaxIngredient = Boolean.parseBoolean(attribute.getNodeValue());
+				}
 				else
+				{
 					isTaxIngredient = false;
+				}
 				
 				attribute = n.getAttributes().getNamedItem("maintainIngredient");
 				if (attribute != null)
+				{
 					mantainIngredient = Boolean.parseBoolean(attribute.getNodeValue());
+				}
 				else
+				{
 					mantainIngredient = false;
+				}
 				
 				entry.addIngredient(new Ingredient(id, count, isTaxIngredient, mantainIngredient));
 			}
@@ -367,7 +389,9 @@ public class MultiSell
 		
 		File[] files = dir.listFiles(new XMLFilter());
 		for (File f : files)
+		{
 			hash.add(f);
+		}
 	}
 	
 	private final void verify()
@@ -383,12 +407,16 @@ public class MultiSell
 				for (Ingredient ing : ent.getIngredients())
 				{
 					if (!verifyIngredient(ing))
+					{
 						_log.warning(getClass().getSimpleName() + ": can't find ingredient with itemId: " + ing.getItemId() + " in list: " + list.getListId());
+					}
 				}
 				for (Ingredient ing : ent.getProducts())
 				{
 					if (!verifyIngredient(ing))
+					{
 						_log.warning(getClass().getSimpleName() + ": can't find product with itemId: " + ing.getItemId() + " in list: " + list.getListId());
+					}
 				}
 			}
 		}
@@ -403,7 +431,9 @@ public class MultiSell
 				return true;
 			default:
 				if (ing.getTemplate() != null)
+				{
 					return true;
+				}
 		}
 		
 		return false;

+ 2 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/NpcBufferTable.java

@@ -14,8 +14,6 @@
  */
 package com.l2jserver.gameserver.datatables;
 
-import gnu.trove.map.hash.TIntIntHashMap;
-
 import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -28,6 +26,8 @@ import java.util.logging.Logger;
 import com.l2jserver.Config;
 import com.l2jserver.L2DatabaseFactory;
 
+import gnu.trove.map.hash.TIntIntHashMap;
+
 public class NpcBufferTable
 {
 	private static Logger _log = Logger.getLogger(NpcBufferTable.class.getName());

+ 25 - 9
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/OfflineTradersTable.java

@@ -37,7 +37,7 @@ public class OfflineTradersTable
 {
 	private static Logger _log = Logger.getLogger(OfflineTradersTable.class.getName());
 	
-	//SQL DEFINITIONS
+	// SQL DEFINITIONS
 	private static final String SAVE_OFFLINE_STATUS = "INSERT INTO character_offline_trade (`charId`,`time`,`type`,`title`) VALUES (?,?,?,?)";
 	private static final String SAVE_ITEMS = "INSERT INTO character_offline_trade_items (`charId`,`item`,`count`,`price`) VALUES (?,?,?,?)";
 	private static final String CLEAR_OFFLINE_TABLE = "DELETE FROM character_offline_trade";
@@ -57,23 +57,25 @@ public class OfflineTradersTable
 			stm2.execute();
 			con.setAutoCommit(false); // avoid halfway done
 			
-			//TextBuilder items = TextBuilder.newInstance();
+			// TextBuilder items = TextBuilder.newInstance();
 			for (L2PcInstance pc : L2World.getInstance().getAllPlayersArray())
 			{
 				try
 				{
-					if ((pc.getPrivateStoreType() != L2PcInstance.STORE_PRIVATE_NONE) && (pc.getClient() == null || pc.getClient().isDetached()))
+					if ((pc.getPrivateStoreType() != L2PcInstance.STORE_PRIVATE_NONE) && ((pc.getClient() == null) || pc.getClient().isDetached()))
 					{
-						stm3.setInt(1, pc.getObjectId()); //Char Id
+						stm3.setInt(1, pc.getObjectId()); // Char Id
 						stm3.setLong(2, pc.getOfflineStartTime());
-						stm3.setInt(3, pc.getPrivateStoreType()); //store type
+						stm3.setInt(3, pc.getPrivateStoreType()); // store type
 						String title = null;
 						
 						switch (pc.getPrivateStoreType())
 						{
 							case L2PcInstance.STORE_PRIVATE_BUY:
 								if (!Config.OFFLINE_TRADE_ENABLE)
+								{
 									continue;
+								}
 								title = pc.getBuyList().getTitle();
 								for (TradeItem i : pc.getBuyList().getItems())
 								{
@@ -88,7 +90,9 @@ public class OfflineTradersTable
 							case L2PcInstance.STORE_PRIVATE_SELL:
 							case L2PcInstance.STORE_PRIVATE_PACKAGE_SELL:
 								if (!Config.OFFLINE_TRADE_ENABLE)
+								{
 									continue;
+								}
 								title = pc.getSellList().getTitle();
 								for (TradeItem i : pc.getSellList().getItems())
 								{
@@ -102,7 +106,9 @@ public class OfflineTradersTable
 								break;
 							case L2PcInstance.STORE_PRIVATE_MANUFACTURE:
 								if (!Config.OFFLINE_CRAFT_ENABLE)
+								{
 									continue;
+								}
 								title = pc.getCreateList().getStoreName();
 								for (L2ManufactureItem i : pc.getCreateList().getList())
 								{
@@ -129,7 +135,7 @@ public class OfflineTradersTable
 		}
 		catch (Exception e)
 		{
-			_log.log(Level.WARNING, getClass().getSimpleName() + ": Error while saving offline traders: " + e,e);
+			_log.log(Level.WARNING, getClass().getSimpleName() + ": Error while saving offline traders: " + e, e);
 		}
 	}
 	
@@ -150,12 +156,16 @@ public class OfflineTradersTable
 					cal.setTimeInMillis(time);
 					cal.add(Calendar.DAY_OF_YEAR, Config.OFFLINE_MAX_DAYS);
 					if (cal.getTimeInMillis() <= System.currentTimeMillis())
+					{
 						continue;
+					}
 				}
 				
 				int type = rs.getInt("type");
 				if (type == L2PcInstance.STORE_PRIVATE_NONE)
+				{
 					continue;
+				}
 				
 				L2PcInstance player = null;
 				
@@ -183,7 +193,9 @@ public class OfflineTradersTable
 									while (items.next())
 									{
 										if (player.getBuyList().addItemByItemId(items.getInt(2), items.getLong(3), items.getLong(4)) == null)
+										{
 											throw new NullPointerException();
+										}
 									}
 									player.getBuyList().setTitle(rs.getString("title"));
 									break;
@@ -192,7 +204,9 @@ public class OfflineTradersTable
 									while (items.next())
 									{
 										if (player.getSellList().addItem(items.getInt(2), items.getLong(3), items.getLong(4)) == null)
+										{
 											throw new NullPointerException();
+										}
 									}
 									player.getSellList().setTitle(rs.getString("title"));
 									player.getSellList().setPackaged(type == L2PcInstance.STORE_PRIVATE_PACKAGE_SELL);
@@ -211,7 +225,9 @@ public class OfflineTradersTable
 					}
 					player.sitDown();
 					if (Config.OFFLINE_SET_NAME_COLOR)
+					{
 						player.getAppearance().setNameColor(Config.OFFLINE_NAME_COLOR);
+					}
 					player.setPrivateStoreType(type);
 					player.setOnlineStatus(true, true);
 					player.restoreEffects();
@@ -220,7 +236,7 @@ public class OfflineTradersTable
 				}
 				catch (Exception e)
 				{
-					_log.log(Level.WARNING, getClass().getSimpleName() + ": Error loading trader: "+player,e);
+					_log.log(Level.WARNING, getClass().getSimpleName() + ": Error loading trader: " + player, e);
 					if (player != null)
 					{
 						player.deleteMe();
@@ -228,7 +244,7 @@ public class OfflineTradersTable
 				}
 			}
 			
-			_log.info(getClass().getSimpleName() + ": Loaded: " +nTraders+ " offline trader(s)");
+			_log.info(getClass().getSimpleName() + ": Loaded: " + nTraders + " offline trader(s)");
 			
 			try (Statement stm1 = con.createStatement())
 			{
@@ -238,7 +254,7 @@ public class OfflineTradersTable
 		}
 		catch (Exception e)
 		{
-			_log.log(Level.WARNING, getClass().getSimpleName() + ": Error while loading offline traders: ",e);
+			_log.log(Level.WARNING, getClass().getSimpleName() + ": Error while loading offline traders: ", e);
 		}
 	}
 	

+ 4 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/PetNameTable.java

@@ -47,7 +47,9 @@ public class PetNameTable
 			for (int it : PetDataTable.getPetItemsByNpc(petNpcId))
 			{
 				if (!cond.toString().isEmpty())
+				{
 					cond.append(", ");
+				}
 				cond.append(it);
 			}
 			ps.setString(2, cond.toString());
@@ -68,7 +70,9 @@ public class PetNameTable
 		boolean result = true;
 		
 		if (!isAlphaNumeric(name))
+		{
 			return result;
+		}
 		
 		Pattern pattern;
 		try

+ 21 - 18
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/SkillTable.java

@@ -14,9 +14,6 @@
  */
 package com.l2jserver.gameserver.datatables;
 
-import gnu.trove.list.array.TIntArrayList;
-import gnu.trove.map.hash.TIntIntHashMap;
-
 import java.util.HashMap;
 import java.util.Map;
 import java.util.logging.Level;
@@ -27,6 +24,9 @@ import com.l2jserver.gameserver.engines.DocumentEngine;
 import com.l2jserver.gameserver.model.holders.SkillHolder;
 import com.l2jserver.gameserver.model.skills.L2Skill;
 
+import gnu.trove.list.array.TIntArrayList;
+import gnu.trove.map.hash.TIntIntHashMap;
+
 /**
  * 
  */
@@ -46,7 +46,7 @@ public class SkillTable
 	public void reload()
 	{
 		load();
-		//Reload Skill Tree as well.
+		// Reload Skill Tree as well.
 		SkillTreesData.getInstance().load();
 	}
 	
@@ -63,14 +63,18 @@ public class SkillTable
 			if (skillLvl > 99)
 			{
 				if (!_enchantable.contains(skillId))
+				{
 					_enchantable.add(skillId);
+				}
 				continue;
 			}
 			
 			// only non-enchanted skills
 			final int maxLvl = _skillMaxLevel.get(skillId);
 			if (skillLvl > maxLvl)
+			{
 				_skillMaxLevel.put(skillId, skillLvl);
+			}
 		}
 		
 		// Sorting for binarySearch
@@ -79,9 +83,7 @@ public class SkillTable
 	
 	/**
 	 * Provides the skill hash
-	 * 
-	 * @param skill
-	 *            The L2Skill to be hashed
+	 * @param skill The L2Skill to be hashed
 	 * @return getSkillHashCode(skill.getId(), skill.getLevel())
 	 */
 	public static int getSkillHashCode(L2Skill skill)
@@ -91,28 +93,27 @@ public class SkillTable
 	
 	/**
 	 * Centralized method for easier change of the hashing sys
-	 * 
-	 * @param skillId
-	 *            The Skill Id
-	 * @param skillLevel
-	 *            The Skill Level
+	 * @param skillId The Skill Id
+	 * @param skillLevel The Skill Level
 	 * @return The Skill hash number
 	 */
 	public static int getSkillHashCode(int skillId, int skillLevel)
 	{
-		return skillId * 1021 + skillLevel;
+		return (skillId * 1021) + skillLevel;
 	}
 	
 	public final L2Skill getInfo(final int skillId, final int level)
 	{
 		final L2Skill result = _skills.get(getSkillHashCode(skillId, level));
 		if (result != null)
+		{
 			return result;
+		}
 		
 		// skill/level not found, fix for transformation scripts
 		final int maxLvl = _skillMaxLevel.get(skillId);
 		// requested level too high
-		if (maxLvl > 0 && level > maxLvl)
+		if ((maxLvl > 0) && (level > maxLvl))
 		{
 			if (Config.DEBUG)
 			{
@@ -136,8 +137,8 @@ public class SkillTable
 	}
 	
 	/**
-	 * @param addNoble 
-	 * @param hasCastle 
+	 * @param addNoble
+	 * @param hasCastle
 	 * @return an array with siege skills. If addNoble == true, will add also Advanced headquarters.
 	 */
 	public L2Skill[] getSiegeSkills(boolean addNoble, boolean hasCastle)
@@ -148,7 +149,9 @@ public class SkillTable
 		temp[i++] = _skills.get(SkillTable.getSkillHashCode(247, 1));
 		
 		if (addNoble)
+		{
 			temp[i++] = _skills.get(SkillTable.getSkillHashCode(326, 1));
+		}
 		if (hasCastle)
 		{
 			temp[i++] = _skills.get(SkillTable.getSkillHashCode(844, 1));
@@ -159,7 +162,6 @@ public class SkillTable
 	
 	/**
 	 * Enum to hold some important references to frequently used (hardcoded) skills in core
-	 * 
 	 * @author DrHouse
 	 */
 	public static enum FrequentSkill
@@ -180,7 +182,8 @@ public class SkillTable
 		THE_VICTOR_OF_WAR(5074, 1),
 		THE_VANQUISHED_OF_WAR(5075, 1),
 		SPECIAL_TREE_RECOVERY_BONUS(2139, 1),
-		WEAPON_GRADE_PENALTY(6209, 1);
+		WEAPON_GRADE_PENALTY(6209, 1),
+		ARMOR_GRADE_PENALTY(6213, 1);
 		
 		private final SkillHolder _holder;
 		

+ 2 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/SkillTreesData.java

@@ -14,8 +14,6 @@
  */
 package com.l2jserver.gameserver.datatables;
 
-import gnu.trove.map.hash.TIntObjectHashMap;
-
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -45,6 +43,8 @@ import com.l2jserver.gameserver.model.holders.ItemHolder;
 import com.l2jserver.gameserver.model.holders.SkillHolder;
 import com.l2jserver.gameserver.model.skills.L2Skill;
 
+import gnu.trove.map.hash.TIntObjectHashMap;
+
 /**
  * This class loads and manage the characters and pledges skills trees.<br>
  * Here can be found the following skill trees:<br>

+ 27 - 8
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/SpawnTable.java

@@ -32,7 +32,6 @@ import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
 
 /**
  * This class ...
- *
  * @author Nightmare
  * @version $Revision: 1.5.2.6.2.7 $ $Date: 2005/03/27 15:29:18 $
  */
@@ -40,7 +39,7 @@ public class SpawnTable
 {
 	private static Logger _log = Logger.getLogger(SpawnTable.class.getName());
 	
-	private FastSet<L2Spawn> _spawntable = new FastSet<>();
+	private final FastSet<L2Spawn> _spawntable = new FastSet<>();
 	private int _npcSpawnCount;
 	private int _customSpawnCount;
 	
@@ -48,7 +47,9 @@ public class SpawnTable
 	{
 		_spawntable.shared();
 		if (!Config.ALT_DEV_NO_SPAWNS)
+		{
 			fillSpawnTable();
+		}
 	}
 	
 	public FastSet<L2Spawn> getSpawnTable()
@@ -205,7 +206,9 @@ public class SpawnTable
 		}
 		
 		if (Config.DEBUG)
+		{
 			_log.fine(getClass().getSimpleName() + ": Spawning completed, total number of NPCs in the world: " + (_npcSpawnCount + _customSpawnCount));
+		}
 		
 	}
 	
@@ -217,9 +220,13 @@ public class SpawnTable
 		{
 			String spawnTable;
 			if (spawn.isCustom() && Config.CUSTOM_SPAWNLIST_TABLE)
+			{
 				spawnTable = "custom_spawnlist";
+			}
 			else
+			{
 				spawnTable = "spawnlist";
+			}
 			
 			try (Connection con = L2DatabaseFactory.getInstance().getConnection();
 				PreparedStatement statement = con.prepareStatement("INSERT INTO " + spawnTable + "(count,npc_templateid,locx,locy,locz,heading,respawn_delay,loc_id) values(?,?,?,?,?,?,?,?)"))
@@ -245,7 +252,9 @@ public class SpawnTable
 	public void deleteSpawn(L2Spawn spawn, boolean updateDb)
 	{
 		if (!_spawntable.remove(spawn))
+		{
 			return;
+		}
 		
 		if (updateDb)
 		{
@@ -267,14 +276,14 @@ public class SpawnTable
 		}
 	}
 	
-	//just wrapper
+	// just wrapper
 	public void reloadAll()
 	{
 		fillSpawnTable();
 	}
 	
 	/**
-	 * Get all the spawn of a NPC<BR><BR>
+	 * Get all the spawn of a NPC.
 	 * @param activeChar
 	 * @param npcId
 	 * @param teleportIndex
@@ -294,24 +303,34 @@ public class SpawnTable
 				{
 					if (teleportIndex == index)
 					{
-						if(showposition && _npc != null)
+						if (showposition && (_npc != null))
+						{
 							activeChar.teleToLocation(_npc.getX(), _npc.getY(), _npc.getZ(), true);
+						}
 						else
+						{
 							activeChar.teleToLocation(spawn.getLocx(), spawn.getLocy(), spawn.getLocz(), true);
+						}
 					}
 				}
 				else
 				{
-					if(showposition && _npc != null)
-						activeChar.sendMessage(index + " - " + spawn.getTemplate().getName() + " (" + spawn + "): " + _npc.getX() + " "+ _npc.getY() + " " + _npc.getZ());
+					if (showposition && (_npc != null))
+					{
+						activeChar.sendMessage(index + " - " + spawn.getTemplate().getName() + " (" + spawn + "): " + _npc.getX() + " " + _npc.getY() + " " + _npc.getZ());
+					}
 					else
-						activeChar.sendMessage(index + " - " + spawn.getTemplate().getName() + " (" + spawn + "): " + spawn.getLocx() + " "+ spawn.getLocy() + " " + spawn.getLocz());
+					{
+						activeChar.sendMessage(index + " - " + spawn.getTemplate().getName() + " (" + spawn + "): " + spawn.getLocx() + " " + spawn.getLocy() + " " + spawn.getLocz());
+					}
 				}
 			}
 		}
 		
 		if (index == 0)
+		{
 			activeChar.sendMessage(getClass().getSimpleName() + ": No current spawns found.");
+		}
 	}
 	
 	public static SpawnTable getInstance()

+ 8 - 10
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/SummonEffectsTable.java

@@ -14,26 +14,24 @@
  */
 package com.l2jserver.gameserver.datatables;
 
-import gnu.trove.map.hash.TIntObjectHashMap;
-
 import java.util.List;
 
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.skills.L2Skill;
 
+import gnu.trove.map.hash.TIntObjectHashMap;
+
 /**
  * @author Nyaran
  */
 public class SummonEffectsTable
 {
 	/** Servitors **/
-	/*
-	 * Map tree
-	 * key: charObjectId, value: classIndex Map
-	 * 		key: classIndex, value: servitors Map
-	 * 			key: servitorSkillId, value: Effects list
-	 */
-	private TIntObjectHashMap<TIntObjectHashMap<TIntObjectHashMap<List<SummonEffect>>>> _servitorEffects = new TIntObjectHashMap<>();
+	// Map tree
+	// -> key: charObjectId, value: classIndex Map
+	// --> key: classIndex, value: servitors Map
+	// ---> key: servitorSkillId, value: Effects list
+	private final TIntObjectHashMap<TIntObjectHashMap<TIntObjectHashMap<List<SummonEffect>>>> _servitorEffects = new TIntObjectHashMap<>();
 	
 	public TIntObjectHashMap<TIntObjectHashMap<TIntObjectHashMap<List<SummonEffect>>>> getServitorEffectsOwner()
 	{
@@ -51,7 +49,7 @@ public class SummonEffectsTable
 	}
 	
 	/** Pets **/
-	private TIntObjectHashMap<List<SummonEffect>> _petEffects = new TIntObjectHashMap<>(); // key: petItemObjectId, value: Effects list
+	private final TIntObjectHashMap<List<SummonEffect>> _petEffects = new TIntObjectHashMap<>(); // key: petItemObjectId, value: Effects list
 	
 	public TIntObjectHashMap<List<SummonEffect>> getPetEffects()
 	{

+ 13 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/SummonSkillsTable.java

@@ -31,7 +31,7 @@ import com.l2jserver.gameserver.model.actor.L2Summon;
 public class SummonSkillsTable
 {
 	private static Logger _log = Logger.getLogger(SummonSkillsTable.class.getName());
-	private Map<Integer, Map<Integer, L2PetSkillLearn>> _skillTrees = new HashMap<>();
+	private final Map<Integer, Map<Integer, L2PetSkillLearn>> _skillTrees = new HashMap<>();
 	
 	protected SummonSkillsTable()
 	{
@@ -97,28 +97,38 @@ public class SummonSkillsTable
 		for (L2PetSkillLearn temp : skills)
 		{
 			if (temp.getId() != skillId)
+			{
 				continue;
+			}
 			if (temp.getLevel() == 0)
 			{
 				if (cha.getLevel() < 70)
 				{
 					lvl = (cha.getLevel() / 10);
 					if (lvl <= 0)
+					{
 						lvl = 1;
+					}
 				}
 				else
+				{
 					lvl = (7 + ((cha.getLevel() - 70) / 5));
+				}
 				
 				// formula usable for skill that have 10 or more skill levels
 				int maxLvl = SkillTable.getInstance().getMaxLevel(temp.getId());
 				if (lvl > maxLvl)
+				{
 					lvl = maxLvl;
+				}
 				break;
 			}
 			else if (temp.getMinLevel() <= cha.getLevel())
 			{
 				if (temp.getLevel() > lvl)
+				{
 					lvl = temp.getLevel();
+				}
 			}
 		}
 		return lvl;
@@ -136,7 +146,9 @@ public class SummonSkillsTable
 		for (L2PetSkillLearn temp : skills)
 		{
 			if (skillIds.contains(temp.getId()))
+			{
 				continue;
+			}
 			skillIds.add(temp.getId());
 		}
 		return skillIds;

+ 1 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/TeleportLocationTable.java

@@ -28,14 +28,13 @@ import com.l2jserver.gameserver.model.L2TeleportLocation;
 
 /**
  * This class ...
- *
  * @version $Revision: 1.3.2.2.2.3 $ $Date: 2005/03/27 15:29:18 $
  */
 public class TeleportLocationTable
 {
 	private static Logger _log = Logger.getLogger(TeleportLocationTable.class.getName());
 	
-	private Map<Integer, L2TeleportLocation> _teleports = new HashMap<>();
+	private final Map<Integer, L2TeleportLocation> _teleports = new HashMap<>();
 	
 	protected TeleportLocationTable()
 	{

+ 9 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/TerritoryTable.java

@@ -64,7 +64,15 @@ public class TerritoryTable
 	public void load()
 	{
 		_territory.clear();
-		Integer[][] point = SqlUtils.get2DIntArray(new String[] { "loc_id", "loc_x", "loc_y", "loc_zmin", "loc_zmax", "proc" }, "locations", "loc_id > 0");
+		Integer[][] point = SqlUtils.get2DIntArray(new String[]
+		{
+			"loc_id",
+			"loc_x",
+			"loc_y",
+			"loc_zmin",
+			"loc_zmax",
+			"proc"
+		}, "locations", "loc_id > 0");
 		for (Integer[] row : point)
 		{
 			Integer terr = row[0];

+ 11 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/UITable.java

@@ -31,14 +31,14 @@ import com.l2jserver.Config;
 import com.l2jserver.gameserver.model.entity.ActionKey;
 
 /**
- * @author  mrTJO
+ * @author mrTJO
  */
 public class UITable
 {
 	private static final Logger _log = Logger.getLogger(UITable.class.getName());
 	
-	private Map<Integer, List<ActionKey>> _storedKeys = new HashMap<>();
-	private Map<Integer, List<Integer>> _storedCategories = new HashMap<>();
+	private final Map<Integer, List<ActionKey>> _storedKeys = new HashMap<>();
+	private final Map<Integer, List<Integer>> _storedCategories = new HashMap<>();
 	
 	protected UITable()
 	{
@@ -59,7 +59,9 @@ public class UITable
 			while ((line = lnr.readLine()) != null)
 			{
 				if (line.trim().isEmpty() || (line.charAt(0) == '#'))
+				{
 					continue;
+				}
 				
 				StringTokenizer st = new StringTokenizer(line, ";");
 				
@@ -90,7 +92,9 @@ public class UITable
 			while ((line = lnr.readLine()) != null)
 			{
 				if (line.trim().isEmpty() || (line.charAt(0) == '#'))
+				{
 					continue;
+				}
 				
 				StringTokenizer st = new StringTokenizer(line, ";");
 				
@@ -117,7 +121,9 @@ public class UITable
 	private void insertCategory(int cat, int cmd)
 	{
 		if (_storedCategories.containsKey(cat))
+		{
 			_storedCategories.get(cat).add(cmd);
+		}
 		else
 		{
 			List<Integer> tmp = new ArrayList<>();
@@ -130,7 +136,9 @@ public class UITable
 	{
 		ActionKey tmk = new ActionKey(cat, cmdId, key, tgKey1, tgKey2, show);
 		if (_storedKeys.containsKey(cat))
+		{
 			_storedKeys.get(cat).add(tmk);
+		}
 		else
 		{
 			List<ActionKey> tmp = new ArrayList<>();

+ 245 - 60
L2J_Server_BETA/java/com/l2jserver/gameserver/engines/DocumentBase.java

@@ -187,37 +187,70 @@ public abstract class DocumentBase
 	{
 		Condition condition = null;
 		n = n.getFirstChild();
-		if (n == null) return;
+		if (n == null)
+		{
+			return;
+		}
 		if ("cond".equalsIgnoreCase(n.getNodeName()))
 		{
 			condition = parseCondition(n.getFirstChild(), template);
 			Node msg = n.getAttributes().getNamedItem("msg");
 			Node msgId = n.getAttributes().getNamedItem("msgId");
-			if (condition != null && msg != null)
+			if ((condition != null) && (msg != null))
+			{
 				condition.setMessage(msg.getNodeValue());
-			else if (condition != null && msgId != null)
+			}
+			else if ((condition != null) && (msgId != null))
 			{
 				condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
 				Node addName = n.getAttributes().getNamedItem("addName");
-				if (addName != null && Integer.decode(getValue(msgId.getNodeValue(), null)) > 0)
+				if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
+				{
 					condition.addName();
+				}
 			}
 			n = n.getNextSibling();
 		}
 		for (; n != null; n = n.getNextSibling())
 		{
-			if ("add".equalsIgnoreCase(n.getNodeName())) attachFunc(n, template, "Add", condition);
-			else if ("sub".equalsIgnoreCase(n.getNodeName())) attachFunc(n, template, "Sub", condition);
-			else if ("mul".equalsIgnoreCase(n.getNodeName())) attachFunc(n, template, "Mul", condition);
-			else if ("basemul".equalsIgnoreCase(n.getNodeName())) attachFunc(n, template, "BaseMul", condition);
-			else if ("div".equalsIgnoreCase(n.getNodeName())) attachFunc(n, template, "Div", condition);
-			else if ("set".equalsIgnoreCase(n.getNodeName())) attachFunc(n, template, "Set", condition);
-			else if ("enchant".equalsIgnoreCase(n.getNodeName())) attachFunc(n, template, "Enchant", condition);
-			else if ("enchanthp".equalsIgnoreCase(n.getNodeName())) attachFunc(n, template, "EnchantHp", condition);
-			//else if ("skill".equalsIgnoreCase(n.getNodeName())) attachSkill(n, template, condition);
+			if ("add".equalsIgnoreCase(n.getNodeName()))
+			{
+				attachFunc(n, template, "Add", condition);
+			}
+			else if ("sub".equalsIgnoreCase(n.getNodeName()))
+			{
+				attachFunc(n, template, "Sub", condition);
+			}
+			else if ("mul".equalsIgnoreCase(n.getNodeName()))
+			{
+				attachFunc(n, template, "Mul", condition);
+			}
+			else if ("basemul".equalsIgnoreCase(n.getNodeName()))
+			{
+				attachFunc(n, template, "BaseMul", condition);
+			}
+			else if ("div".equalsIgnoreCase(n.getNodeName()))
+			{
+				attachFunc(n, template, "Div", condition);
+			}
+			else if ("set".equalsIgnoreCase(n.getNodeName()))
+			{
+				attachFunc(n, template, "Set", condition);
+			}
+			else if ("enchant".equalsIgnoreCase(n.getNodeName()))
+			{
+				attachFunc(n, template, "Enchant", condition);
+			}
+			else if ("enchanthp".equalsIgnoreCase(n.getNodeName()))
+			{
+				attachFunc(n, template, "EnchantHp", condition);
+			}
 			else if ("effect".equalsIgnoreCase(n.getNodeName()))
 			{
-				if (template instanceof EffectTemplate) throw new RuntimeException("Nested effects");
+				if (template instanceof EffectTemplate)
+				{
+					throw new RuntimeException("Nested effects");
+				}
 				attachEffect(n, template, condition);
 			}
 		}
@@ -231,9 +264,18 @@ public abstract class DocumentBase
 		int ord = Integer.decode(getValue(order, template));
 		Condition applayCond = parseCondition(n.getFirstChild(), template);
 		FuncTemplate ft = new FuncTemplate(attachCond, applayCond, name, stat, ord, lambda);
-		if (template instanceof L2Item) ((L2Item) template).attach(ft);
-		else if (template instanceof L2Skill) ((L2Skill) template).attach(ft);
-		else if (template instanceof EffectTemplate) ((EffectTemplate) template).attach(ft);
+		if (template instanceof L2Item)
+		{
+			((L2Item) template).attach(ft);
+		}
+		else if (template instanceof L2Skill)
+		{
+			((L2Skill) template).attach(ft);
+		}
+		else if (template instanceof EffectTemplate)
+		{
+			((EffectTemplate) template).attach(ft);
+		}
 	}
 	
 	protected void attachLambdaFunc(Node n, Object template, LambdaCalc calc)
@@ -265,19 +307,27 @@ public abstract class DocumentBase
 		
 		if (attrs.getNamedItem("abnormalTime") != null)
 		{
-			abnormalTime = Integer.decode(getValue(attrs.getNamedItem("abnormalTime").getNodeValue(),template));
+			abnormalTime = Integer.decode(getValue(attrs.getNamedItem("abnormalTime").getNodeValue(), template));
 			if (Config.ENABLE_MODIFY_SKILL_DURATION)
 			{
 				if (Config.SKILL_DURATION_LIST.containsKey(((L2Skill) template).getId()))
 				{
 					if (((L2Skill) template).getLevel() < 100)
+					{
 						abnormalTime = Config.SKILL_DURATION_LIST.get(((L2Skill) template).getId());
+					}
 					else if ((((L2Skill) template).getLevel() >= 100) && (((L2Skill) template).getLevel() < 140))
+					{
 						abnormalTime += Config.SKILL_DURATION_LIST.get(((L2Skill) template).getId());
+					}
 					else if (((L2Skill) template).getLevel() > 140)
+					{
 						abnormalTime = Config.SKILL_DURATION_LIST.get(((L2Skill) template).getId());
+					}
 					if (Config.DEBUG)
+					{
 						_log.info("*** Skill " + ((L2Skill) template).getName() + " (" + ((L2Skill) template).getLevel() + ") changed duration to " + abnormalTime + " seconds.");
+					}
 				}
 			}
 		}
@@ -285,14 +335,18 @@ public abstract class DocumentBase
 		boolean self = false;
 		if (attrs.getNamedItem("self") != null)
 		{
-			if (Integer.decode(getValue(attrs.getNamedItem("self").getNodeValue(),template)) == 1)
+			if (Integer.decode(getValue(attrs.getNamedItem("self").getNodeValue(), template)) == 1)
+			{
 				self = true;
+			}
 		}
 		boolean icon = true;
-		if (attrs.getNamedItem("noicon") !=null)
+		if (attrs.getNamedItem("noicon") != null)
 		{
-			if (Integer.decode(getValue(attrs.getNamedItem("noicon").getNodeValue(),template)) == 1)
+			if (Integer.decode(getValue(attrs.getNamedItem("noicon").getNodeValue(), template)) == 1)
+			{
 				icon = false;
+			}
 		}
 		Lambda lambda = getLambda(n, template);
 		Condition applayCond = parseCondition(n.getFirstChild(), template);
@@ -331,7 +385,9 @@ public abstract class DocumentBase
 		
 		double effectPower = -1;
 		if (attrs.getNamedItem("effectPower") != null)
-			effectPower = Double.parseDouble( getValue(attrs.getNamedItem("effectPower").getNodeValue(), template));
+		{
+			effectPower = Double.parseDouble(getValue(attrs.getNamedItem("effectPower").getNodeValue(), template));
+		}
 		
 		L2SkillType type = null;
 		if (attrs.getNamedItem("effectType") != null)
@@ -344,77 +400,135 @@ public abstract class DocumentBase
 			}
 			catch (Exception e)
 			{
-				throw new IllegalArgumentException("Not skilltype found for: "+typeName);
+				throw new IllegalArgumentException("Not skilltype found for: " + typeName);
 			}
 		}
 		
 		final boolean isChanceSkillTrigger = name.equals("ChanceSkillTrigger");
 		int trigId = 0;
 		if (attrs.getNamedItem("triggeredId") != null)
+		{
 			trigId = Integer.parseInt(getValue(attrs.getNamedItem("triggeredId").getNodeValue(), template));
+		}
 		else if (isChanceSkillTrigger)
+		{
 			throw new NoSuchElementException(name + " requires triggerId");
+		}
 		
 		int trigLvl = 1;
 		if (attrs.getNamedItem("triggeredLevel") != null)
+		{
 			trigLvl = Integer.parseInt(getValue(attrs.getNamedItem("triggeredLevel").getNodeValue(), template));
+		}
 		
 		String chanceCond = null;
 		if (attrs.getNamedItem("chanceType") != null)
+		{
 			chanceCond = getValue(attrs.getNamedItem("chanceType").getNodeValue(), template);
+		}
 		else if (isChanceSkillTrigger)
+		{
 			throw new NoSuchElementException(name + " requires chanceType");
+		}
 		
 		int activationChance = -1;
 		if (attrs.getNamedItem("activationChance") != null)
+		{
 			activationChance = Integer.parseInt(getValue(attrs.getNamedItem("activationChance").getNodeValue(), template));
+		}
 		int activationMinDamage = -1;
 		if (attrs.getNamedItem("activationMinDamage") != null)
+		{
 			activationMinDamage = Integer.parseInt(getValue(attrs.getNamedItem("activationMinDamage").getNodeValue(), template));
+		}
 		String activationElements = null;
 		if (attrs.getNamedItem("activationElements") != null)
+		{
 			activationElements = getValue(attrs.getNamedItem("activationElements").getNodeValue(), template);
+		}
 		String activationSkills = null;
 		if (attrs.getNamedItem("activationSkills") != null)
+		{
 			activationSkills = getValue(attrs.getNamedItem("activationSkills").getNodeValue(), template);
+		}
 		boolean pvpOnly = false;
 		if (attrs.getNamedItem("pvpChanceOnly") != null)
+		{
 			pvpOnly = Boolean.parseBoolean(getValue(attrs.getNamedItem("pvpChanceOnly").getNodeValue(), template));
+		}
 		
 		ChanceCondition chance = ChanceCondition.parse(chanceCond, activationChance, activationMinDamage, activationElements, activationSkills, pvpOnly);
 		
-		if (chance == null && isChanceSkillTrigger)
-			throw new NoSuchElementException("Invalid chance condition: " + chanceCond + " "
-					+ activationChance);
+		if ((chance == null) && isChanceSkillTrigger)
+		{
+			throw new NoSuchElementException("Invalid chance condition: " + chanceCond + " " + activationChance);
+		}
 		
 		final EffectTemplate lt = new EffectTemplate(attachCond, applayCond, name, lambda, count, abnormalTime, abnormalVisualEffect, special, event, abnormalType, abnormalLvl, icon, effectPower, type, trigId, trigLvl, chance);
 		parseTemplate(n, lt);
 		if (template instanceof L2Item)
+		{
 			((L2Item) template).attach(lt);
+		}
 		else if (template instanceof L2Skill)
 		{
 			if (self)
+			{
 				((L2Skill) template).attachSelf(lt);
+			}
 			else if (((L2Skill) template).isPassive())
+			{
 				((L2Skill) template).attachPassive(lt);
+			}
 			else
+			{
 				((L2Skill) template).attach(lt);
+			}
 		}
 	}
 	
 	protected Condition parseCondition(Node n, Object template)
 	{
-		while (n != null && n.getNodeType() != Node.ELEMENT_NODE)
+		while ((n != null) && (n.getNodeType() != Node.ELEMENT_NODE))
+		{
 			n = n.getNextSibling();
-		if (n == null) return null;
-		if ("and".equalsIgnoreCase(n.getNodeName())) return parseLogicAnd(n, template);
-		if ("or".equalsIgnoreCase(n.getNodeName())) return parseLogicOr(n, template);
-		if ("not".equalsIgnoreCase(n.getNodeName())) return parseLogicNot(n, template);
-		if ("player".equalsIgnoreCase(n.getNodeName())) return parsePlayerCondition(n, template);
-		if ("target".equalsIgnoreCase(n.getNodeName())) return parseTargetCondition(n, template);
-		if ("skill".equalsIgnoreCase(n.getNodeName())) return parseSkillCondition(n);
-		if ("using".equalsIgnoreCase(n.getNodeName())) return parseUsingCondition(n);
-		if ("game".equalsIgnoreCase(n.getNodeName())) return parseGameCondition(n);
+		}
+		if (n == null)
+		{
+			return null;
+		}
+		if ("and".equalsIgnoreCase(n.getNodeName()))
+		{
+			return parseLogicAnd(n, template);
+		}
+		if ("or".equalsIgnoreCase(n.getNodeName()))
+		{
+			return parseLogicOr(n, template);
+		}
+		if ("not".equalsIgnoreCase(n.getNodeName()))
+		{
+			return parseLogicNot(n, template);
+		}
+		if ("player".equalsIgnoreCase(n.getNodeName()))
+		{
+			return parsePlayerCondition(n, template);
+		}
+		if ("target".equalsIgnoreCase(n.getNodeName()))
+		{
+			return parseTargetCondition(n, template);
+		}
+		if ("skill".equalsIgnoreCase(n.getNodeName()))
+		{
+			return parseSkillCondition(n);
+		}
+		if ("using".equalsIgnoreCase(n.getNodeName()))
+		{
+			return parseUsingCondition(n);
+		}
+		if ("game".equalsIgnoreCase(n.getNodeName()))
+		{
+			return parseGameCondition(n);
+		}
 		return null;
 	}
 	
@@ -423,10 +537,15 @@ public abstract class DocumentBase
 		ConditionLogicAnd cond = new ConditionLogicAnd();
 		for (n = n.getFirstChild(); n != null; n = n.getNextSibling())
 		{
-			if (n.getNodeType() == Node.ELEMENT_NODE) cond.add(parseCondition(n, template));
+			if (n.getNodeType() == Node.ELEMENT_NODE)
+			{
+				cond.add(parseCondition(n, template));
+			}
 		}
-		if (cond.conditions == null || cond.conditions.length == 0)
+		if ((cond.conditions == null) || (cond.conditions.length == 0))
+		{
 			_log.severe("Empty <and> condition in " + _file);
+		}
 		return cond;
 	}
 	
@@ -435,10 +554,15 @@ public abstract class DocumentBase
 		ConditionLogicOr cond = new ConditionLogicOr();
 		for (n = n.getFirstChild(); n != null; n = n.getNextSibling())
 		{
-			if (n.getNodeType() == Node.ELEMENT_NODE) cond.add(parseCondition(n, template));
+			if (n.getNodeType() == Node.ELEMENT_NODE)
+			{
+				cond.add(parseCondition(n, template));
+			}
 		}
-		if (cond.conditions == null || cond.conditions.length == 0)
+		if ((cond.conditions == null) || (cond.conditions.length == 0))
+		{
 			_log.severe("Empty <or> condition in " + _file);
+		}
 		return cond;
 	}
 	
@@ -778,10 +902,15 @@ public abstract class DocumentBase
 			}
 		}
 		
-		if (forces[0] + forces[1] > 0)
+		if ((forces[0] + forces[1]) > 0)
+		{
 			cond = joinAnd(cond, new ConditionForceBuff(forces));
+		}
 		
-		if (cond == null) _log.severe("Unrecognized <player> condition in " + _file);
+		if (cond == null)
+		{
+			_log.severe("Unrecognized <player> condition in " + _file);
+		}
 		return cond;
 	}
 	
@@ -862,10 +991,10 @@ public abstract class DocumentBase
 				int abnormalId = Integer.decode(getValue(a.getNodeValue(), template));
 				cond = joinAnd(cond, new ConditionTargetAbnormal(abnormalId));
 			}
-			else if("mindistance".equalsIgnoreCase(a.getNodeName()))
+			else if ("mindistance".equalsIgnoreCase(a.getNodeName()))
 			{
-				int distance = Integer.decode(getValue(a.getNodeValue(),null));
-				cond = joinAnd(cond, new ConditionMinDistance(distance*distance));
+				int distance = Integer.decode(getValue(a.getNodeValue(), null));
+				cond = joinAnd(cond, new ConditionMinDistance(distance * distance));
 			}
 			// used for npc race
 			else if ("race_id".equalsIgnoreCase(a.getNodeName()))
@@ -942,7 +1071,9 @@ public abstract class DocumentBase
 				{
 					type = Enum.valueOf(InstanceType.class, valuesSplit[j]);
 					if (type == null)
-						throw new IllegalArgumentException("Instance type not recognized: "+valuesSplit[j]);
+					{
+						throw new IllegalArgumentException("Instance type not recognized: " + valuesSplit[j]);
+					}
 					types[j] = type;
 				}
 				
@@ -959,7 +1090,10 @@ public abstract class DocumentBase
 				cond = joinAnd(cond, new ConditionTargetInvSize(size));
 			}
 		}
-		if (cond == null) _log.severe("Unrecognized <target> condition in " + _file);
+		if (cond == null)
+		{
+			_log.severe("Unrecognized <target> condition in " + _file);
+		}
 		return cond;
 	}
 	
@@ -986,13 +1120,19 @@ public abstract class DocumentBase
 					int old = mask;
 					String item = st.nextToken().trim();
 					if (ItemTable._weaponTypes.containsKey(item))
+					{
 						mask |= ItemTable._weaponTypes.get(item).mask();
+					}
 					
 					if (ItemTable._armorTypes.containsKey(item))
+					{
 						mask |= ItemTable._armorTypes.get(item).mask();
+					}
 					
 					if (old == mask)
-						_log.info("[parseUsingCondition=\"kind\"] Unknown item type name: "+item);
+					{
+						_log.info("[parseUsingCondition=\"kind\"] Unknown item type name: " + item);
+					}
 				}
 				cond = joinAnd(cond, new ConditionUsingItemType(mask));
 			}
@@ -1007,7 +1147,10 @@ public abstract class DocumentBase
 				int id = Integer.parseInt(st.nextToken().trim());
 				int slot = Integer.parseInt(st.nextToken().trim());
 				int enchant = 0;
-				if (st.hasMoreTokens()) enchant = Integer.parseInt(st.nextToken().trim());
+				if (st.hasMoreTokens())
+				{
+					enchant = Integer.parseInt(st.nextToken().trim());
+				}
 				cond = joinAnd(cond, new ConditionSlotItemId(slot, id, enchant));
 			}
 			else if ("weaponChange".equalsIgnoreCase(a.getNodeName()))
@@ -1016,7 +1159,10 @@ public abstract class DocumentBase
 				cond = joinAnd(cond, new ConditionChangeWeapon(val));
 			}
 		}
-		if (cond == null) _log.severe("Unrecognized <using> condition in " + _file);
+		if (cond == null)
+		{
+			_log.severe("Unrecognized <using> condition in " + _file);
+		}
 		return cond;
 	}
 	
@@ -1043,7 +1189,10 @@ public abstract class DocumentBase
 				cond = joinAnd(cond, new ConditionGameChance(val));
 			}
 		}
-		if (cond == null) _log.severe("Unrecognized <game> condition in " + _file);
+		if (cond == null)
+		{
+			_log.severe("Unrecognized <game> condition in " + _file);
+		}
 		return cond;
 	}
 	
@@ -1051,11 +1200,16 @@ public abstract class DocumentBase
 	{
 		NamedNodeMap attrs = n.getAttributes();
 		String name = attrs.getNamedItem("name").getNodeValue();
-		if (name.charAt(0) != '#') throw new IllegalArgumentException("Table name must start with #");
+		if (name.charAt(0) != '#')
+		{
+			throw new IllegalArgumentException("Table name must start with #");
+		}
 		StringTokenizer data = new StringTokenizer(n.getFirstChild().getNodeValue());
 		List<String> array = new ArrayList<>(data.countTokens());
 		while (data.hasMoreTokens())
+		{
 			array.add(data.nextToken());
+		}
 		setTable(name, array.toArray(new String[array.size()]));
 	}
 	
@@ -1064,10 +1218,14 @@ public abstract class DocumentBase
 		String name = n.getAttributes().getNamedItem("name").getNodeValue().trim();
 		String value = n.getAttributes().getNamedItem("val").getNodeValue().trim();
 		char ch = value.isEmpty() ? ' ' : value.charAt(0);
-		if (ch == '#' || ch == '-' || Character.isDigit(ch))
+		if ((ch == '#') || (ch == '-') || Character.isDigit(ch))
+		{
 			set.set(name, String.valueOf(getValue(value, level)));
+		}
 		else
+		{
 			set.set(name, value);
+		}
 	}
 	
 	protected void setExtractableSkillData(StatsSet set, String value)
@@ -1088,13 +1246,21 @@ public abstract class DocumentBase
 			else if (val.charAt(0) == '$')
 			{
 				if (val.equalsIgnoreCase("$player_level"))
+				{
 					return new LambdaStats(LambdaStats.StatsType.PLAYER_LEVEL);
+				}
 				if (val.equalsIgnoreCase("$target_level"))
+				{
 					return new LambdaStats(LambdaStats.StatsType.TARGET_LEVEL);
+				}
 				if (val.equalsIgnoreCase("$player_max_hp"))
+				{
 					return new LambdaStats(LambdaStats.StatsType.PLAYER_MAX_HP);
+				}
 				if (val.equalsIgnoreCase("$player_max_mp"))
+				{
 					return new LambdaStats(LambdaStats.StatsType.PLAYER_MAX_MP);
+				}
 				// try to find value out of item fields
 				StatsSet set = getStatsSet();
 				String field = set.getString(val.substring(1));
@@ -1112,14 +1278,21 @@ public abstract class DocumentBase
 		}
 		LambdaCalc calc = new LambdaCalc();
 		n = n.getFirstChild();
-		while (n != null && n.getNodeType() != Node.ELEMENT_NODE)
+		while ((n != null) && (n.getNodeType() != Node.ELEMENT_NODE))
+		{
 			n = n.getNextSibling();
-		if (n == null || !"val".equals(n.getNodeName()))
+		}
+		if ((n == null) || !"val".equals(n.getNodeName()))
+		{
 			throw new IllegalArgumentException("Value not specified");
+		}
 		
 		for (n = n.getFirstChild(); n != null; n = n.getNextSibling())
 		{
-			if (n.getNodeType() != Node.ELEMENT_NODE) continue;
+			if (n.getNodeType() != Node.ELEMENT_NODE)
+			{
+				continue;
+			}
 			attachLambdaFunc(n, template, calc);
 		}
 		return calc;
@@ -1130,16 +1303,28 @@ public abstract class DocumentBase
 		// is it a table?
 		if (value.charAt(0) == '#')
 		{
-			if (template instanceof L2Skill) return getTableValue(value);
-			else if (template instanceof Integer) return getTableValue(value, ((Integer) template).intValue());
-			else throw new IllegalStateException();
+			if (template instanceof L2Skill)
+			{
+				return getTableValue(value);
+			}
+			else if (template instanceof Integer)
+			{
+				return getTableValue(value, ((Integer) template).intValue());
+			}
+			else
+			{
+				throw new IllegalStateException();
+			}
 		}
 		return value;
 	}
 	
 	protected Condition joinAnd(Condition cond, Condition c)
 	{
-		if (cond == null) return c;
+		if (cond == null)
+		{
+			return c;
+		}
 		if (cond instanceof ConditionLogicAnd)
 		{
 			((ConditionLogicAnd) cond).add(c);

+ 4 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/engines/DocumentEngine.java

@@ -48,10 +48,14 @@ public class DocumentEngine
 	{
 		hashFiles("data/stats/items", _itemFiles);
 		if (Config.CUSTOM_ITEMS_LOAD)
+		{
 			hashFiles("data/stats/items/custom", _itemFiles);
+		}
 		hashFiles("data/stats/skills", _skillFiles);
 		if (Config.CUSTOM_SKILLS_LOAD)
+		{
 			hashFiles("data/stats/skills/custom", _skillFiles);
+		}
 	}
 	
 	private void hashFiles(String dirname, List<File> hash)

+ 1 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/engines/DocumentParser.java

@@ -115,7 +115,6 @@ public abstract class DocumentParser
 		return _currentDocument;
 	}
 	
-	
 	/**
 	 * Wrapper for {@link #parseDirectory(File, boolean)}.
 	 * @param file the path to the directory where the XML files are.
@@ -269,7 +268,7 @@ public abstract class DocumentParser
 	
 	/**
 	 * @param n the named node map
-	 * @param name  the attribute name
+	 * @param name the attribute name
 	 * @return the node string value for the given node name and named node map if exist, otherwise an empty string
 	 */
 	protected static String parseString(NamedNodeMap n, String name)

+ 21 - 12
L2J_Server_BETA/java/com/l2jserver/gameserver/engines/items/DocumentItem.java

@@ -36,7 +36,7 @@ import com.l2jserver.gameserver.model.items.L2Item;
 public final class DocumentItem extends DocumentBase
 {
 	private Item _currentItem = null;
-	private List<L2Item> _itemsInFile = new FastList<>();
+	private final List<L2Item> _itemsInFile = new FastList<>();
 	
 	/**
 	 * @param file
@@ -45,7 +45,6 @@ public final class DocumentItem extends DocumentBase
 	{
 		super(file);
 	}
-
 	
 	@Override
 	protected StatsSet getStatsSet()
@@ -86,7 +85,7 @@ public final class DocumentItem extends DocumentBase
 						}
 						catch (Exception e)
 						{
-							_log.log(Level.WARNING, "Cannot create item "+_currentItem.id, e);
+							_log.log(Level.WARNING, "Cannot create item " + _currentItem.id, e);
 						}
 					}
 				}
@@ -113,13 +112,17 @@ public final class DocumentItem extends DocumentBase
 			if ("table".equalsIgnoreCase(n.getNodeName()))
 			{
 				if (_currentItem.item != null)
-					throw new IllegalStateException("Item created but table node found! Item "+itemId);
+				{
+					throw new IllegalStateException("Item created but table node found! Item " + itemId);
+				}
 				parseTable(n);
 			}
 			else if ("set".equalsIgnoreCase(n.getNodeName()))
 			{
 				if (_currentItem.item != null)
-					throw new IllegalStateException("Item created but set node found! Item "+itemId);
+				{
+					throw new IllegalStateException("Item created but set node found! Item " + itemId);
+				}
 				parseBeanSet(n, _currentItem.set, 1);
 			}
 			else if ("for".equalsIgnoreCase(n.getNodeName()))
@@ -130,32 +133,38 @@ public final class DocumentItem extends DocumentBase
 			else if ("cond".equalsIgnoreCase(n.getNodeName()))
 			{
 				makeItem();
-				Condition condition = parseCondition(n.getFirstChild(), _currentItem.item );
+				Condition condition = parseCondition(n.getFirstChild(), _currentItem.item);
 				Node msg = n.getAttributes().getNamedItem("msg");
 				Node msgId = n.getAttributes().getNamedItem("msgId");
-				if (condition != null && msg != null)
+				if ((condition != null) && (msg != null))
+				{
 					condition.setMessage(msg.getNodeValue());
-				else if (condition != null && msgId != null)
+				}
+				else if ((condition != null) && (msgId != null))
 				{
 					condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
 					Node addName = n.getAttributes().getNamedItem("addName");
-					if (addName != null && Integer.decode(getValue(msgId.getNodeValue(), null)) > 0)
+					if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
+					{
 						condition.addName();
+					}
 				}
 				_currentItem.item.attach(condition);
 			}
 		}
-		//bah! in this point item doesn't have to be still created
+		// bah! in this point item doesn't have to be still created
 		makeItem();
 	}
 	
 	private void makeItem() throws InvocationTargetException
 	{
-		if (_currentItem.item != null) 
+		if (_currentItem.item != null)
+		{
 			return; // item is already created
+		}
 		try
 		{
-			Constructor<?> c = Class.forName("com.l2jserver.gameserver.model.items.L2"+_currentItem.type).getConstructor(StatsSet.class);
+			Constructor<?> c = Class.forName("com.l2jserver.gameserver.model.items.L2" + _currentItem.type).getConstructor(StatsSet.class);
 			_currentItem.item = (L2Item) c.newInstance(_currentItem.set);
 		}
 		catch (Exception e)

+ 0 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/engines/items/Item.java

@@ -19,7 +19,6 @@ import com.l2jserver.gameserver.model.items.L2Item;
 
 /**
  * This class ...
- *
  * @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $
  */
 public class Item

+ 321 - 213
L2J_Server_BETA/java/com/l2jserver/gameserver/engines/skills/DocumentSkill.java

@@ -38,24 +38,24 @@ public class DocumentSkill extends DocumentBase
 {
 	public static class Skill
 	{
-		public int                  id;
-		public String               name;
-		public StatsSet[]           sets;
-		public StatsSet[]           enchsets1;
-		public StatsSet[]           enchsets2;
-		public StatsSet[]           enchsets3;
-		public StatsSet[]           enchsets4;
-		public StatsSet[]           enchsets5;
-		public StatsSet[]           enchsets6;
-		public StatsSet[]           enchsets7;
-		public StatsSet[]           enchsets8;
-		public int                  currentLevel;
-		public List<L2Skill>   skills          = new FastList<>();
-		public List<L2Skill>   currentSkills   = new FastList<>();
+		public int id;
+		public String name;
+		public StatsSet[] sets;
+		public StatsSet[] enchsets1;
+		public StatsSet[] enchsets2;
+		public StatsSet[] enchsets3;
+		public StatsSet[] enchsets4;
+		public StatsSet[] enchsets5;
+		public StatsSet[] enchsets6;
+		public StatsSet[] enchsets7;
+		public StatsSet[] enchsets8;
+		public int currentLevel;
+		public List<L2Skill> skills = new FastList<>();
+		public List<L2Skill> currentSkills = new FastList<>();
 	}
 	
 	private Skill _currentSkill;
-	private List<L2Skill> _skillsInFile  = new FastList<>();
+	private final List<L2Skill> _skillsInFile = new FastList<>();
 	
 	public DocumentSkill(File file)
 	{
@@ -64,7 +64,7 @@ public class DocumentSkill extends DocumentBase
 	
 	private void setCurrentSkill(Skill skill)
 	{
-		_currentSkill    = skill;
+		_currentSkill = skill;
 	}
 	
 	@Override
@@ -87,7 +87,7 @@ public class DocumentSkill extends DocumentBase
 		}
 		catch (RuntimeException e)
 		{
-			_log.log(Level.SEVERE, "Error in table: "+name+" of Skill Id "+_currentSkill.id, e);
+			_log.log(Level.SEVERE, "Error in table: " + name + " of Skill Id " + _currentSkill.id, e);
 			return "";
 		}
 	}
@@ -97,11 +97,11 @@ public class DocumentSkill extends DocumentBase
 	{
 		try
 		{
-			return _tables.get(name)[idx-1];
+			return _tables.get(name)[idx - 1];
 		}
 		catch (RuntimeException e)
 		{
-			_log.log(Level.SEVERE, "wrong level count in skill Id "+_currentSkill.id+" name: "+name+ " index : "+idx, e);
+			_log.log(Level.SEVERE, "wrong level count in skill Id " + _currentSkill.id + " name: " + name + " index : " + idx, e);
 			return "";
 		}
 	}
@@ -109,11 +109,11 @@ public class DocumentSkill extends DocumentBase
 	@Override
 	protected void parseDocument(Document doc)
 	{
-		for (Node n=doc.getFirstChild(); n != null; n = n.getNextSibling())
+		for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
 		{
 			if ("list".equalsIgnoreCase(n.getNodeName()))
 			{
-				for (Node d=n.getFirstChild(); d != null; d = d.getNextSibling())
+				for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
 				{
 					if ("skill".equalsIgnoreCase(d.getNodeName()))
 					{
@@ -149,272 +149,348 @@ public class DocumentSkill extends DocumentBase
 		String levels = attrs.getNamedItem("levels").getNodeValue();
 		int lastLvl = Integer.parseInt(levels);
 		if (attrs.getNamedItem("enchantGroup1") != null)
+		{
 			enchantLevels1 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 1, Integer.parseInt(attrs.getNamedItem("enchantGroup1").getNodeValue()));
+		}
 		if (attrs.getNamedItem("enchantGroup2") != null)
+		{
 			enchantLevels2 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 2, Integer.parseInt(attrs.getNamedItem("enchantGroup2").getNodeValue()));
+		}
 		if (attrs.getNamedItem("enchantGroup3") != null)
+		{
 			enchantLevels3 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 3, Integer.parseInt(attrs.getNamedItem("enchantGroup3").getNodeValue()));
+		}
 		if (attrs.getNamedItem("enchantGroup4") != null)
+		{
 			enchantLevels4 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 4, Integer.parseInt(attrs.getNamedItem("enchantGroup4").getNodeValue()));
+		}
 		if (attrs.getNamedItem("enchantGroup5") != null)
+		{
 			enchantLevels5 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 5, Integer.parseInt(attrs.getNamedItem("enchantGroup5").getNodeValue()));
+		}
 		if (attrs.getNamedItem("enchantGroup6") != null)
+		{
 			enchantLevels6 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 6, Integer.parseInt(attrs.getNamedItem("enchantGroup6").getNodeValue()));
+		}
 		if (attrs.getNamedItem("enchantGroup7") != null)
+		{
 			enchantLevels7 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 7, Integer.parseInt(attrs.getNamedItem("enchantGroup7").getNodeValue()));
+		}
 		if (attrs.getNamedItem("enchantGroup8") != null)
+		{
 			enchantLevels8 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 8, Integer.parseInt(attrs.getNamedItem("enchantGroup8").getNodeValue()));
+		}
 		
-		_currentSkill.id     = skillId;
-		_currentSkill.name   = skillName;
-		_currentSkill.sets   = new StatsSet[lastLvl];
-		_currentSkill.enchsets1   = new StatsSet[enchantLevels1];
-		_currentSkill.enchsets2   = new StatsSet[enchantLevels2];
-		_currentSkill.enchsets3   = new StatsSet[enchantLevels3];
-		_currentSkill.enchsets4   = new StatsSet[enchantLevels4];
-		_currentSkill.enchsets5   = new StatsSet[enchantLevels5];
-		_currentSkill.enchsets6   = new StatsSet[enchantLevels6];
-		_currentSkill.enchsets7   = new StatsSet[enchantLevels7];
-		_currentSkill.enchsets8   = new StatsSet[enchantLevels8];
+		_currentSkill.id = skillId;
+		_currentSkill.name = skillName;
+		_currentSkill.sets = new StatsSet[lastLvl];
+		_currentSkill.enchsets1 = new StatsSet[enchantLevels1];
+		_currentSkill.enchsets2 = new StatsSet[enchantLevels2];
+		_currentSkill.enchsets3 = new StatsSet[enchantLevels3];
+		_currentSkill.enchsets4 = new StatsSet[enchantLevels4];
+		_currentSkill.enchsets5 = new StatsSet[enchantLevels5];
+		_currentSkill.enchsets6 = new StatsSet[enchantLevels6];
+		_currentSkill.enchsets7 = new StatsSet[enchantLevels7];
+		_currentSkill.enchsets8 = new StatsSet[enchantLevels8];
 		
-		for (int i=0; i < lastLvl; i++)
+		for (int i = 0; i < lastLvl; i++)
 		{
 			_currentSkill.sets[i] = new StatsSet();
 			_currentSkill.sets[i].set("skill_id", _currentSkill.id);
-			_currentSkill.sets[i].set("level",    i+1);
-			_currentSkill.sets[i].set("name",     _currentSkill.name);
+			_currentSkill.sets[i].set("level", i + 1);
+			_currentSkill.sets[i].set("name", _currentSkill.name);
 		}
 		
 		if (_currentSkill.sets.length != lastLvl)
-			throw new RuntimeException("Skill id="+skillId+" number of levels missmatch, "+lastLvl+" levels expected");
+		{
+			throw new RuntimeException("Skill id=" + skillId + " number of levels missmatch, " + lastLvl + " levels expected");
+		}
 		
 		Node first = n.getFirstChild();
-		for (n=first; n != null; n = n.getNextSibling())
+		for (n = first; n != null; n = n.getNextSibling())
 		{
 			if ("table".equalsIgnoreCase(n.getNodeName()))
+			{
 				parseTable(n);
+			}
 		}
-		for (int i=1; i <= lastLvl; i++)
+		for (int i = 1; i <= lastLvl; i++)
 		{
-			for (n=first; n != null; n = n.getNextSibling())
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("set".equalsIgnoreCase(n.getNodeName()))
 				{
-					//Extractable item skills by Zoey76
+					// Extractable item skills by Zoey76
 					if ("capsuled_items_skill".equalsIgnoreCase(n.getAttributes().getNamedItem("name").getNodeValue()))
-						setExtractableSkillData(_currentSkill.sets[i-1], getTableValue("#extractableItems", i));
+					{
+						setExtractableSkillData(_currentSkill.sets[i - 1], getTableValue("#extractableItems", i));
+					}
 					else
-						parseBeanSet(n, _currentSkill.sets[i-1], i);
+					{
+						parseBeanSet(n, _currentSkill.sets[i - 1], i);
+					}
 				}
 			}
 		}
-		for (int i=0; i < enchantLevels1; i++)
+		for (int i = 0; i < enchantLevels1; i++)
 		{
 			_currentSkill.enchsets1[i] = new StatsSet();
 			_currentSkill.enchsets1[i].set("skill_id", _currentSkill.id);
-			//currentSkill.enchsets1[i] = currentSkill.sets[currentSkill.sets.length-1];
-			_currentSkill.enchsets1[i].set("level",    i+101);
-			_currentSkill.enchsets1[i].set("name",     _currentSkill.name);
-			//currentSkill.enchsets1[i].set("skillType",     "NOTDONE");
+			// currentSkill.enchsets1[i] = currentSkill.sets[currentSkill.sets.length-1];
+			_currentSkill.enchsets1[i].set("level", i + 101);
+			_currentSkill.enchsets1[i].set("name", _currentSkill.name);
+			// currentSkill.enchsets1[i].set("skillType", "NOTDONE");
 			
-			for (n=first; n != null; n = n.getNextSibling())
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("set".equalsIgnoreCase(n.getNodeName()))
+				{
 					parseBeanSet(n, _currentSkill.enchsets1[i], _currentSkill.sets.length);
+				}
 			}
 			
-			for (n=first; n != null; n = n.getNextSibling())
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("enchant1".equalsIgnoreCase(n.getNodeName()))
-					parseBeanSet(n, _currentSkill.enchsets1[i], i+1);
+				{
+					parseBeanSet(n, _currentSkill.enchsets1[i], i + 1);
+				}
 			}
 		}
 		
 		if (_currentSkill.enchsets1.length != enchantLevels1)
-			throw new RuntimeException("Skill id="+skillId+" number of levels missmatch, "+enchantLevels1+" levels expected");
+		{
+			throw new RuntimeException("Skill id=" + skillId + " number of levels missmatch, " + enchantLevels1 + " levels expected");
+		}
 		
-		for (int i=0; i < enchantLevels2; i++)
+		for (int i = 0; i < enchantLevels2; i++)
 		{
 			_currentSkill.enchsets2[i] = new StatsSet();
-			//currentSkill.enchsets2[i] = currentSkill.sets[currentSkill.sets.length-1];
+			// currentSkill.enchsets2[i] = currentSkill.sets[currentSkill.sets.length-1];
 			_currentSkill.enchsets2[i].set("skill_id", _currentSkill.id);
-			_currentSkill.enchsets2[i].set("level",    i+201);
-			_currentSkill.enchsets2[i].set("name",     _currentSkill.name);
-			//currentSkill.enchsets2[i].set("skillType",     "NOTDONE");
+			_currentSkill.enchsets2[i].set("level", i + 201);
+			_currentSkill.enchsets2[i].set("name", _currentSkill.name);
+			// currentSkill.enchsets2[i].set("skillType", "NOTDONE");
 			
-			for (n=first; n != null; n = n.getNextSibling())
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("set".equalsIgnoreCase(n.getNodeName()))
+				{
 					parseBeanSet(n, _currentSkill.enchsets2[i], _currentSkill.sets.length);
+				}
 			}
 			
-			for (n=first; n != null; n = n.getNextSibling())
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("enchant2".equalsIgnoreCase(n.getNodeName()))
-					parseBeanSet(n, _currentSkill.enchsets2[i], i+1);
+				{
+					parseBeanSet(n, _currentSkill.enchsets2[i], i + 1);
+				}
 			}
 		}
 		
 		if (_currentSkill.enchsets2.length != enchantLevels2)
-			throw new RuntimeException("Skill id="+skillId+" number of levels missmatch, "+enchantLevels2+" levels expected");
+		{
+			throw new RuntimeException("Skill id=" + skillId + " number of levels missmatch, " + enchantLevels2 + " levels expected");
+		}
 		
-		for (int i=0; i < enchantLevels3; i++)
+		for (int i = 0; i < enchantLevels3; i++)
 		{
 			_currentSkill.enchsets3[i] = new StatsSet();
 			_currentSkill.enchsets3[i].set("skill_id", _currentSkill.id);
-			_currentSkill.enchsets3[i].set("level",    i+301);
-			_currentSkill.enchsets3[i].set("name",     _currentSkill.name);
+			_currentSkill.enchsets3[i].set("level", i + 301);
+			_currentSkill.enchsets3[i].set("name", _currentSkill.name);
 			
-			for (n=first; n != null; n = n.getNextSibling())
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("set".equalsIgnoreCase(n.getNodeName()))
+				{
 					parseBeanSet(n, _currentSkill.enchsets3[i], _currentSkill.sets.length);
+				}
 			}
 			
-			for (n=first; n != null; n = n.getNextSibling())
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("enchant3".equalsIgnoreCase(n.getNodeName()))
-					parseBeanSet(n, _currentSkill.enchsets3[i], i+1);
+				{
+					parseBeanSet(n, _currentSkill.enchsets3[i], i + 1);
+				}
 			}
 		}
 		
 		if (_currentSkill.enchsets3.length != enchantLevels3)
-			throw new RuntimeException("Skill id="+skillId+" number of levels missmatch, "+enchantLevels3+" levels expected");
+		{
+			throw new RuntimeException("Skill id=" + skillId + " number of levels missmatch, " + enchantLevels3 + " levels expected");
+		}
 		
-		for (int i=0; i < enchantLevels4; i++)
+		for (int i = 0; i < enchantLevels4; i++)
 		{
 			_currentSkill.enchsets4[i] = new StatsSet();
 			_currentSkill.enchsets4[i].set("skill_id", _currentSkill.id);
-			_currentSkill.enchsets4[i].set("level",    i+401);
-			_currentSkill.enchsets4[i].set("name",     _currentSkill.name);
+			_currentSkill.enchsets4[i].set("level", i + 401);
+			_currentSkill.enchsets4[i].set("name", _currentSkill.name);
 			
-			for (n=first; n != null; n = n.getNextSibling())
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("set".equalsIgnoreCase(n.getNodeName()))
+				{
 					parseBeanSet(n, _currentSkill.enchsets4[i], _currentSkill.sets.length);
+				}
 			}
 			
-			for (n=first; n != null; n = n.getNextSibling())
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("enchant4".equalsIgnoreCase(n.getNodeName()))
-					parseBeanSet(n, _currentSkill.enchsets4[i], i+1);
+				{
+					parseBeanSet(n, _currentSkill.enchsets4[i], i + 1);
+				}
 			}
 		}
 		
 		if (_currentSkill.enchsets4.length != enchantLevels4)
-			throw new RuntimeException("Skill id="+skillId+" number of levels missmatch, "+enchantLevels4+" levels expected");
+		{
+			throw new RuntimeException("Skill id=" + skillId + " number of levels missmatch, " + enchantLevels4 + " levels expected");
+		}
 		
-		for (int i=0; i < enchantLevels5; i++)
+		for (int i = 0; i < enchantLevels5; i++)
 		{
 			_currentSkill.enchsets5[i] = new StatsSet();
 			_currentSkill.enchsets5[i].set("skill_id", _currentSkill.id);
-			_currentSkill.enchsets5[i].set("level",    i+501);
-			_currentSkill.enchsets5[i].set("name",     _currentSkill.name);
+			_currentSkill.enchsets5[i].set("level", i + 501);
+			_currentSkill.enchsets5[i].set("name", _currentSkill.name);
 			
-			for (n=first; n != null; n = n.getNextSibling())
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("set".equalsIgnoreCase(n.getNodeName()))
+				{
 					parseBeanSet(n, _currentSkill.enchsets5[i], _currentSkill.sets.length);
+				}
 			}
 			
-			for (n=first; n != null; n = n.getNextSibling())
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("enchant5".equalsIgnoreCase(n.getNodeName()))
-					parseBeanSet(n, _currentSkill.enchsets5[i], i+1);
+				{
+					parseBeanSet(n, _currentSkill.enchsets5[i], i + 1);
+				}
 			}
 		}
 		
 		if (_currentSkill.enchsets5.length != enchantLevels5)
-			throw new RuntimeException("Skill id="+skillId+" number of levels missmatch, "+enchantLevels5+" levels expected");
+		{
+			throw new RuntimeException("Skill id=" + skillId + " number of levels missmatch, " + enchantLevels5 + " levels expected");
+		}
 		
-		for (int i=0; i < enchantLevels6; i++)
+		for (int i = 0; i < enchantLevels6; i++)
 		{
 			_currentSkill.enchsets6[i] = new StatsSet();
 			_currentSkill.enchsets6[i].set("skill_id", _currentSkill.id);
-			_currentSkill.enchsets6[i].set("level",    i+601);
-			_currentSkill.enchsets6[i].set("name",     _currentSkill.name);
+			_currentSkill.enchsets6[i].set("level", i + 601);
+			_currentSkill.enchsets6[i].set("name", _currentSkill.name);
 			
-			for (n=first; n != null; n = n.getNextSibling())
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("set".equalsIgnoreCase(n.getNodeName()))
+				{
 					parseBeanSet(n, _currentSkill.enchsets6[i], _currentSkill.sets.length);
+				}
 			}
 			
-			for (n=first; n != null; n = n.getNextSibling())
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("enchant6".equalsIgnoreCase(n.getNodeName()))
-					parseBeanSet(n, _currentSkill.enchsets6[i], i+1);
+				{
+					parseBeanSet(n, _currentSkill.enchsets6[i], i + 1);
+				}
 			}
 		}
 		
 		if (_currentSkill.enchsets6.length != enchantLevels6)
-			throw new RuntimeException("Skill id="+skillId+" number of levels missmatch, "+enchantLevels6+" levels expected");
+		{
+			throw new RuntimeException("Skill id=" + skillId + " number of levels missmatch, " + enchantLevels6 + " levels expected");
+		}
 		
-		for (int i=0; i < enchantLevels7; i++)
+		for (int i = 0; i < enchantLevels7; i++)
 		{
 			_currentSkill.enchsets7[i] = new StatsSet();
 			_currentSkill.enchsets7[i].set("skill_id", _currentSkill.id);
-			_currentSkill.enchsets7[i].set("level",    i+701);
-			_currentSkill.enchsets7[i].set("name",     _currentSkill.name);
+			_currentSkill.enchsets7[i].set("level", i + 701);
+			_currentSkill.enchsets7[i].set("name", _currentSkill.name);
 			
-			for (n=first; n != null; n = n.getNextSibling())
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("set".equalsIgnoreCase(n.getNodeName()))
+				{
 					parseBeanSet(n, _currentSkill.enchsets7[i], _currentSkill.sets.length);
+				}
 			}
 			
-			for (n=first; n != null; n = n.getNextSibling())
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("enchant7".equalsIgnoreCase(n.getNodeName()))
-					parseBeanSet(n, _currentSkill.enchsets7[i], i+1);
+				{
+					parseBeanSet(n, _currentSkill.enchsets7[i], i + 1);
+				}
 			}
 		}
 		
 		if (_currentSkill.enchsets7.length != enchantLevels7)
-			throw new RuntimeException("Skill id="+skillId+" number of levels missmatch, "+enchantLevels7+" levels expected");
+		{
+			throw new RuntimeException("Skill id=" + skillId + " number of levels missmatch, " + enchantLevels7 + " levels expected");
+		}
 		
-		for (int i=0; i < enchantLevels8; i++)
+		for (int i = 0; i < enchantLevels8; i++)
 		{
 			_currentSkill.enchsets8[i] = new StatsSet();
 			_currentSkill.enchsets8[i].set("skill_id", _currentSkill.id);
-			_currentSkill.enchsets8[i].set("level",    i+801);
-			_currentSkill.enchsets8[i].set("name",     _currentSkill.name);
+			_currentSkill.enchsets8[i].set("level", i + 801);
+			_currentSkill.enchsets8[i].set("name", _currentSkill.name);
 			
-			for (n=first; n != null; n = n.getNextSibling())
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("set".equalsIgnoreCase(n.getNodeName()))
+				{
 					parseBeanSet(n, _currentSkill.enchsets8[i], _currentSkill.sets.length);
+				}
 			}
 			
-			for (n=first; n != null; n = n.getNextSibling())
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("enchant8".equalsIgnoreCase(n.getNodeName()))
-					parseBeanSet(n, _currentSkill.enchsets8[i], i+1);
+				{
+					parseBeanSet(n, _currentSkill.enchsets8[i], i + 1);
+				}
 			}
 		}
 		
 		if (_currentSkill.enchsets8.length != enchantLevels8)
-			throw new RuntimeException("Skill id="+skillId+" number of levels missmatch, "+enchantLevels8+" levels expected");
+		{
+			throw new RuntimeException("Skill id=" + skillId + " number of levels missmatch, " + enchantLevels8 + " levels expected");
+		}
 		
 		makeSkills();
-		for (int i=0; i < lastLvl; i++)
+		for (int i = 0; i < lastLvl; i++)
 		{
 			_currentSkill.currentLevel = i;
-			for (n=first; n != null; n = n.getNextSibling())
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("cond".equalsIgnoreCase(n.getNodeName()))
 				{
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Node msg = n.getAttributes().getNamedItem("msg");
 					Node msgId = n.getAttributes().getNamedItem("msgId");
-					if (condition != null && msg != null)
+					if ((condition != null) && (msg != null))
+					{
 						condition.setMessage(msg.getNodeValue());
-					else if (condition != null && msgId != null)
+					}
+					else if ((condition != null) && (msgId != null))
 					{
 						condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
 						Node addName = n.getAttributes().getNamedItem("addName");
-						if (addName != null && Integer.decode(getValue(msgId.getNodeValue(), null)) > 0)
+						if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
+						{
 							condition.addName();
+						}
 					}
 					_currentSkill.currentSkills.get(i).attach(condition, false);
 				}
@@ -424,20 +500,22 @@ public class DocumentSkill extends DocumentBase
 				}
 			}
 		}
-		for (int i=lastLvl; i < lastLvl+enchantLevels1; i++)
+		for (int i = lastLvl; i < (lastLvl + enchantLevels1); i++)
 		{
-			_currentSkill.currentLevel = i-lastLvl;
+			_currentSkill.currentLevel = i - lastLvl;
 			boolean foundCond = false, foundFor = false;
-			for (n=first; n != null; n = n.getNextSibling())
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("enchant1cond".equalsIgnoreCase(n.getNodeName()))
 				{
 					foundCond = true;
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Node msg = n.getAttributes().getNamedItem("msg");
-					if (condition != null && msg != null)
+					if ((condition != null) && (msg != null))
+					{
 						condition.setMessage(msg.getNodeValue());
-					_currentSkill.currentSkills.get(i).attach(condition,false);
+					}
+					_currentSkill.currentSkills.get(i).attach(condition, false);
 				}
 				else if ("enchant1for".equalsIgnoreCase(n.getNodeName()))
 				{
@@ -448,16 +526,18 @@ public class DocumentSkill extends DocumentBase
 			// If none found, the enchanted skill will take effects from maxLvL of norm skill
 			if (!foundCond || !foundFor)
 			{
-				_currentSkill.currentLevel = lastLvl-1;
-				for (n=first; n != null; n = n.getNextSibling())
+				_currentSkill.currentLevel = lastLvl - 1;
+				for (n = first; n != null; n = n.getNextSibling())
 				{
 					if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
 					{
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Node msg = n.getAttributes().getNamedItem("msg");
-						if (condition != null && msg != null)
+						if ((condition != null) && (msg != null))
+						{
 							condition.setMessage(msg.getNodeValue());
-						_currentSkill.currentSkills.get(i).attach(condition,false);
+						}
+						_currentSkill.currentSkills.get(i).attach(condition, false);
 					}
 					else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
 					{
@@ -466,20 +546,22 @@ public class DocumentSkill extends DocumentBase
 				}
 			}
 		}
-		for (int i=lastLvl+enchantLevels1; i < lastLvl+enchantLevels1+enchantLevels2; i++)
+		for (int i = lastLvl + enchantLevels1; i < (lastLvl + enchantLevels1 + enchantLevels2); i++)
 		{
 			boolean foundCond = false, foundFor = false;
-			_currentSkill.currentLevel = i-lastLvl-enchantLevels1;
-			for (n=first; n != null; n = n.getNextSibling())
+			_currentSkill.currentLevel = i - lastLvl - enchantLevels1;
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("enchant2cond".equalsIgnoreCase(n.getNodeName()))
 				{
 					foundCond = true;
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Node msg = n.getAttributes().getNamedItem("msg");
-					if (condition != null && msg != null)
+					if ((condition != null) && (msg != null))
+					{
 						condition.setMessage(msg.getNodeValue());
-					_currentSkill.currentSkills.get(i).attach(condition,false);
+					}
+					_currentSkill.currentSkills.get(i).attach(condition, false);
 				}
 				else if ("enchant2for".equalsIgnoreCase(n.getNodeName()))
 				{
@@ -488,18 +570,20 @@ public class DocumentSkill extends DocumentBase
 				}
 			}
 			// If none found, the enchanted skill will take effects from maxLvL of norm skill
-			if(!foundCond || !foundFor)
+			if (!foundCond || !foundFor)
 			{
-				_currentSkill.currentLevel = lastLvl-1;
-				for (n=first; n != null; n = n.getNextSibling())
+				_currentSkill.currentLevel = lastLvl - 1;
+				for (n = first; n != null; n = n.getNextSibling())
 				{
 					if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
 					{
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Node msg = n.getAttributes().getNamedItem("msg");
-						if (condition != null && msg != null)
+						if ((condition != null) && (msg != null))
+						{
 							condition.setMessage(msg.getNodeValue());
-						_currentSkill.currentSkills.get(i).attach(condition,false);
+						}
+						_currentSkill.currentSkills.get(i).attach(condition, false);
 					}
 					else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
 					{
@@ -508,20 +592,22 @@ public class DocumentSkill extends DocumentBase
 				}
 			}
 		}
-		for (int i=lastLvl+enchantLevels1+enchantLevels2; i < lastLvl+enchantLevels1+enchantLevels2+enchantLevels3; i++)
+		for (int i = lastLvl + enchantLevels1 + enchantLevels2; i < (lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3); i++)
 		{
 			boolean foundCond = false, foundFor = false;
-			_currentSkill.currentLevel = i-lastLvl-enchantLevels1-enchantLevels2;
-			for (n=first; n != null; n = n.getNextSibling())
+			_currentSkill.currentLevel = i - lastLvl - enchantLevels1 - enchantLevels2;
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("enchant3cond".equalsIgnoreCase(n.getNodeName()))
 				{
 					foundCond = true;
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Node msg = n.getAttributes().getNamedItem("msg");
-					if (condition != null && msg != null)
+					if ((condition != null) && (msg != null))
+					{
 						condition.setMessage(msg.getNodeValue());
-					_currentSkill.currentSkills.get(i).attach(condition,false);
+					}
+					_currentSkill.currentSkills.get(i).attach(condition, false);
 				}
 				else if ("enchant3for".equalsIgnoreCase(n.getNodeName()))
 				{
@@ -530,18 +616,20 @@ public class DocumentSkill extends DocumentBase
 				}
 			}
 			// If none found, the enchanted skill will take effects from maxLvL of norm skill
-			if(!foundCond || !foundFor)
+			if (!foundCond || !foundFor)
 			{
-				_currentSkill.currentLevel = lastLvl-1;
-				for (n=first; n != null; n = n.getNextSibling())
+				_currentSkill.currentLevel = lastLvl - 1;
+				for (n = first; n != null; n = n.getNextSibling())
 				{
 					if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
 					{
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Node msg = n.getAttributes().getNamedItem("msg");
-						if (condition != null && msg != null)
+						if ((condition != null) && (msg != null))
+						{
 							condition.setMessage(msg.getNodeValue());
-						_currentSkill.currentSkills.get(i).attach(condition,false);
+						}
+						_currentSkill.currentSkills.get(i).attach(condition, false);
 					}
 					else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
 					{
@@ -550,20 +638,22 @@ public class DocumentSkill extends DocumentBase
 				}
 			}
 		}
-		for (int i=lastLvl+enchantLevels1+enchantLevels2+enchantLevels3; i < lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4; i++)
+		for (int i = lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3; i < (lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3 + enchantLevels4); i++)
 		{
 			boolean foundCond = false, foundFor = false;
-			_currentSkill.currentLevel = i-lastLvl-enchantLevels1-enchantLevels2-enchantLevels3;
-			for (n=first; n != null; n = n.getNextSibling())
+			_currentSkill.currentLevel = i - lastLvl - enchantLevels1 - enchantLevels2 - enchantLevels3;
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("enchant4cond".equalsIgnoreCase(n.getNodeName()))
 				{
 					foundCond = true;
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Node msg = n.getAttributes().getNamedItem("msg");
-					if (condition != null && msg != null)
+					if ((condition != null) && (msg != null))
+					{
 						condition.setMessage(msg.getNodeValue());
-					_currentSkill.currentSkills.get(i).attach(condition,false);
+					}
+					_currentSkill.currentSkills.get(i).attach(condition, false);
 				}
 				else if ("enchant4for".equalsIgnoreCase(n.getNodeName()))
 				{
@@ -572,18 +662,20 @@ public class DocumentSkill extends DocumentBase
 				}
 			}
 			// If none found, the enchanted skill will take effects from maxLvL of norm skill
-			if(!foundCond || !foundFor)
+			if (!foundCond || !foundFor)
 			{
-				_currentSkill.currentLevel = lastLvl-1;
-				for (n=first; n != null; n = n.getNextSibling())
+				_currentSkill.currentLevel = lastLvl - 1;
+				for (n = first; n != null; n = n.getNextSibling())
 				{
 					if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
 					{
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Node msg = n.getAttributes().getNamedItem("msg");
-						if (condition != null && msg != null)
+						if ((condition != null) && (msg != null))
+						{
 							condition.setMessage(msg.getNodeValue());
-						_currentSkill.currentSkills.get(i).attach(condition,false);
+						}
+						_currentSkill.currentSkills.get(i).attach(condition, false);
 					}
 					else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
 					{
@@ -592,20 +684,22 @@ public class DocumentSkill extends DocumentBase
 				}
 			}
 		}
-		for (int i=lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4; i < lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4+enchantLevels5; i++)
+		for (int i = lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3 + enchantLevels4; i < (lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3 + enchantLevels4 + enchantLevels5); i++)
 		{
 			boolean foundCond = false, foundFor = false;
-			_currentSkill.currentLevel = i-lastLvl-enchantLevels1-enchantLevels2-enchantLevels3-enchantLevels4;
-			for (n=first; n != null; n = n.getNextSibling())
+			_currentSkill.currentLevel = i - lastLvl - enchantLevels1 - enchantLevels2 - enchantLevels3 - enchantLevels4;
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("enchant5cond".equalsIgnoreCase(n.getNodeName()))
 				{
 					foundCond = true;
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Node msg = n.getAttributes().getNamedItem("msg");
-					if (condition != null && msg != null)
+					if ((condition != null) && (msg != null))
+					{
 						condition.setMessage(msg.getNodeValue());
-					_currentSkill.currentSkills.get(i).attach(condition,false);
+					}
+					_currentSkill.currentSkills.get(i).attach(condition, false);
 				}
 				else if ("enchant5for".equalsIgnoreCase(n.getNodeName()))
 				{
@@ -614,18 +708,20 @@ public class DocumentSkill extends DocumentBase
 				}
 			}
 			// If none found, the enchanted skill will take effects from maxLvL of norm skill
-			if(!foundCond || !foundFor)
+			if (!foundCond || !foundFor)
 			{
-				_currentSkill.currentLevel = lastLvl-1;
-				for (n=first; n != null; n = n.getNextSibling())
+				_currentSkill.currentLevel = lastLvl - 1;
+				for (n = first; n != null; n = n.getNextSibling())
 				{
 					if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
 					{
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Node msg = n.getAttributes().getNamedItem("msg");
-						if (condition != null && msg != null)
+						if ((condition != null) && (msg != null))
+						{
 							condition.setMessage(msg.getNodeValue());
-						_currentSkill.currentSkills.get(i).attach(condition,false);
+						}
+						_currentSkill.currentSkills.get(i).attach(condition, false);
 					}
 					else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
 					{
@@ -634,20 +730,22 @@ public class DocumentSkill extends DocumentBase
 				}
 			}
 		}
-		for (int i=lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4+enchantLevels5; i < lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4+enchantLevels5+enchantLevels6; i++)
+		for (int i = lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3 + enchantLevels4 + enchantLevels5; i < (lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3 + enchantLevels4 + enchantLevels5 + enchantLevels6); i++)
 		{
 			boolean foundCond = false, foundFor = false;
-			_currentSkill.currentLevel = i-lastLvl-enchantLevels1-enchantLevels2-enchantLevels3-enchantLevels4-enchantLevels5;
-			for (n=first; n != null; n = n.getNextSibling())
+			_currentSkill.currentLevel = i - lastLvl - enchantLevels1 - enchantLevels2 - enchantLevels3 - enchantLevels4 - enchantLevels5;
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("enchant6cond".equalsIgnoreCase(n.getNodeName()))
 				{
 					foundCond = true;
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Node msg = n.getAttributes().getNamedItem("msg");
-					if (condition != null && msg != null)
+					if ((condition != null) && (msg != null))
+					{
 						condition.setMessage(msg.getNodeValue());
-					_currentSkill.currentSkills.get(i).attach(condition,false);
+					}
+					_currentSkill.currentSkills.get(i).attach(condition, false);
 				}
 				else if ("enchant6for".equalsIgnoreCase(n.getNodeName()))
 				{
@@ -656,18 +754,20 @@ public class DocumentSkill extends DocumentBase
 				}
 			}
 			// If none found, the enchanted skill will take effects from maxLvL of norm skill
-			if(!foundCond || !foundFor)
+			if (!foundCond || !foundFor)
 			{
-				_currentSkill.currentLevel = lastLvl-1;
-				for (n=first; n != null; n = n.getNextSibling())
+				_currentSkill.currentLevel = lastLvl - 1;
+				for (n = first; n != null; n = n.getNextSibling())
 				{
 					if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
 					{
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Node msg = n.getAttributes().getNamedItem("msg");
-						if (condition != null && msg != null)
+						if ((condition != null) && (msg != null))
+						{
 							condition.setMessage(msg.getNodeValue());
-						_currentSkill.currentSkills.get(i).attach(condition,false);
+						}
+						_currentSkill.currentSkills.get(i).attach(condition, false);
 					}
 					else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
 					{
@@ -676,20 +776,22 @@ public class DocumentSkill extends DocumentBase
 				}
 			}
 		}
-		for (int i=lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4+enchantLevels5+enchantLevels6; i < lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4+enchantLevels5+enchantLevels6+enchantLevels7; i++)
+		for (int i = lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3 + enchantLevels4 + enchantLevels5 + enchantLevels6; i < (lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3 + enchantLevels4 + enchantLevels5 + enchantLevels6 + enchantLevels7); i++)
 		{
 			boolean foundCond = false, foundFor = false;
-			_currentSkill.currentLevel = i-lastLvl-enchantLevels1-enchantLevels2-enchantLevels3-enchantLevels4-enchantLevels5-enchantLevels6;
-			for (n=first; n != null; n = n.getNextSibling())
+			_currentSkill.currentLevel = i - lastLvl - enchantLevels1 - enchantLevels2 - enchantLevels3 - enchantLevels4 - enchantLevels5 - enchantLevels6;
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("enchant7cond".equalsIgnoreCase(n.getNodeName()))
 				{
 					foundCond = true;
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Node msg = n.getAttributes().getNamedItem("msg");
-					if (condition != null && msg != null)
+					if ((condition != null) && (msg != null))
+					{
 						condition.setMessage(msg.getNodeValue());
-					_currentSkill.currentSkills.get(i).attach(condition,false);
+					}
+					_currentSkill.currentSkills.get(i).attach(condition, false);
 				}
 				else if ("enchant7for".equalsIgnoreCase(n.getNodeName()))
 				{
@@ -698,18 +800,20 @@ public class DocumentSkill extends DocumentBase
 				}
 			}
 			// If none found, the enchanted skill will take effects from maxLvL of norm skill
-			if(!foundCond || !foundFor)
+			if (!foundCond || !foundFor)
 			{
-				_currentSkill.currentLevel = lastLvl-1;
-				for (n=first; n != null; n = n.getNextSibling())
+				_currentSkill.currentLevel = lastLvl - 1;
+				for (n = first; n != null; n = n.getNextSibling())
 				{
 					if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
 					{
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Node msg = n.getAttributes().getNamedItem("msg");
-						if (condition != null && msg != null)
+						if ((condition != null) && (msg != null))
+						{
 							condition.setMessage(msg.getNodeValue());
-						_currentSkill.currentSkills.get(i).attach(condition,false);
+						}
+						_currentSkill.currentSkills.get(i).attach(condition, false);
 					}
 					else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
 					{
@@ -718,20 +822,22 @@ public class DocumentSkill extends DocumentBase
 				}
 			}
 		}
-		for (int i=lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4+enchantLevels5+enchantLevels6+enchantLevels7; i < lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4+enchantLevels5+enchantLevels6+enchantLevels7+enchantLevels8; i++)
+		for (int i = lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3 + enchantLevels4 + enchantLevels5 + enchantLevels6 + enchantLevels7; i < (lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3 + enchantLevels4 + enchantLevels5 + enchantLevels6 + enchantLevels7 + enchantLevels8); i++)
 		{
 			boolean foundCond = false, foundFor = false;
-			_currentSkill.currentLevel = i-lastLvl-enchantLevels1-enchantLevels2-enchantLevels3-enchantLevels4-enchantLevels5-enchantLevels6-enchantLevels7;
-			for (n=first; n != null; n = n.getNextSibling())
+			_currentSkill.currentLevel = i - lastLvl - enchantLevels1 - enchantLevels2 - enchantLevels3 - enchantLevels4 - enchantLevels5 - enchantLevels6 - enchantLevels7;
+			for (n = first; n != null; n = n.getNextSibling())
 			{
 				if ("enchant8cond".equalsIgnoreCase(n.getNodeName()))
 				{
 					foundCond = true;
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Node msg = n.getAttributes().getNamedItem("msg");
-					if (condition != null && msg != null)
+					if ((condition != null) && (msg != null))
+					{
 						condition.setMessage(msg.getNodeValue());
-					_currentSkill.currentSkills.get(i).attach(condition,false);
+					}
+					_currentSkill.currentSkills.get(i).attach(condition, false);
 				}
 				else if ("enchant8for".equalsIgnoreCase(n.getNodeName()))
 				{
@@ -740,18 +846,20 @@ public class DocumentSkill extends DocumentBase
 				}
 			}
 			// If none found, the enchanted skill will take effects from maxLvL of norm skill
-			if(!foundCond || !foundFor)
+			if (!foundCond || !foundFor)
 			{
-				_currentSkill.currentLevel = lastLvl-1;
-				for (n=first; n != null; n = n.getNextSibling())
+				_currentSkill.currentLevel = lastLvl - 1;
+				for (n = first; n != null; n = n.getNextSibling())
 				{
 					if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
 					{
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Node msg = n.getAttributes().getNamedItem("msg");
-						if (condition != null && msg != null)
+						if ((condition != null) && (msg != null))
+						{
 							condition.setMessage(msg.getNodeValue());
-						_currentSkill.currentSkills.get(i).attach(condition,false);
+						}
+						_currentSkill.currentSkills.get(i).attach(condition, false);
 					}
 					else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
 					{
@@ -766,9 +874,9 @@ public class DocumentSkill extends DocumentBase
 	private void makeSkills()
 	{
 		int count = 0;
-		_currentSkill.currentSkills = new FastList<>(_currentSkill.sets.length+_currentSkill.enchsets1.length+_currentSkill.enchsets2.length+_currentSkill.enchsets3.length+_currentSkill.enchsets4.length+_currentSkill.enchsets5.length+_currentSkill.enchsets6.length+_currentSkill.enchsets7.length+_currentSkill.enchsets8.length);
+		_currentSkill.currentSkills = new FastList<>(_currentSkill.sets.length + _currentSkill.enchsets1.length + _currentSkill.enchsets2.length + _currentSkill.enchsets3.length + _currentSkill.enchsets4.length + _currentSkill.enchsets5.length + _currentSkill.enchsets6.length + _currentSkill.enchsets7.length + _currentSkill.enchsets8.length);
 		
-		for (int i=0; i < _currentSkill.sets.length; i++)
+		for (int i = 0; i < _currentSkill.sets.length; i++)
 		{
 			try
 			{
@@ -777,111 +885,111 @@ public class DocumentSkill extends DocumentBase
 			}
 			catch (Exception e)
 			{
-				_log.log(Level.SEVERE, "Skill id="+_currentSkill.sets[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.sets[i]).getDisplayId()+"level"+_currentSkill.sets[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.sets[i]).getLevel(), e);
+				_log.log(Level.SEVERE, "Skill id=" + _currentSkill.sets[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.sets[i]).getDisplayId() + "level" + _currentSkill.sets[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.sets[i]).getLevel(), e);
 			}
 		}
 		int _count = count;
-		for (int i=0; i < _currentSkill.enchsets1.length; i++)
+		for (int i = 0; i < _currentSkill.enchsets1.length; i++)
 		{
 			try
 			{
-				_currentSkill.currentSkills.add(_count+i, _currentSkill.enchsets1[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets1[i]));
+				_currentSkill.currentSkills.add(_count + i, _currentSkill.enchsets1[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets1[i]));
 				count++;
 			}
 			catch (Exception e)
 			{
-				_log.log(Level.SEVERE, "Skill id="+_currentSkill.enchsets1[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets1[i]).getDisplayId()+" level="+_currentSkill.enchsets1[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets1[i]).getLevel(), e);
+				_log.log(Level.SEVERE, "Skill id=" + _currentSkill.enchsets1[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets1[i]).getDisplayId() + " level=" + _currentSkill.enchsets1[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets1[i]).getLevel(), e);
 			}
 		}
 		_count = count;
-		for (int i=0; i < _currentSkill.enchsets2.length; i++)
+		for (int i = 0; i < _currentSkill.enchsets2.length; i++)
 		{
 			try
 			{
-				_currentSkill.currentSkills.add(_count+i, _currentSkill.enchsets2[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets2[i]));
+				_currentSkill.currentSkills.add(_count + i, _currentSkill.enchsets2[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets2[i]));
 				count++;
 			}
 			catch (Exception e)
 			{
-				_log.log(Level.SEVERE, "Skill id="+_currentSkill.enchsets2[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets2[i]).getDisplayId()+" level="+_currentSkill.enchsets2[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets2[i]).getLevel(), e);
+				_log.log(Level.SEVERE, "Skill id=" + _currentSkill.enchsets2[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets2[i]).getDisplayId() + " level=" + _currentSkill.enchsets2[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets2[i]).getLevel(), e);
 			}
 		}
 		_count = count;
-		for (int i=0; i < _currentSkill.enchsets3.length; i++)
+		for (int i = 0; i < _currentSkill.enchsets3.length; i++)
 		{
 			try
 			{
-				_currentSkill.currentSkills.add(_count+i, _currentSkill.enchsets3[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets3[i]));
+				_currentSkill.currentSkills.add(_count + i, _currentSkill.enchsets3[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets3[i]));
 				count++;
 			}
 			catch (Exception e)
 			{
-				_log.log(Level.SEVERE, "Skill id="+_currentSkill.enchsets3[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets3[i]).getDisplayId()+" level="+_currentSkill.enchsets3[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets3[i]).getLevel(), e);
+				_log.log(Level.SEVERE, "Skill id=" + _currentSkill.enchsets3[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets3[i]).getDisplayId() + " level=" + _currentSkill.enchsets3[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets3[i]).getLevel(), e);
 			}
 		}
 		_count = count;
-		for (int i=0; i < _currentSkill.enchsets4.length; i++)
+		for (int i = 0; i < _currentSkill.enchsets4.length; i++)
 		{
 			try
 			{
-				_currentSkill.currentSkills.add(_count+i, _currentSkill.enchsets4[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets4[i]));
+				_currentSkill.currentSkills.add(_count + i, _currentSkill.enchsets4[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets4[i]));
 				count++;
 			}
 			catch (Exception e)
 			{
-				_log.log(Level.SEVERE, "Skill id="+_currentSkill.enchsets4[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets4[i]).getDisplayId()+" level="+_currentSkill.enchsets4[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets4[i]).getLevel(), e);
+				_log.log(Level.SEVERE, "Skill id=" + _currentSkill.enchsets4[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets4[i]).getDisplayId() + " level=" + _currentSkill.enchsets4[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets4[i]).getLevel(), e);
 			}
 		}
 		_count = count;
-		for (int i=0; i < _currentSkill.enchsets5.length; i++)
+		for (int i = 0; i < _currentSkill.enchsets5.length; i++)
 		{
 			try
 			{
-				_currentSkill.currentSkills.add(_count+i, _currentSkill.enchsets5[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets5[i]));
+				_currentSkill.currentSkills.add(_count + i, _currentSkill.enchsets5[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets5[i]));
 				count++;
 			}
 			catch (Exception e)
 			{
-				_log.log(Level.SEVERE, "Skill id="+_currentSkill.enchsets5[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets5[i]).getDisplayId()+" level="+_currentSkill.enchsets5[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets5[i]).getLevel(), e);
+				_log.log(Level.SEVERE, "Skill id=" + _currentSkill.enchsets5[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets5[i]).getDisplayId() + " level=" + _currentSkill.enchsets5[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets5[i]).getLevel(), e);
 			}
 		}
 		_count = count;
-		for (int i=0; i < _currentSkill.enchsets6.length; i++)
+		for (int i = 0; i < _currentSkill.enchsets6.length; i++)
 		{
 			try
 			{
-				_currentSkill.currentSkills.add(_count+i, _currentSkill.enchsets6[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets6[i]));
+				_currentSkill.currentSkills.add(_count + i, _currentSkill.enchsets6[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets6[i]));
 				count++;
 			}
 			catch (Exception e)
 			{
-				_log.log(Level.SEVERE, "Skill id="+_currentSkill.enchsets6[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets6[i]).getDisplayId()+" level="+_currentSkill.enchsets6[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets6[i]).getLevel(), e);
+				_log.log(Level.SEVERE, "Skill id=" + _currentSkill.enchsets6[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets6[i]).getDisplayId() + " level=" + _currentSkill.enchsets6[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets6[i]).getLevel(), e);
 			}
 		}
 		_count = count;
-		for (int i=0; i < _currentSkill.enchsets7.length; i++)
+		for (int i = 0; i < _currentSkill.enchsets7.length; i++)
 		{
 			try
 			{
-				_currentSkill.currentSkills.add(_count+i, _currentSkill.enchsets7[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets7[i]));
+				_currentSkill.currentSkills.add(_count + i, _currentSkill.enchsets7[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets7[i]));
 				count++;
 			}
 			catch (Exception e)
 			{
-				_log.log(Level.SEVERE, "Skill id="+_currentSkill.enchsets7[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets7[i]).getDisplayId()+" level="+_currentSkill.enchsets7[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets7[i]).getLevel(), e);
+				_log.log(Level.SEVERE, "Skill id=" + _currentSkill.enchsets7[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets7[i]).getDisplayId() + " level=" + _currentSkill.enchsets7[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets7[i]).getLevel(), e);
 			}
 		}
 		_count = count;
-		for (int i=0; i < _currentSkill.enchsets8.length; i++)
+		for (int i = 0; i < _currentSkill.enchsets8.length; i++)
 		{
 			try
 			{
-				_currentSkill.currentSkills.add(_count+i, _currentSkill.enchsets8[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets8[i]));
+				_currentSkill.currentSkills.add(_count + i, _currentSkill.enchsets8[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets8[i]));
 				count++;
 			}
 			catch (Exception e)
 			{
-				_log.log(Level.SEVERE, "Skill id="+_currentSkill.enchsets8[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets8[i]).getDisplayId()+" level="+_currentSkill.enchsets8[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets8[i]).getLevel(), e);
+				_log.log(Level.SEVERE, "Skill id=" + _currentSkill.enchsets8[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets8[i]).getDisplayId() + " level=" + _currentSkill.enchsets8[i].getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY).makeSkill(_currentSkill.enchsets8[i]).getLevel(), e);
 			}
 		}
 	}

+ 3 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/geoeditorcon/GeoEditorListener.java

@@ -28,7 +28,7 @@ public class GeoEditorListener extends Thread
 	private static GeoEditorListener _instance;
 	private static final int PORT = 9011;
 	private static Logger _log = Logger.getLogger(GeoEditorListener.class.getName());
-	private ServerSocket _serverSocket;
+	private final ServerSocket _serverSocket;
 	private GeoEditorThread _geoEditor;
 	
 	public static GeoEditorListener getInstance()
@@ -65,7 +65,7 @@ public class GeoEditorListener extends Thread
 	
 	public String getStatus()
 	{
-		if (_geoEditor != null && _geoEditor.isWorking())
+		if ((_geoEditor != null) && _geoEditor.isWorking())
 		{
 			return "Geoeditor connected.";
 		}
@@ -79,7 +79,7 @@ public class GeoEditorListener extends Thread
 		{
 			while (!isInterrupted())
 			{
-				if (_geoEditor != null && _geoEditor.isWorking())
+				if ((_geoEditor != null) && _geoEditor.isWorking())
 				{
 					_log.warning("Geoeditor already connected!");
 					connection.close();

+ 35 - 10
L2J_Server_BETA/java/com/l2jserver/gameserver/geoeditorcon/GeoEditorThread.java

@@ -35,15 +35,14 @@ public class GeoEditorThread extends Thread
 	
 	private int _mode = 0; // 0 - don't send coords, 1 - send each
 	
-	// validateposition from client, 2 - send in
-	// intervals of _sendDelay ms.
+	// validateposition from client, 2 - send in intervals of _sendDelay ms.
 	private int _sendDelay = 1000; // default - once in second
 	
-	private Socket _geSocket;
+	private final Socket _geSocket;
 	
 	private OutputStream _out;
 	
-	private FastList<L2PcInstance> _gms;
+	private final FastList<L2PcInstance> _gms;
 	
 	public GeoEditorThread(Socket ge)
 	{
@@ -76,15 +75,23 @@ public class GeoEditorThread extends Thread
 			while (_working)
 			{
 				if (!isConnected())
+				{
 					_working = false;
+				}
 				
-				if (_mode == 2 && timer > _sendDelay)
+				if ((_mode == 2) && (timer > _sendDelay))
 				{
 					for (L2PcInstance gm : _gms)
+					{
 						if (!gm.getClient().getConnection().isClosed())
+						{
 							sendGmPosition(gm);
+						}
 						else
+						{
 							_gms.remove(gm);
+						}
+					}
 					timer = 0;
 				}
 				
@@ -92,7 +99,9 @@ public class GeoEditorThread extends Thread
 				{
 					sleep(100);
 					if (_mode == 2)
+					{
 						timer += 100;
+					}
 				}
 				catch (Exception e)
 				{
@@ -119,7 +128,9 @@ public class GeoEditorThread extends Thread
 	public void sendGmPosition(int gx, int gy, short z)
 	{
 		if (!isConnected())
+		{
 			return;
+		}
 		try
 		{
 			synchronized (_out)
@@ -158,7 +169,9 @@ public class GeoEditorThread extends Thread
 	public void sendPing()
 	{
 		if (!isConnected())
+		{
 			return;
+		}
 		try
 		{
 			synchronized (_out)
@@ -190,15 +203,15 @@ public class GeoEditorThread extends Thread
 	private void writeD(int value) throws IOException
 	{
 		_out.write(value & 0xff);
-		_out.write(value >> 8 & 0xff);
-		_out.write(value >> 16 & 0xff);
-		_out.write(value >> 24 & 0xff);
+		_out.write((value >> 8) & 0xff);
+		_out.write((value >> 16) & 0xff);
+		_out.write((value >> 24) & 0xff);
 	}
 	
 	private void writeH(int value) throws IOException
 	{
 		_out.write(value & 0xff);
-		_out.write(value >> 8 & 0xff);
+		_out.write((value >> 8) & 0xff);
 	}
 	
 	private void writeC(int value) throws IOException
@@ -214,29 +227,41 @@ public class GeoEditorThread extends Thread
 	public void setTimer(int value)
 	{
 		if (value < 500)
+		{
 			_sendDelay = 500; // maximum - 2 times per second!
+		}
 		else if (value > 60000)
+		{
 			_sendDelay = 60000; // Minimum - 1 time per minute.
+		}
 		else
+		{
 			_sendDelay = value;
+		}
 	}
 	
 	public void addGM(L2PcInstance gm)
 	{
 		if (!_gms.contains(gm))
+		{
 			_gms.add(gm);
+		}
 	}
 	
 	public void removeGM(L2PcInstance gm)
 	{
 		if (_gms.contains(gm))
+		{
 			_gms.remove(gm);
+		}
 	}
 	
 	public boolean isSend(L2PcInstance gm)
 	{
-		if (_mode == 1 && _gms.contains(gm))
+		if ((_mode == 1) && _gms.contains(gm))
+		{
 			return true;
+		}
 		return false;
 	}
 	

+ 0 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/handler/ItemHandler.java

@@ -88,7 +88,6 @@ public class ItemHandler implements IHandler<IItemHandler, L2EtcItem>
 		return SingletonHolder._instance;
 	}
 	
-	
 	private static class SingletonHolder
 	{
 		protected static final ItemHandler _instance = new ItemHandler();

+ 2 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/idfactory/IdFactory.java

@@ -14,8 +14,6 @@
  */
 package com.l2jserver.gameserver.idfactory;
 
-import gnu.trove.list.array.TIntArrayList;
-
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -27,6 +25,8 @@ import java.util.logging.Logger;
 import com.l2jserver.Config;
 import com.l2jserver.L2DatabaseFactory;
 
+import gnu.trove.list.array.TIntArrayList;
+
 /**
  * This class ...
  * @version $Revision: 1.3.2.1.2.7 $ $Date: 2005/04/11 10:06:12 $

+ 39 - 15
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/AirShipManager.java

@@ -43,9 +43,9 @@ public class AirShipManager
 	private static final String UPDATE_DB = "UPDATE airships SET fuel=? WHERE owner_id=?";
 	
 	private L2CharTemplate _airShipTemplate = null;
-	private Map<Integer, StatsSet> _airShipsInfo = new HashMap<>();
-	private Map<Integer, L2AirShipInstance> _airShips = new HashMap<>();
-	private Map<Integer, AirShipTeleportList> _teleports = new HashMap<>();
+	private final Map<Integer, StatsSet> _airShipsInfo = new HashMap<>();
+	private final Map<Integer, L2AirShipInstance> _airShips = new HashMap<>();
+	private final Map<Integer, AirShipTeleportList> _teleports = new HashMap<>();
 	
 	protected AirShipManager()
 	{
@@ -99,7 +99,7 @@ public class AirShipManager
 	
 	public L2AirShipInstance getNewAirShip(int x, int y, int z, int heading)
 	{
-		final L2AirShipInstance	airShip = new L2AirShipInstance(IdFactory.getInstance().getNextId(), _airShipTemplate);
+		final L2AirShipInstance airShip = new L2AirShipInstance(IdFactory.getInstance().getNextId(), _airShipTemplate);
 		
 		airShip.setHeading(heading);
 		airShip.setXYZInvisible(x, y, z);
@@ -113,7 +113,9 @@ public class AirShipManager
 	{
 		final StatsSet info = _airShipsInfo.get(ownerId);
 		if (info == null)
+		{
 			return null;
+		}
 		
 		final L2AirShipInstance airShip;
 		if (_airShips.containsKey(ownerId))
@@ -145,7 +147,9 @@ public class AirShipManager
 			storeInDb(ship.getOwnerId());
 			final StatsSet info = _airShipsInfo.get(ship.getOwnerId());
 			if (info != null)
+			{
 				info.set("fuel", ship.getFuel());
+			}
 		}
 	}
 	
@@ -172,11 +176,11 @@ public class AirShipManager
 			}
 			catch (SQLException e)
 			{
-				_log.log(Level.WARNING, getClass().getSimpleName()+": Could not add new airship license: " + e.getMessage(), e);
+				_log.log(Level.WARNING, getClass().getSimpleName() + ": Could not add new airship license: " + e.getMessage(), e);
 			}
 			catch (Exception e)
 			{
-				_log.log(Level.WARNING, getClass().getSimpleName()+": Error while initializing: " + e.getMessage(), e);
+				_log.log(Level.WARNING, getClass().getSimpleName() + ": Error while initializing: " + e.getMessage(), e);
 			}
 		}
 	}
@@ -184,8 +188,10 @@ public class AirShipManager
 	public boolean hasAirShip(int ownerId)
 	{
 		final L2AirShipInstance ship = _airShips.get(ownerId);
-		if (ship == null || !(ship.isVisible() || ship.isTeleporting()))
+		if ((ship == null) || !(ship.isVisible() || ship.isTeleporting()))
+		{
 			return false;
+		}
 		
 		return true;
 	}
@@ -193,23 +199,31 @@ public class AirShipManager
 	public void registerAirShipTeleportList(int dockId, int locationId, VehiclePathPoint[][] tp, int[] fuelConsumption)
 	{
 		if (tp.length != fuelConsumption.length)
+		{
 			return;
+		}
 		
 		_teleports.put(dockId, new AirShipTeleportList(locationId, fuelConsumption, tp));
 	}
 	
 	public void sendAirShipTeleportList(L2PcInstance player)
 	{
-		if (player == null || !player.isInAirShip())
+		if ((player == null) || !player.isInAirShip())
+		{
 			return;
+		}
 		
 		final L2AirShipInstance ship = player.getAirShip();
 		if (!ship.isCaptain(player) || !ship.isInDock() || ship.isMoving())
+		{
 			return;
+		}
 		
 		int dockId = ship.getDockId();
 		if (!_teleports.containsKey(dockId))
+		{
 			return;
+		}
 		
 		final AirShipTeleportList all = _teleports.get(dockId);
 		player.sendPacket(new ExAirShipTeleportList(all.location, all.routes, all.fuel));
@@ -219,10 +233,14 @@ public class AirShipManager
 	{
 		final AirShipTeleportList all = _teleports.get(dockId);
 		if (all == null)
+		{
 			return null;
+		}
 		
-		if (index < -1 || index >= all.routes.length)
+		if ((index < -1) || (index >= all.routes.length))
+		{
 			return null;
+		}
 		
 		return all.routes[index + 1];
 	}
@@ -231,10 +249,14 @@ public class AirShipManager
 	{
 		final AirShipTeleportList all = _teleports.get(dockId);
 		if (all == null)
+		{
 			return 0;
+		}
 		
-		if (index < -1 || index >= all.fuel.length)
+		if ((index < -1) || (index >= all.fuel.length))
+		{
 			return 0;
+		}
 		
 		return all.fuel[index + 1];
 	}
@@ -255,20 +277,22 @@ public class AirShipManager
 		}
 		catch (SQLException e)
 		{
-			_log.log(Level.WARNING, getClass().getSimpleName()+": Could not load airships table: " + e.getMessage(), e);
+			_log.log(Level.WARNING, getClass().getSimpleName() + ": Could not load airships table: " + e.getMessage(), e);
 		}
 		catch (Exception e)
 		{
-			_log.log(Level.WARNING, getClass().getSimpleName()+": Error while initializing: " + e.getMessage(), e);
+			_log.log(Level.WARNING, getClass().getSimpleName() + ": Error while initializing: " + e.getMessage(), e);
 		}
-		_log.info(getClass().getSimpleName()+": Loaded " + _airShipsInfo.size() + " private airships");
+		_log.info(getClass().getSimpleName() + ": Loaded " + _airShipsInfo.size() + " private airships");
 	}
 	
 	private void storeInDb(int ownerId)
 	{
 		StatsSet info = _airShipsInfo.get(ownerId);
 		if (info == null)
+		{
 			return;
+		}
 		
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
 			PreparedStatement ps = con.prepareStatement(UPDATE_DB))
@@ -279,11 +303,11 @@ public class AirShipManager
 		}
 		catch (SQLException e)
 		{
-			_log.log(Level.WARNING, getClass().getSimpleName()+": Could not update airships table: " + e.getMessage(), e);
+			_log.log(Level.WARNING, getClass().getSimpleName() + ": Could not update airships table: " + e.getMessage(), e);
 		}
 		catch (Exception e)
 		{
-			_log.log(Level.WARNING, getClass().getSimpleName()+": Error while save: " + e.getMessage(), e);
+			_log.log(Level.WARNING, getClass().getSimpleName() + ": Error while save: " + e.getMessage(), e);
 		}
 	}
 	

+ 44 - 8
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/AntiFeedManager.java

@@ -58,29 +58,41 @@ public class AntiFeedManager
 	public final boolean check(L2Character attacker, L2Character target)
 	{
 		if (!Config.L2JMOD_ANTIFEED_ENABLE)
+		{
 			return true;
+		}
 		
 		if (target == null)
+		{
 			return false;
+		}
 		
 		final L2PcInstance targetPlayer = target.getActingPlayer();
 		if (targetPlayer == null)
+		{
 			return false;
+		}
 		
-		if (Config.L2JMOD_ANTIFEED_INTERVAL > 0 && _lastDeathTimes.containsKey(targetPlayer.getObjectId()))
+		if ((Config.L2JMOD_ANTIFEED_INTERVAL > 0) && _lastDeathTimes.containsKey(targetPlayer.getObjectId()))
+		{
 			return (System.currentTimeMillis() - _lastDeathTimes.get(targetPlayer.getObjectId())) > Config.L2JMOD_ANTIFEED_INTERVAL;
+		}
 		
-		if (Config.L2JMOD_ANTIFEED_DUALBOX && attacker != null)
+		if (Config.L2JMOD_ANTIFEED_DUALBOX && (attacker != null))
 		{
 			final L2PcInstance attackerPlayer = attacker.getActingPlayer();
 			if (attackerPlayer == null)
+			{
 				return false;
+			}
 			
 			final L2GameClient targetClient = targetPlayer.getClient();
 			final L2GameClient attackerClient = attackerPlayer.getClient();
-			if (targetClient == null || attackerClient == null || targetClient.isDetached() || attackerClient.isDetached())
+			if ((targetClient == null) || (attackerClient == null) || targetClient.isDetached() || attackerClient.isDetached())
+			{
 				// unable to check ip address
 				return !Config.L2JMOD_ANTIFEED_DISCONNECTED_AS_DUALBOX;
+			}
 			
 			return !targetClient.getConnectionAddress().equals(attackerClient.getConnectionAddress());
 		}
@@ -103,7 +115,9 @@ public class AntiFeedManager
 	public final void registerEvent(int eventId)
 	{
 		if (!_eventIPs.containsKey(eventId))
+		{
 			_eventIPs.put(eventId, new FastMap<Integer, Connections>());
+		}
 	}
 	
 	/**
@@ -128,12 +142,16 @@ public class AntiFeedManager
 	public final boolean tryAddClient(int eventId, L2GameClient client, int max)
 	{
 		if (client == null)
+		{
 			return false; // unable to determine IP address
-			
+		}
+		
 		final Map<Integer, Connections> event = _eventIPs.get(eventId);
 		if (event == null)
+		{
 			return false; // no such event registered
-			
+		}
+		
 		final Integer addrHash = Integer.valueOf(client.getConnectionAddress().hashCode());
 		int limit = max;
 		if (Config.L2JMOD_DUALBOX_CHECK_WHITELIST.containsKey(addrHash))
@@ -165,21 +183,29 @@ public class AntiFeedManager
 	{
 		final L2GameClient client = player.getClient();
 		if (client == null)
+		{
 			return false; // unable to determine IP address
-			
+		}
+		
 		final Map<Integer, Connections> event = _eventIPs.get(eventId);
 		if (event == null)
+		{
 			return false; // no such event registered
-			
+		}
+		
 		final Integer addrHash = Integer.valueOf(client.getConnectionAddress().hashCode());
 		Connections conns = event.get(addrHash);
 		if (conns == null)
+		{
 			return false; // address not registered
-			
+		}
+		
 		synchronized (event)
 		{
 			if (conns.testAndDecrement())
+			{
 				event.remove(addrHash);
+			}
 		}
 		
 		return true;
@@ -192,7 +218,9 @@ public class AntiFeedManager
 	public final void onDisconnect(L2GameClient client)
 	{
 		if (client == null)
+		{
 			return;
+		}
 		
 		final Integer addrHash = Integer.valueOf(client.getConnectionAddress().hashCode());
 		_eventIPs.executeForEachValue(new DisconnectProcedure(addrHash));
@@ -206,7 +234,9 @@ public class AntiFeedManager
 	{
 		final Map<Integer, Connections> event = _eventIPs.get(eventId);
 		if (event != null)
+		{
 			event.clear();
+		}
 	}
 	
 	/**
@@ -227,7 +257,9 @@ public class AntiFeedManager
 	public final int getLimit(L2GameClient client, int max)
 	{
 		if (client == null)
+		{
 			return max;
+		}
 		
 		final Integer addrHash = Integer.valueOf(client.getConnectionAddress().hashCode());
 		int limit = max;
@@ -263,7 +295,9 @@ public class AntiFeedManager
 		public final synchronized boolean testAndDecrement()
 		{
 			if (_num > 0)
+			{
 				_num--;
+			}
 			
 			return _num == 0;
 		}
@@ -287,7 +321,9 @@ public class AntiFeedManager
 				synchronized (event)
 				{
 					if (conns.testAndDecrement())
+					{
 						event.remove(_addrHash);
+					}
 				}
 			}
 			return true;

+ 15 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/AuctionManager.java

@@ -25,10 +25,13 @@ import java.util.logging.Logger;
 import com.l2jserver.L2DatabaseFactory;
 import com.l2jserver.gameserver.model.entity.Auction;
 
+/**
+ * Zoey76: TODO: Rewrite it and unharcode it.
+ */
 public class AuctionManager
 {
 	protected static final Logger _log = Logger.getLogger(AuctionManager.class.getName());
-	private List<Auction> _auctions = new ArrayList<>();
+	private final List<Auction> _auctions = new ArrayList<>();
 	
 	private static final String[] ITEM_INIT_DATA =
 	{
@@ -72,11 +75,13 @@ public class AuctionManager
 		"(61, 0, 'NPC', 'NPC Clan', 'ClanHall', 61, 0, 'Titan Hall', 1, 50000000, 0, 1164841200000)"
 	};
 	
+	// @formatter:off
 	private static final int[] ItemInitDataId =
 	{
 		22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 36, 37, 38, 39, 40, 41, 42,
 		43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61
 	};
+	// @formatter:on
 	
 	public static final AuctionManager getInstance()
 	{
@@ -118,7 +123,9 @@ public class AuctionManager
 	{
 		int index = getAuctionIndex(auctionId);
 		if (index >= 0)
+		{
 			return getAuctions().get(index);
+		}
 		return null;
 	}
 	
@@ -128,8 +135,10 @@ public class AuctionManager
 		for (int i = 0; i < getAuctions().size(); i++)
 		{
 			auction = getAuctions().get(i);
-			if (auction != null && auction.getId() == auctionId)
+			if ((auction != null) && (auction.getId() == auctionId))
+			{
 				return i;
+			}
 		}
 		return -1;
 	}
@@ -140,7 +149,7 @@ public class AuctionManager
 	}
 	
 	/**
-	 * Init Clan NPC aution 
+	 * Init Clan NPC aution
 	 * @param id
 	 */
 	public void initNPC(int id)
@@ -149,9 +158,11 @@ public class AuctionManager
 		for (i = 0; i < ItemInitDataId.length; i++)
 		{
 			if (ItemInitDataId[i] == id)
+			{
 				break;
+			}
 		}
-		if (i >= ItemInitDataId.length || ItemInitDataId[i] != id)
+		if ((i >= ItemInitDataId.length) || (ItemInitDataId[i] != id))
 		{
 			_log.warning(getClass().getSimpleName() + ": Clan Hall auction not found for Id :" + id);
 			return;

+ 23 - 14
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/BoatManager.java

@@ -14,8 +14,6 @@
  */
 package com.l2jserver.gameserver.instancemanager;
 
-import gnu.trove.procedure.TObjectProcedure;
-
 import java.util.Map;
 
 import javolution.util.FastMap;
@@ -30,10 +28,12 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.templates.L2CharTemplate;
 import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
 
+import gnu.trove.procedure.TObjectProcedure;
+
 public class BoatManager
 {
-	private Map<Integer, L2BoatInstance> _boats = new FastMap<>();
-	private boolean[] _docksBusy = new boolean[3];
+	private final Map<Integer, L2BoatInstance> _boats = new FastMap<>();
+	private final boolean[] _docksBusy = new boolean[3];
 	
 	public static final int TALKING_ISLAND = 1;
 	public static final int GLUDIN_HARBOR = 2;
@@ -47,13 +47,17 @@ public class BoatManager
 	protected BoatManager()
 	{
 		for (int i = 0; i < _docksBusy.length; i++)
+		{
 			_docksBusy[i] = false;
+		}
 	}
 	
 	public L2BoatInstance getNewBoat(int boatId, int x, int y, int z, int heading)
 	{
 		if (!Config.ALLOW_BOAT)
+		{
 			return null;
+		}
 		
 		StatsSet npcDat = new StatsSet();
 		npcDat.set("npcId", boatId);
@@ -128,7 +132,8 @@ public class BoatManager
 			_docksBusy[h] = value;
 		}
 		catch (ArrayIndexOutOfBoundsException e)
-		{}
+		{
+		}
 	}
 	
 	/**
@@ -150,9 +155,9 @@ public class BoatManager
 	
 	/**
 	 * Broadcast one packet in both path points
-	 * @param point1 
-	 * @param point2 
-	 * @param packet 
+	 * @param point1
+	 * @param point2
+	 * @param packet
 	 */
 	public void broadcastPacket(VehiclePathPoint point1, VehiclePathPoint point2, L2GameServerPacket packet)
 	{
@@ -162,9 +167,9 @@ public class BoatManager
 	
 	/**
 	 * Broadcast several packets in both path points
-	 * @param point1 
-	 * @param point2 
-	 * @param packets 
+	 * @param point1
+	 * @param point2
+	 * @param packets
 	 */
 	public void broadcastPackets(VehiclePathPoint point1, VehiclePathPoint point2, L2GameServerPacket... packets)
 	{
@@ -176,7 +181,7 @@ public class BoatManager
 		VehiclePathPoint _point1, _point2;
 		L2GameServerPacket[] _packets;
 		
-		protected ForEachPlayerBroadcastPackets(VehiclePathPoint point1, VehiclePathPoint point2, L2GameServerPacket ... packets)
+		protected ForEachPlayerBroadcastPackets(VehiclePathPoint point1, VehiclePathPoint point2, L2GameServerPacket... packets)
 		{
 			_point1 = point1;
 			_point2 = point2;
@@ -190,19 +195,23 @@ public class BoatManager
 			{
 				double dx = (double) player.getX() - _point1.x;
 				double dy = (double) player.getY() - _point1.y;
-				if (Math.sqrt(dx * dx + dy * dy) < Config.BOAT_BROADCAST_RADIUS)
+				if (Math.sqrt((dx * dx) + (dy * dy)) < Config.BOAT_BROADCAST_RADIUS)
 				{
 					for (L2GameServerPacket p : _packets)
+					{
 						player.sendPacket(p);
+					}
 				}
 				else
 				{
 					dx = (double) player.getX() - _point2.x;
 					dy = (double) player.getY() - _point2.y;
-					if (Math.sqrt(dx * dx + dy * dy) < Config.BOAT_BROADCAST_RADIUS)
+					if (Math.sqrt((dx * dx) + (dy * dy)) < Config.BOAT_BROADCAST_RADIUS)
 					{
 						for (L2GameServerPacket p : _packets)
+						{
 							player.sendPacket(p);
+						}
 					}
 				}
 			}

+ 48 - 21
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/CHSiegeManager.java

@@ -42,7 +42,7 @@ public final class CHSiegeManager
 	private static final Logger _log = Logger.getLogger(CHSiegeManager.class.getName());
 	private static final String SQL_LOAD_HALLS = "SELECT * FROM siegable_clanhall";
 	
-	private FastMap<Integer, SiegableHall> _siegableHalls = new FastMap<>();
+	private final FastMap<Integer, SiegableHall> _siegableHalls = new FastMap<>();
 	
 	protected CHSiegeManager()
 	{
@@ -58,7 +58,7 @@ public final class CHSiegeManager
 			
 			_siegableHalls.clear();
 			
-			while(rs.next())
+			while (rs.next())
 			{
 				final int id = rs.getInt("clanHallId");
 				
@@ -80,7 +80,7 @@ public final class CHSiegeManager
 			rs.close();
 			statement.close();
 		}
-		catch(Exception e)
+		catch (Exception e)
 		{
 			_log.warning("CHSiegeManager: Could not load siegable clan halls!:");
 		}
@@ -91,7 +91,6 @@ public final class CHSiegeManager
 		return _siegableHalls;
 	}
 	
-	
 	public SiegableHall getSiegableHall(int clanHall)
 	{
 		return getConquerableHalls().get(clanHall);
@@ -109,8 +108,10 @@ public final class CHSiegeManager
 		for (Map.Entry<Integer, SiegableHall> ch : _siegableHalls.entrySet())
 		{
 			zone = ch.getValue().getZone();
-			if (zone != null && zone.getDistanceToZone(x, y) < maxDist)
+			if ((zone != null) && (zone.getDistanceToZone(x, y) < maxDist))
+			{
 				return ch.getValue();
+			}
 		}
 		return null;
 	}
@@ -118,59 +119,85 @@ public final class CHSiegeManager
 	public final ClanHallSiegeEngine getSiege(L2Character character)
 	{
 		SiegableHall hall = getNearbyClanHall(character);
-		if(hall == null)
+		if (hall == null)
+		{
 			return null;
+		}
 		return hall.getSiege();
 	}
 	
 	public final void registerClan(L2Clan clan, SiegableHall hall, L2PcInstance player)
 	{
-		if(clan.getLevel() < Config.CHS_CLAN_MINLEVEL)
-			player.sendMessage("Only clans of level "+Config.CHS_CLAN_MINLEVEL+" or higher may register for a castle siege");
-		else if(hall.isWaitingBattle())
+		if (clan.getLevel() < Config.CHS_CLAN_MINLEVEL)
+		{
+			player.sendMessage("Only clans of level " + Config.CHS_CLAN_MINLEVEL + " or higher may register for a castle siege");
+		}
+		else if (hall.isWaitingBattle())
 		{
 			SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.DEADLINE_FOR_SIEGE_S1_PASSED);
 			sm.addString(hall.getName());
 			player.sendPacket(sm);
 		}
-		else if(hall.isInSiege())
+		else if (hall.isInSiege())
+		{
 			player.sendPacket(SystemMessageId.NOT_SIEGE_REGISTRATION_TIME2);
-		else if(hall.getOwnerId() == clan.getClanId())
+		}
+		else if (hall.getOwnerId() == clan.getClanId())
+		{
 			player.sendPacket(SystemMessageId.CLAN_THAT_OWNS_CASTLE_IS_AUTOMATICALLY_REGISTERED_DEFENDING);
-		else if(clan.getCastleId() != 0 || clan.getHideoutId() != 0)
+		}
+		else if ((clan.getCastleId() != 0) || (clan.getHideoutId() != 0))
+		{
 			player.sendPacket(SystemMessageId.CLAN_THAT_OWNS_CASTLE_CANNOT_PARTICIPATE_OTHER_SIEGE);
-		else if(hall.getSiege().checkIsAttacker(clan))
+		}
+		else if (hall.getSiege().checkIsAttacker(clan))
+		{
 			player.sendPacket(SystemMessageId.ALREADY_REQUESTED_SIEGE_BATTLE);
-		else if(isClanParticipating(clan))
+		}
+		else if (isClanParticipating(clan))
+		{
 			player.sendPacket(SystemMessageId.APPLICATION_DENIED_BECAUSE_ALREADY_SUBMITTED_A_REQUEST_FOR_ANOTHER_SIEGE_BATTLE);
-		else if(hall.getSiege().getAttackers().size() >= Config.CHS_MAX_ATTACKERS)
+		}
+		else if (hall.getSiege().getAttackers().size() >= Config.CHS_MAX_ATTACKERS)
+		{
 			player.sendPacket(SystemMessageId.ATTACKER_SIDE_FULL);
+		}
 		else
+		{
 			hall.addAttacker(clan);
+		}
 	}
 	
 	public final void unRegisterClan(L2Clan clan, SiegableHall hall)
 	{
-		if(!hall.isRegistering())
+		if (!hall.isRegistering())
+		{
 			return;
+		}
 		hall.removeAttacker(clan);
 	}
 	
 	public final boolean isClanParticipating(L2Clan clan)
 	{
-		for(SiegableHall hall : getConquerableHalls().values())
-			if(hall.getSiege() != null && hall.getSiege().checkIsAttacker(clan))
+		for (SiegableHall hall : getConquerableHalls().values())
+		{
+			if ((hall.getSiege() != null) && hall.getSiege().checkIsAttacker(clan))
+			{
 				return true;
+			}
+		}
 		return false;
 	}
 	
 	public final void onServerShutDown()
 	{
-		for(SiegableHall hall : getConquerableHalls().values())
+		for (SiegableHall hall : getConquerableHalls().values())
 		{
-			//Rainbow springs has his own attackers table
-			if(hall.getId() == 62 || hall.getSiege() == null)
+			// Rainbow springs has his own attackers table
+			if ((hall.getId() == 62) || (hall.getSiege() == null))
+			{
 				continue;
+			}
 			
 			hall.getSiege().saveAttackers();
 		}

+ 45 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/CastleManager.java

@@ -44,12 +44,25 @@ public class CastleManager implements InstanceListManager
 	
 	private List<Castle> _castles;
 	
-	private static final int _castleCirclets[] = { 0, 6838, 6835, 6839, 6837, 6840, 6834, 6836, 8182, 8183 };
+	private static final int _castleCirclets[] =
+	{
+		0,
+		6838,
+		6835,
+		6839,
+		6837,
+		6840,
+		6834,
+		6836,
+		8182,
+		8183
+	};
 	
 	public final int findNearestCastleIndex(L2Object obj)
 	{
 		return findNearestCastleIndex(obj, Long.MAX_VALUE);
 	}
+	
 	public final int findNearestCastleIndex(L2Object obj, long maxDistance)
 	{
 		int index = getCastleIndex(obj);
@@ -61,7 +74,9 @@ public class CastleManager implements InstanceListManager
 			{
 				castle = getCastles().get(i);
 				if (castle == null)
+				{
 					continue;
+				}
 				distance = castle.getDistance(obj);
 				if (maxDistance > distance)
 				{
@@ -78,7 +93,9 @@ public class CastleManager implements InstanceListManager
 		for (Castle temp : getCastles())
 		{
 			if (temp.getCastleId() == castleId)
+			{
 				return temp;
+			}
 		}
 		return null;
 	}
@@ -88,7 +105,9 @@ public class CastleManager implements InstanceListManager
 		for (Castle temp : getCastles())
 		{
 			if (temp.getOwnerId() == clan.getClanId())
+			{
 				return temp;
+			}
 		}
 		return null;
 	}
@@ -98,7 +117,9 @@ public class CastleManager implements InstanceListManager
 		for (Castle temp : getCastles())
 		{
 			if (temp.getName().equalsIgnoreCase(name.trim()))
+			{
 				return temp;
+			}
 		}
 		return null;
 	}
@@ -108,7 +129,9 @@ public class CastleManager implements InstanceListManager
 		for (Castle temp : getCastles())
 		{
 			if (temp.checkIfInZone(x, y, z))
+			{
 				return temp;
+			}
 		}
 		return null;
 	}
@@ -124,8 +147,10 @@ public class CastleManager implements InstanceListManager
 		for (int i = 0; i < getCastles().size(); i++)
 		{
 			castle = getCastles().get(i);
-			if (castle != null && castle.getCastleId() == castleId)
+			if ((castle != null) && (castle.getCastleId() == castleId))
+			{
 				return i;
+			}
 		}
 		return -1;
 	}
@@ -141,8 +166,10 @@ public class CastleManager implements InstanceListManager
 		for (int i = 0; i < getCastles().size(); i++)
 		{
 			castle = getCastles().get(i);
-			if (castle != null && castle.checkIfInZone(x, y, z))
+			if ((castle != null) && castle.checkIfInZone(x, y, z))
+			{
 				return i;
+			}
 		}
 		return -1;
 	}
@@ -150,7 +177,9 @@ public class CastleManager implements InstanceListManager
 	public final List<Castle> getCastles()
 	{
 		if (_castles == null)
+		{
 			_castles = new FastList<>();
+		}
 		return _castles;
 	}
 	
@@ -170,8 +199,12 @@ public class CastleManager implements InstanceListManager
 				break;
 		}
 		for (Castle castle : _castles)
+		{
 			if (castle.getTaxPercent() > maxTax)
+			{
 				castle.setTaxPercent(maxTax);
+			}
+		}
 	}
 	
 	int _castleId = 1; // from this castle
@@ -183,8 +216,10 @@ public class CastleManager implements InstanceListManager
 	
 	public int getCircletByCastleId(int castleId)
 	{
-		if (castleId > 0 && castleId < 10)
+		if ((castleId > 0) && (castleId < 10))
+		{
 			return _castleCirclets[castleId];
+		}
 		
 		return 0;
 	}
@@ -193,13 +228,17 @@ public class CastleManager implements InstanceListManager
 	public void removeCirclet(L2Clan clan, int castleId)
 	{
 		for (L2ClanMember member : clan.getMembers())
+		{
 			removeCirclet(member, castleId);
+		}
 	}
 	
 	public void removeCirclet(L2ClanMember member, int castleId)
 	{
 		if (member == null)
+		{
 			return;
+		}
 		L2PcInstance player = member.getPlayerInstance();
 		int circletId = getCircletByCastleId(castleId);
 		
@@ -214,7 +253,9 @@ public class CastleManager implements InstanceListManager
 					if (circlet != null)
 					{
 						if (circlet.isEquipped())
+						{
 							player.getInventory().unEquipItemInSlot(circlet.getLocationSlot());
+						}
 						player.destroyItemByItemId("CastleCircletRemoval", circletId, 1, player, true);
 					}
 					return;

+ 44 - 16
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/CastleManorManager.java

@@ -41,8 +41,7 @@ import com.l2jserver.gameserver.network.SystemMessageId;
 import com.l2jserver.util.Rnd;
 
 /**
- * Class For Castle Manor Manager Load manor data from DB Update/Reload/Delete
- * Handles all schedule for manor
+ * Class For Castle Manor Manager Load manor data from DB Update/Reload/Delete Handles all schedule for manor
  * @author l3x
  */
 public class CastleManorManager
@@ -191,10 +190,14 @@ public class CastleManorManager
 		
 		boolean isApproved;
 		if (_periodApprove.getTimeInMillis() > _manorRefresh.getTimeInMillis())
+		{
 			// Next approve period already scheduled
 			isApproved = (_manorRefresh.getTimeInMillis() > Calendar.getInstance().getTimeInMillis());
+		}
 		else
-			isApproved = (_periodApprove.getTimeInMillis() < Calendar.getInstance().getTimeInMillis() && _manorRefresh.getTimeInMillis() > Calendar.getInstance().getTimeInMillis());
+		{
+			isApproved = ((_periodApprove.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (_manorRefresh.getTimeInMillis() > Calendar.getInstance().getTimeInMillis()));
+		}
 		
 		for (Castle c : CastleManager.getInstance().getCastles())
 		{
@@ -227,9 +230,13 @@ public class CastleManorManager
 					int price = rs.getInt("seed_price");
 					int period = rs.getInt("period");
 					if (period == PERIOD_CURRENT)
+					{
 						production.add(new SeedProduction(seedId, canProduce, price, startProduce));
+					}
 					else
+					{
 						productionNext.add(new SeedProduction(seedId, canProduce, price, startProduce));
+					}
 				}
 				rs.close();
 				
@@ -250,9 +257,13 @@ public class CastleManorManager
 					int price = rs.getInt("price");
 					int period = rs.getInt("period");
 					if (period == PERIOD_CURRENT)
+					{
 						procure.add(new CropProcure(cropId, canBuy, rewardType, startBuy, price));
+					}
 					else
+					{
 						procureNext.add(new CropProcure(cropId, canBuy, rewardType, startBuy, price));
+					}
 				}
 				rs.close();
 				
@@ -260,7 +271,9 @@ public class CastleManorManager
 				castle.setCropProcure(procureNext, PERIOD_NEXT);
 				
 				if (!procure.isEmpty() || !procureNext.isEmpty() || !production.isEmpty() || !productionNext.isEmpty())
+				{
 					_log.info(getClass().getSimpleName() + ": " + castle.getName() + ": Data loaded");
+				}
 			}
 			statementProduction.close();
 			statementProcure.close();
@@ -299,7 +312,8 @@ public class CastleManorManager
 					setUnderMaintenance(true);
 					_log.info("Manor System: Under maintenance mode started");
 					
-					_scheduledMaintenanceEnd = ThreadPoolManager.getInstance().scheduleGeneral(new Runnable() {
+					_scheduledMaintenanceEnd = ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
+					{
 						@Override
 						public void run()
 						{
@@ -344,8 +358,10 @@ public class CastleManorManager
 	public long getMillisToManorRefresh()
 	{
 		// use safe interval 120s to prevent double run
-		if (_manorRefresh.getTimeInMillis() - Calendar.getInstance().getTimeInMillis() < 120000)
+		if ((_manorRefresh.getTimeInMillis() - Calendar.getInstance().getTimeInMillis()) < 120000)
+		{
 			setNewManorRefresh();
+		}
 		
 		_log.info("Manor System: New Schedule for manor refresh @ " + _manorRefresh.getTime());
 		
@@ -364,8 +380,10 @@ public class CastleManorManager
 	public long getMillisToNextPeriodApprove()
 	{
 		// use safe interval 120s to prevent double run
-		if (_periodApprove.getTimeInMillis() - Calendar.getInstance().getTimeInMillis() < 120000)
+		if ((_periodApprove.getTimeInMillis() - Calendar.getInstance().getTimeInMillis()) < 120000)
+		{
 			setNewPeriodApprove();
+		}
 		
 		_log.info("Manor System: New Schedule for period approve @ " + _periodApprove.getTime());
 		
@@ -386,10 +404,14 @@ public class CastleManorManager
 		for (Castle c : CastleManager.getInstance().getCastles())
 		{
 			if (c.getOwnerId() <= 0)
+			{
 				continue;
+			}
 			L2Clan clan = ClanTable.getInstance().getClan(c.getOwnerId());
 			if (clan == null)
+			{
 				continue;
+			}
 			
 			ItemContainer cwh = clan.getWarehouse();
 			if (!(cwh instanceof ClanWarehouse))
@@ -401,16 +423,20 @@ public class CastleManorManager
 			for (CropProcure crop : c.getCropProcure(PERIOD_CURRENT))
 			{
 				if (crop.getStartAmount() == 0)
+				{
 					continue;
+				}
 				// adding bought crops to clan warehouse
-				if (crop.getStartAmount() - crop.getAmount() > 0)
+				if ((crop.getStartAmount() - crop.getAmount()) > 0)
 				{
 					long count = crop.getStartAmount() - crop.getAmount();
-					count = count * 90 / 100;
+					count = (count * 90) / 100;
 					if (count < 1)
 					{
 						if (Rnd.nextInt(99) < 90)
+						{
 							count = 1;
+						}
 					}
 					if (count > 0)
 					{
@@ -460,7 +486,9 @@ public class CastleManorManager
 			L2PcInstance clanLeader = null;
 			clanLeader = L2World.getInstance().getPlayer(clan.getLeader().getName());
 			if (clanLeader != null)
+			{
 				clanLeader.sendPacket(SystemMessageId.THE_MANOR_INFORMATION_HAS_BEEN_UPDATED);
+			}
 			
 			c.setNextPeriodApproved(false);
 		}
@@ -480,10 +508,7 @@ public class CastleManorManager
 			else if (c.getTreasury() < c.getManorCost(PERIOD_NEXT))
 			{
 				notFunc = true;
-				_log.info("Manor for castle " + c.getName()
-						+ " disabled, not enough adena in treasury: "
-						+ c.getTreasury() + ", " + c.getManorCost(PERIOD_NEXT)
-						+ " required.");
+				_log.info("Manor for castle " + c.getName() + " disabled, not enough adena in treasury: " + c.getTreasury() + ", " + c.getManorCost(PERIOD_NEXT) + " required.");
 				c.setSeedProduction(getNewSeedsList(c.getCastleId()), PERIOD_NEXT);
 				c.setCropProcure(getNewCropsList(c.getCastleId()), PERIOD_NEXT);
 			}
@@ -501,16 +526,15 @@ public class CastleManorManager
 					if (crop.getStartAmount() > 0)
 					{
 						if (cwh.getItemByItemId(ManorData.getInstance().getMatureCrop(crop.getId())) == null)
+						{
 							slots++;
+						}
 					}
 				}
 				if (!cwh.validateCapacity(slots))
 				{
 					notFunc = true;
-					_log.info("Manor for castle " + c.getName()
-							+ " disabled, not enough free slots in clan warehouse: "
-							+ (Config.WAREHOUSE_SLOTS_CLAN - cwh.getSize())
-							+ ", but " + slots + " required.");
+					_log.info("Manor for castle " + c.getName() + " disabled, not enough free slots in clan warehouse: " + (Config.WAREHOUSE_SLOTS_CLAN - cwh.getSize()) + ", but " + slots + " required.");
 					c.setSeedProduction(getNewSeedsList(c.getCastleId()), PERIOD_NEXT);
 					c.setCropProcure(getNewCropsList(c.getCastleId()), PERIOD_NEXT);
 				}
@@ -523,9 +547,13 @@ public class CastleManorManager
 				L2Clan clan = ClanTable.getInstance().getClan(c.getOwnerId());
 				L2PcInstance clanLeader = null;
 				if (clan != null)
+				{
 					clanLeader = L2World.getInstance().getPlayer(clan.getLeaderId());
+				}
 				if (clanLeader != null)
+				{
 					clanLeader.sendPacket(SystemMessageId.THE_AMOUNT_IS_NOT_SUFFICIENT_AND_SO_THE_MANOR_IS_NOT_IN_OPERATION);
+				}
 			}
 		}
 	}

+ 50 - 39
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/ClanHallManager.java

@@ -35,23 +35,18 @@ import com.l2jserver.gameserver.model.entity.clanhall.SiegableHall;
 import com.l2jserver.gameserver.model.zone.type.L2ClanHallZone;
 
 /**
- * @author  Steuf
+ * @author Steuf
  */
 public final class ClanHallManager
 {
 	protected static final Logger _log = Logger.getLogger(ClanHallManager.class.getName());
 	
-	private Map<Integer, AuctionableHall> _clanHall;
-	private Map<Integer, AuctionableHall> _freeClanHall;
-	private Map<Integer, AuctionableHall> _allAuctionableClanHalls;
+	private final Map<Integer, AuctionableHall> _clanHall;
+	private final Map<Integer, AuctionableHall> _freeClanHall;
+	private final Map<Integer, AuctionableHall> _allAuctionableClanHalls;
 	private static Map<Integer, ClanHall> _allClanHalls = new FastMap<>();
 	private boolean _loaded = false;
 	
-	public static ClanHallManager getInstance()
-	{
-		return SingletonHolder._instance;
-	}
-	
 	public boolean loaded()
 	{
 		return _loaded;
@@ -65,15 +60,6 @@ public final class ClanHallManager
 		load();
 	}
 	
-	/** Reload All Clan Hall */
-	/*	public final void reload() Cant reload atm - would loose zone info
-		{
-			_clanHall.clear();
-			_freeClanHall.clear();
-			load();
-		}
-	 */
-	
 	/** Load All Clan Hall */
 	private final void load()
 	{
@@ -87,9 +73,9 @@ public final class ClanHallManager
 				StatsSet set = new StatsSet();
 				
 				id = rs.getInt("id");
- 				ownerId = rs.getInt("ownerId");
- 				lease = rs.getInt("lease");
-
+				ownerId = rs.getInt("ownerId");
+				lease = rs.getInt("lease");
+				
 				set.set("id", id);
 				set.set("name", rs.getString("name"));
 				set.set("ownerId", ownerId);
@@ -111,8 +97,10 @@ public final class ClanHallManager
 				_freeClanHall.put(id, ch);
 				
 				Auction auc = AuctionManager.getInstance().getAuction(id);
-				if (auc == null && lease > 0)
+				if ((auc == null) && (lease > 0))
+				{
 					AuctionManager.getInstance().initNPC(id);
+				}
 			}
 			
 			rs.close();
@@ -131,7 +119,7 @@ public final class ClanHallManager
 	{
 		return _allClanHalls;
 	}
-
+	
 	/**
 	 * @return all FreeClanHalls
 	 */
@@ -160,20 +148,22 @@ public final class ClanHallManager
 	{
 		_allClanHalls.put(hall.getId(), hall);
 	}
-
+	
 	/**
-	 * @param chId 
+	 * @param chId
 	 * @return true is free ClanHall
 	 */
 	public final boolean isFree(int chId)
 	{
 		if (_freeClanHall.containsKey(chId))
+		{
 			return true;
+		}
 		return false;
 	}
 	
 	/**
-	 * Free a ClanHall 
+	 * Free a ClanHall
 	 * @param chId
 	 */
 	public final synchronized void setFree(int chId)
@@ -186,7 +176,7 @@ public final class ClanHallManager
 	
 	/**
 	 * Set ClanHallOwner
-	 * @param chId 
+	 * @param chId
 	 * @param clan
 	 */
 	public final synchronized void setOwner(int chId, L2Clan clan)
@@ -197,13 +187,15 @@ public final class ClanHallManager
 			_freeClanHall.remove(chId);
 		}
 		else
+		{
 			_clanHall.get(chId).free();
+		}
 		ClanTable.getInstance().getClan(clan.getClanId()).setHideoutId(chId);
 		_clanHall.get(chId).setOwner(clan);
 	}
 	
 	/**
-	 * @param clanHallId 
+	 * @param clanHallId
 	 * @return Clan Hall by Id
 	 */
 	public final ClanHall getClanHallById(int clanHallId)
@@ -217,17 +209,19 @@ public final class ClanHallManager
 	}
 	
 	/**
-	 * @param x 
-	 * @param y 
-	 * @param z 
-	 * @return Clan Hall by x,y,z 
+	 * @param x
+	 * @param y
+	 * @param z
+	 * @return Clan Hall by x,y,z
 	 */
 	public final ClanHall getClanHall(int x, int y, int z)
 	{
 		for (ClanHall temp : getAllClanHalls().values())
 		{
 			if (temp.checkIfInZone(x, y, z))
+			{
 				return temp;
+			}
 		}
 		return null;
 	}
@@ -244,14 +238,18 @@ public final class ClanHallManager
 		for (Map.Entry<Integer, AuctionableHall> ch : _clanHall.entrySet())
 		{
 			zone = ch.getValue().getZone();
-			if (zone != null && zone.getDistanceToZone(x, y) < maxDist)
+			if ((zone != null) && (zone.getDistanceToZone(x, y) < maxDist))
+			{
 				return ch.getValue();
+			}
 		}
 		for (Map.Entry<Integer, AuctionableHall> ch : _freeClanHall.entrySet())
 		{
 			zone = ch.getValue().getZone();
-			if (zone != null && zone.getDistanceToZone(x, y) < maxDist)
+			if ((zone != null) && (zone.getDistanceToZone(x, y) < maxDist))
+			{
 				return ch.getValue();
+			}
 		}
 		return null;
 	}
@@ -259,17 +257,19 @@ public final class ClanHallManager
 	public final ClanHall getNearbyAbstractHall(int x, int y, int maxDist)
 	{
 		L2ClanHallZone zone = null;
-		for(Map.Entry<Integer, ClanHall> ch : _allClanHalls.entrySet())
+		for (Map.Entry<Integer, ClanHall> ch : _allClanHalls.entrySet())
 		{
 			zone = ch.getValue().getZone();
-			if(zone != null && zone.getDistanceToZone(x, y) < maxDist)
+			if ((zone != null) && (zone.getDistanceToZone(x, y) < maxDist))
+			{
 				return ch.getValue();
+			}
 		}
 		return null;
 	}
 	
 	/**
-	 * @param clan 
+	 * @param clan
 	 * @return Clan Hall by Owner
 	 */
 	public final AuctionableHall getClanHallByOwner(L2Clan clan)
@@ -277,7 +277,9 @@ public final class ClanHallManager
 		for (Map.Entry<Integer, AuctionableHall> ch : _clanHall.entrySet())
 		{
 			if (clan.getClanId() == ch.getValue().getOwnerId())
+			{
 				return ch.getValue();
+			}
 		}
 		return null;
 	}
@@ -288,16 +290,25 @@ public final class ClanHallManager
 		for (Map.Entry<Integer, AuctionableHall> ch : _clanHall.entrySet())
 		{
 			if (clan.getClanId() == ch.getValue().getOwnerId())
+			{
 				return ch.getValue();
+			}
 		}
-		for(Map.Entry<Integer, SiegableHall> ch : CHSiegeManager.getInstance().getConquerableHalls().entrySet())
+		for (Map.Entry<Integer, SiegableHall> ch : CHSiegeManager.getInstance().getConquerableHalls().entrySet())
 		{
-			if(clan.getClanId() == ch.getValue().getOwnerId())
+			if (clan.getClanId() == ch.getValue().getOwnerId())
+			{
 				return ch.getValue();
+			}
 		}
 		return null;
 	}
 	
+	public static ClanHallManager getInstance()
+	{
+		return SingletonHolder._instance;
+	}
+	
 	private static class SingletonHolder
 	{
 		protected static final ClanHallManager _instance = new ClanHallManager();

+ 9 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/CoupleManager.java

@@ -29,7 +29,6 @@ import com.l2jserver.gameserver.model.entity.Couple;
 
 /**
  * @author evill33t
- *
  */
 public class CoupleManager
 {
@@ -80,15 +79,17 @@ public class CoupleManager
 	{
 		int index = getCoupleIndex(coupleId);
 		if (index >= 0)
+		{
 			return getCouples().get(index);
+		}
 		return null;
 	}
 	
 	public void createCouple(L2PcInstance player1, L2PcInstance player2)
 	{
-		if (player1 != null && player2 != null)
+		if ((player1 != null) && (player2 != null))
 		{
-			if (player1.getPartnerId() == 0 && player2.getPartnerId() == 0)
+			if ((player1.getPartnerId() == 0) && (player2.getPartnerId() == 0))
 			{
 				int _player1id = player1.getObjectId();
 				int _player2id = player2.getObjectId();
@@ -135,8 +136,10 @@ public class CoupleManager
 		int i = 0;
 		for (Couple temp : getCouples())
 		{
-			if (temp != null && temp.getId() == coupleId)
+			if ((temp != null) && (temp.getId() == coupleId))
+			{
 				return i;
+			}
 			i++;
 		}
 		return -1;
@@ -145,7 +148,9 @@ public class CoupleManager
 	public final FastList<Couple> getCouples()
 	{
 		if (_couples == null)
+		{
 			_couples = new FastList<>();
+		}
 		return _couples;
 	}
 	

+ 30 - 18
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/CursedWeaponsManager.java

@@ -51,7 +51,7 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
 import com.l2jserver.gameserver.util.Broadcast;
 
 /**
- * UnAfraid: TODO: Rewrite with DocumentParser 
+ * UnAfraid: TODO: Rewrite with DocumentParser
  * @author Micht
  */
 public class CursedWeaponsManager
@@ -70,7 +70,9 @@ public class CursedWeaponsManager
 		_cursedWeapons = new HashMap<>();
 		
 		if (!Config.ALLOW_CURSED_WEAPONS)
+		{
 			return;
+		}
 		
 		load();
 		restore();
@@ -200,12 +202,12 @@ public class CursedWeaponsManager
 	}
 	
 	private final void controlPlayers()
-	{		
+	{
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
 		{
 			// TODO: See comments below...
 			// This entire for loop should NOT be necessary, since it is already handled by
-			// CursedWeapon.endOfLife().  However, if we indeed *need* to duplicate it for safety,
+			// CursedWeapon.endOfLife(). However, if we indeed *need* to duplicate it for safety,
 			// then we'd better make sure that it FULLY cleans up inactive cursed weapons!
 			// Undesired effects result otherwise, such as player with no zariche but with karma
 			// or a lost-child entry in the cursed weapons table, without a corresponding one in items...
@@ -216,7 +218,9 @@ public class CursedWeaponsManager
 				for (CursedWeapon cw : _cursedWeapons.values())
 				{
 					if (cw.isActivated())
+					{
 						continue;
+					}
 					
 					// Do an item check to be sure that the cursed weapon isn't hold by someone
 					int itemId = cw.getItemId();
@@ -267,19 +271,22 @@ public class CursedWeaponsManager
 	
 	public synchronized void checkDrop(L2Attackable attackable, L2PcInstance player)
 	{
-		if (attackable instanceof L2DefenderInstance || attackable instanceof L2RiftInvaderInstance
-				|| attackable instanceof L2FestivalMonsterInstance || attackable instanceof L2GuardInstance
-				|| attackable instanceof L2GrandBossInstance || attackable instanceof L2FeedableBeastInstance
-				|| attackable instanceof L2FortCommanderInstance)
+		if ((attackable instanceof L2DefenderInstance) || (attackable instanceof L2RiftInvaderInstance) || (attackable instanceof L2FestivalMonsterInstance) || (attackable instanceof L2GuardInstance) || (attackable instanceof L2GrandBossInstance) || (attackable instanceof L2FeedableBeastInstance) || (attackable instanceof L2FortCommanderInstance))
+		{
 			return;
+		}
 		
 		for (CursedWeapon cw : _cursedWeapons.values())
 		{
 			if (cw.isActive())
+			{
 				continue;
+			}
 			
 			if (cw.checkDrop(attackable, player))
+			{
 				break;
+			}
 		}
 	}
 	
@@ -289,14 +296,11 @@ public class CursedWeaponsManager
 		if (player.isCursedWeaponEquipped()) // cannot own 2 cursed swords
 		{
 			CursedWeapon cw2 = _cursedWeapons.get(player.getCursedWeaponEquippedId());
-			/* TODO: give the bonus level in a more appropriate manner.
-			 *  The following code adds "_stageKills" levels.  This will also show in the char status.
-			 * I do not have enough info to know if the bonus should be shown in the pk count, or if it
-			 * should be a full "_stageKills" bonus or just the remaining from the current count till the
-			 * of the current stage...
-			 * This code is a TEMP fix, so that the cursed weapon's bonus level can be observed with as
-			 * little change in the code as possible, until proper info arises.
-			 */
+			// TODO: give the bonus level in a more appropriate manner.
+			// The following code adds "_stageKills" levels. This will also show in the char status.
+			// I do not have enough info to know if the bonus should be shown in the pk count, or if it
+			// should be a full "_stageKills" bonus or just the remaining from the current count till the of the current stage...
+			// This code is a TEMP fix, so that the cursed weapon's bonus level can be observed with as little change in the code as possible, until proper info arises.
 			cw2.setNbKills(cw2.getStageKills() - 1);
 			cw2.increaseKills();
 			
@@ -305,7 +309,9 @@ public class CursedWeaponsManager
 			cw.endOfLife(); // expire the weapon and clean up.
 		}
 		else
+		{
 			cw.activate(player, item);
+		}
 	}
 	
 	public void drop(int itemId, L2Character killer)
@@ -337,11 +343,13 @@ public class CursedWeaponsManager
 	public void checkPlayer(L2PcInstance player)
 	{
 		if (player == null)
+		{
 			return;
+		}
 		
 		for (CursedWeapon cw : _cursedWeapons.values())
 		{
-			if (cw.isActivated() && player.getObjectId() == cw.getPlayerId())
+			if (cw.isActivated() && (player.getObjectId() == cw.getPlayerId()))
 			{
 				cw.setPlayer(player);
 				cw.setItem(player.getInventory().getItemByItemId(cw.getItemId()));
@@ -350,7 +358,7 @@ public class CursedWeaponsManager
 				
 				SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_MINUTE_OF_USAGE_TIME_ARE_LEFT_FOR_S1);
 				sm.addString(cw.getName());
-				//sm.addItemName(cw.getItemId());
+				// sm.addItemName(cw.getItemId());
 				sm.addNumber((int) ((cw.getEndTime() - System.currentTimeMillis()) / 60000));
 				player.sendPacket(sm);
 			}
@@ -360,8 +368,12 @@ public class CursedWeaponsManager
 	public int checkOwnsWeaponId(int ownerId)
 	{
 		for (CursedWeapon cw : _cursedWeapons.values())
-			if (cw.isActivated() && ownerId == cw.getPlayerId())
+		{
+			if (cw.isActivated() && (ownerId == cw.getPlayerId()))
+			{
 				return cw.getItemId();
+			}
+		}
 		return -1;
 	}
 	

+ 24 - 11
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/DayNightSpawnManager.java

@@ -28,18 +28,18 @@ import com.l2jserver.gameserver.model.actor.L2Npc;
 import com.l2jserver.gameserver.model.actor.instance.L2RaidBossInstance;
 
 /**
- * @author  godson
+ * @author godson
  */
 public class DayNightSpawnManager
 {
 	
 	private static Logger _log = Logger.getLogger(DayNightSpawnManager.class.getName());
 	
-	private List<L2Spawn> _dayCreatures;
-	private List<L2Spawn> _nightCreatures;
-	private Map<L2Spawn, L2RaidBossInstance> _bosses;
+	private final List<L2Spawn> _dayCreatures;
+	private final List<L2Spawn> _nightCreatures;
+	private final Map<L2Spawn, L2RaidBossInstance> _bosses;
 	
-	//private static int _currentState;  // 0 = Day, 1 = Night
+	// private static int _currentState; // 0 = Day, 1 = Night
 	
 	public static DayNightSpawnManager getInstance()
 	{
@@ -50,7 +50,7 @@ public class DayNightSpawnManager
 	{
 		_dayCreatures = new ArrayList<>();
 		_nightCreatures = new ArrayList<>();
-		_bosses = new FastMap<>();		
+		_bosses = new FastMap<>();
 	}
 	
 	public void addDayCreature(L2Spawn spawnDat)
@@ -86,18 +86,19 @@ public class DayNightSpawnManager
 	 * @param UnspawnLogInfo String for log info for unspawned L2NpcInstance
 	 * @param SpawnLogInfo String for log info for spawned L2NpcInstance
 	 */
-	private void spawnCreatures(List<L2Spawn> unSpawnCreatures, List<L2Spawn> spawnCreatures, String UnspawnLogInfo,
-			String SpawnLogInfo)
+	private void spawnCreatures(List<L2Spawn> unSpawnCreatures, List<L2Spawn> spawnCreatures, String UnspawnLogInfo, String SpawnLogInfo)
 	{
 		try
 		{
 			if (!unSpawnCreatures.isEmpty())
 			{
 				int i = 0;
-				for (L2Spawn spawn: unSpawnCreatures)
+				for (L2Spawn spawn : unSpawnCreatures)
 				{
 					if (spawn == null)
+					{
 						continue;
+					}
 					
 					spawn.stopRespawn();
 					L2Npc last = spawn.getLastSpawn();
@@ -114,7 +115,9 @@ public class DayNightSpawnManager
 			for (L2Spawn spawnDat : spawnCreatures)
 			{
 				if (spawnDat == null)
+				{
 					continue;
+				}
 				spawnDat.startRespawn();
 				spawnDat.doSpawn();
 				i++;
@@ -131,7 +134,9 @@ public class DayNightSpawnManager
 	private void changeMode(int mode)
 	{
 		if (_nightCreatures.isEmpty() && _dayCreatures.isEmpty())
+		{
 			return;
+		}
 		
 		switch (mode)
 		{
@@ -151,8 +156,8 @@ public class DayNightSpawnManager
 	
 	public DayNightSpawnManager trim()
 	{
-		((ArrayList<?>)_nightCreatures).trimToSize();
-		((ArrayList<?>)_dayCreatures).trimToSize();
+		((ArrayList<?>) _nightCreatures).trimToSize();
+		((ArrayList<?>) _dayCreatures).trimToSize();
 		return this;
 	}
 	
@@ -161,9 +166,13 @@ public class DayNightSpawnManager
 		try
 		{
 			if (GameTimeController.getInstance().isNowNight())
+			{
 				changeMode(1);
+			}
 			else
+			{
 				changeMode(0);
+			}
 		}
 		catch (Exception e)
 		{
@@ -201,7 +210,9 @@ public class DayNightSpawnManager
 				}
 				
 				if ((boss != null) && (boss.getNpcId() == 25328) && boss.getRaidStatus().equals(RaidBossSpawnManager.StatusEnum.ALIVE))
+				{
 					handleHellmans(boss, mode);
+				}
 				return;
 			}
 		}
@@ -229,7 +240,9 @@ public class DayNightSpawnManager
 	public L2RaidBossInstance handleBoss(L2Spawn spawnDat)
 	{
 		if (_bosses.containsKey(spawnDat))
+		{
 			return _bosses.get(spawnDat);
+		}
 		
 		if (GameTimeController.getInstance().isNowNight())
 		{

+ 48 - 10
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/DimensionalRiftManager.java

@@ -14,8 +14,6 @@
  */
 package com.l2jserver.gameserver.instancemanager;
 
-import gnu.trove.map.hash.TByteObjectHashMap;
-
 import java.awt.Polygon;
 import java.awt.Shape;
 import java.io.File;
@@ -48,6 +46,8 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
 import com.l2jserver.gameserver.util.Util;
 import com.l2jserver.util.Rnd;
 
+import gnu.trove.map.hash.TByteObjectHashMap;
+
 /**
  * Thanks to L2Fortress and balancer.ru - kombat
  */
@@ -88,7 +88,7 @@ public class DimensionalRiftManager
 				byte type = rs.getByte("type");
 				byte room_id = rs.getByte("room_id");
 				
-				//coords related
+				// coords related
 				int xMin = rs.getInt("xMin");
 				int xMax = rs.getInt("xMax");
 				int yMin = rs.getInt("yMin");
@@ -101,7 +101,9 @@ public class DimensionalRiftManager
 				boolean isBossRoom = rs.getByte("boss") > 0;
 				
 				if (!_rooms.containsKey(type))
+				{
 					_rooms.put(type, new TByteObjectHashMap<DimensionalRiftRoom>(9));
+				}
 				
 				_rooms.get(type).put(room_id, new DimensionalRiftRoom(type, room_id, xMin, xMax, yMin, yMax, z1, z2, xT, yT, zT, isBossRoom));
 			}
@@ -118,7 +120,9 @@ public class DimensionalRiftManager
 		int roomSize = 0;
 		
 		for (byte b : _rooms.keys())
+		{
 			roomSize += _rooms.get(b).keys().length;
+		}
 		
 		_log.info(getClass().getSimpleName() + ": Loaded " + typeSize + " room types with " + roomSize + " rooms.");
 	}
@@ -194,7 +198,7 @@ public class DimensionalRiftManager
 												y = riftRoom.getRandomY();
 												z = riftRoom.getTeleportCoords()[2];
 												
-												if (template != null && _rooms.containsKey(type) && _rooms.get(type).containsKey(roomId))
+												if ((template != null) && _rooms.containsKey(type) && _rooms.get(type).containsKey(roomId))
 												{
 													spawnDat = new L2Spawn(template);
 													spawnDat.setAmount(1);
@@ -246,7 +250,9 @@ public class DimensionalRiftManager
 	public boolean checkIfInRiftZone(int x, int y, int z, boolean ignorePeaceZone)
 	{
 		if (ignorePeaceZone)
+		{
 			return _rooms.get((byte) 0).get((byte) 1).checkIfInZone(x, y, z);
+		}
 		
 		return _rooms.get((byte) 0).get((byte) 1).checkIfInZone(x, y, z) && !_rooms.get((byte) 0).get((byte) 0).checkIfInZone(x, y, z);
 	}
@@ -301,11 +307,13 @@ public class DimensionalRiftManager
 		}
 		
 		for (L2PcInstance p : player.getParty().getMembers())
+		{
 			if (!checkIfInPeaceZone(p.getX(), p.getY(), p.getZ()))
 			{
 				canPass = false;
 				break;
 			}
+		}
 		
 		if (!canPass)
 		{
@@ -369,7 +377,7 @@ public class DimensionalRiftManager
 		do
 		{
 			emptyRooms = getFreeRooms(type);
-			room = emptyRooms.get(Rnd.get(1, emptyRooms.size())-1);
+			room = emptyRooms.get(Rnd.get(1, emptyRooms.size()) - 1);
 		}
 		// find empty room
 		while (_rooms.get(type).get(room).ispartyInside());
@@ -379,19 +387,27 @@ public class DimensionalRiftManager
 	public void killRift(DimensionalRift d)
 	{
 		if (d.getTeleportTimerTask() != null)
+		{
 			d.getTeleportTimerTask().cancel();
+		}
 		d.setTeleportTimerTask(null);
 		
 		if (d.getTeleportTimer() != null)
+		{
 			d.getTeleportTimer().cancel();
+		}
 		d.setTeleportTimer(null);
 		
 		if (d.getSpawnTimerTask() != null)
+		{
 			d.getSpawnTimerTask().cancel();
+		}
 		d.setSpawnTimerTask(null);
 		
 		if (d.getSpawnTimer() != null)
+		{
 			d.getSpawnTimer().cancel();
+		}
 		d.setSpawnTimer(null);
 	}
 	
@@ -412,8 +428,7 @@ public class DimensionalRiftManager
 		protected final FastList<L2Npc> _roomMobs;
 		private boolean _partyInside = false;
 		
-		public DimensionalRiftRoom(byte type, byte room, int xMin, int xMax, int yMin, int yMax, int zMin, int zMax, int xT, int yT,
-				int zT, boolean isBossRoom)
+		public DimensionalRiftRoom(byte type, byte room, int xMin, int xMax, int yMin, int yMax, int zMin, int zMax, int xT, int yT, int zT, boolean isBossRoom)
 		{
 			_type = type;
 			_room = room;
@@ -423,11 +438,28 @@ public class DimensionalRiftManager
 			_yMax = (yMax - 128);
 			_zMin = zMin;
 			_zMax = zMax;
-			_teleportCoords = new int[] { xT, yT, zT };
+			_teleportCoords = new int[]
+			{
+				xT,
+				yT,
+				zT
+			};
 			_isBossRoom = isBossRoom;
 			_roomSpawns = new FastList<>();
 			_roomMobs = new FastList<>();
-			_s = new Polygon(new int[] { xMin, xMax, xMax, xMin }, new int[] { yMin, yMin, yMax, yMax }, 4);
+			_s = new Polygon(new int[]
+			{
+				xMin,
+				xMax,
+				xMax,
+				xMin
+			}, new int[]
+			{
+				yMin,
+				yMin,
+				yMax,
+				yMax
+			}, 4);
 		}
 		
 		public int getRandomX()
@@ -447,7 +479,7 @@ public class DimensionalRiftManager
 		
 		public boolean checkIfInZone(int x, int y, int z)
 		{
-			return _s.contains(x, y) && z >= _zMin && z <= _zMax;
+			return _s.contains(x, y) && (z >= _zMin) && (z <= _zMax);
 		}
 		
 		public boolean isBossRoom()
@@ -475,7 +507,9 @@ public class DimensionalRiftManager
 			{
 				spawn.stopRespawn();
 				if (spawn.getLastSpawn() != null)
+				{
 					spawn.getLastSpawn().deleteMe();
+				}
 			}
 			return this;
 		}
@@ -539,7 +573,9 @@ public class DimensionalRiftManager
 		for (DimensionalRiftRoom room : _rooms.get(type).valueCollection())
 		{
 			if (room.ispartyInside())
+			{
 				count++;
+			}
 		}
 		return (count < (_rooms.get(type).size() - 1));
 	}
@@ -550,7 +586,9 @@ public class DimensionalRiftManager
 		for (DimensionalRiftRoom room : _rooms.get(type).valueCollection())
 		{
 			if (!room.ispartyInside())
+			{
 				list.add(room._room);
+			}
 		}
 		return list;
 	}

+ 38 - 12
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/DuelManager.java

@@ -22,8 +22,8 @@ import com.l2jserver.gameserver.model.entity.Duel;
 import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
 
 public class DuelManager
-{	
-	private FastList<Duel> _duels;
+{
+	private final FastList<Duel> _duels;
 	private int _currentDuelId = 0x90;
 	
 	protected DuelManager()
@@ -35,7 +35,9 @@ public class DuelManager
 	{
 		// In case someone wants to run the server forever :)
 		if (++_currentDuelId >= 2147483640)
+		{
 			_currentDuelId = 1;
+		}
 		return _currentDuelId;
 	}
 	
@@ -44,15 +46,19 @@ public class DuelManager
 		for (FastList.Node<Duel> e = _duels.head(), end = _duels.tail(); (e = e.getNext()) != end;)
 		{
 			if (e.getValue().getId() == duelId)
+			{
 				return e.getValue();
+			}
 		}
 		return null;
 	}
 	
 	public void addDuel(L2PcInstance playerA, L2PcInstance playerB, int partyDuel)
 	{
-		if (playerA == null || playerB == null)
+		if ((playerA == null) || (playerB == null))
+		{
 			return;
+		}
 		
 		// return if a player has PvPFlag
 		String engagedInPvP = "The duel was canceled because a duelist engaged in PvP combat.";
@@ -94,7 +100,7 @@ public class DuelManager
 		}
 		else
 		{
-			if (playerA.getPvpFlag() != 0 || playerB.getPvpFlag() != 0)
+			if ((playerA.getPvpFlag() != 0) || (playerB.getPvpFlag() != 0))
 			{
 				playerA.sendMessage(engagedInPvP);
 				playerB.sendMessage(engagedInPvP);
@@ -113,8 +119,10 @@ public class DuelManager
 	
 	public void doSurrender(L2PcInstance player)
 	{
-		if (player == null || !player.isInDuel())
+		if ((player == null) || !player.isInDuel())
+		{
 			return;
+		}
 		Duel duel = getDuel(player.getDuelId());
 		duel.doSurrender(player);
 	}
@@ -125,11 +133,15 @@ public class DuelManager
 	 */
 	public void onPlayerDefeat(L2PcInstance player)
 	{
-		if (player == null || !player.isInDuel())
+		if ((player == null) || !player.isInDuel())
+		{
 			return;
+		}
 		Duel duel = getDuel(player.getDuelId());
 		if (duel != null)
+		{
 			duel.onPlayerDefeat(player);
+		}
 	}
 	
 	/**
@@ -139,11 +151,15 @@ public class DuelManager
 	 */
 	public void onBuff(L2PcInstance player, L2Effect buff)
 	{
-		if (player == null || !player.isInDuel() || buff == null)
+		if ((player == null) || !player.isInDuel() || (buff == null))
+		{
 			return;
+		}
 		Duel duel = getDuel(player.getDuelId());
 		if (duel != null)
+		{
 			duel.onBuff(player, buff);
+		}
 	}
 	
 	/**
@@ -152,11 +168,15 @@ public class DuelManager
 	 */
 	public void onRemoveFromParty(L2PcInstance player)
 	{
-		if (player == null || !player.isInDuel())
+		if ((player == null) || !player.isInDuel())
+		{
 			return;
+		}
 		Duel duel = getDuel(player.getDuelId());
 		if (duel != null)
+		{
 			duel.onRemoveFromParty(player);
+		}
 	}
 	
 	/**
@@ -166,13 +186,19 @@ public class DuelManager
 	 */
 	public void broadcastToOppositTeam(L2PcInstance player, L2GameServerPacket packet)
 	{
-		if (player == null || !player.isInDuel())
+		if ((player == null) || !player.isInDuel())
+		{
 			return;
+		}
 		Duel duel = getDuel(player.getDuelId());
 		if (duel == null)
+		{
 			return;
-		if (duel.getPlayerA() == null || duel.getPlayerB() == null)
+		}
+		if ((duel.getPlayerA() == null) || (duel.getPlayerB() == null))
+		{
 			return;
+		}
 		
 		if (duel.getPlayerA() == player)
 		{
@@ -184,11 +210,11 @@ public class DuelManager
 		}
 		else if (duel.isPartyDuel())
 		{
-			if (duel.getPlayerA().getParty() != null && duel.getPlayerA().getParty().getMembers().contains(player))
+			if ((duel.getPlayerA().getParty() != null) && duel.getPlayerA().getParty().getMembers().contains(player))
 			{
 				duel.broadcastToTeam2(packet);
 			}
-			else if (duel.getPlayerB().getParty() != null && duel.getPlayerB().getParty().getMembers().contains(player))
+			else if ((duel.getPlayerB().getParty() != null) && duel.getPlayerB().getParty().getMembers().contains(player))
 			{
 				duel.broadcastToTeam1(packet);
 			}

+ 18 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/FortManager.java

@@ -56,7 +56,9 @@ public class FortManager implements InstanceListManager
 			{
 				fort = getForts().get(i);
 				if (fort == null)
+				{
 					continue;
+				}
 				distance = fort.getDistance(obj);
 				if (maxDistance > distance)
 				{
@@ -73,7 +75,9 @@ public class FortManager implements InstanceListManager
 		for (Fort f : getForts())
 		{
 			if (f.getFortId() == fortId)
+			{
 				return f;
+			}
 		}
 		return null;
 	}
@@ -83,7 +87,9 @@ public class FortManager implements InstanceListManager
 		for (Fort f : getForts())
 		{
 			if (f.getOwnerClan() == clan)
+			{
 				return f;
+			}
 		}
 		return null;
 	}
@@ -93,7 +99,9 @@ public class FortManager implements InstanceListManager
 		for (Fort f : getForts())
 		{
 			if (f.getName().equalsIgnoreCase(name.trim()))
+			{
 				return f;
+			}
 		}
 		return null;
 	}
@@ -103,7 +111,9 @@ public class FortManager implements InstanceListManager
 		for (Fort f : getForts())
 		{
 			if (f.checkIfInZone(x, y, z))
+			{
 				return f;
+			}
 		}
 		return null;
 	}
@@ -119,8 +129,10 @@ public class FortManager implements InstanceListManager
 		for (int i = 0; i < getForts().size(); i++)
 		{
 			fort = getForts().get(i);
-			if (fort != null && fort.getFortId() == fortId)
+			if ((fort != null) && (fort.getFortId() == fortId))
+			{
 				return i;
+			}
 		}
 		return -1;
 	}
@@ -136,8 +148,10 @@ public class FortManager implements InstanceListManager
 		for (int i = 0; i < getForts().size(); i++)
 		{
 			fort = getForts().get(i);
-			if (fort != null && fort.checkIfInZone(x, y, z))
+			if ((fort != null) && fort.checkIfInZone(x, y, z))
+			{
 				return i;
+			}
 		}
 		return -1;
 	}
@@ -145,7 +159,9 @@ public class FortManager implements InstanceListManager
 	public final List<Fort> getForts()
 	{
 		if (_forts == null)
+		{
 			_forts = new FastList<>();
+		}
 		return _forts;
 	}
 	

+ 10 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/FortSiegeGuardManager.java

@@ -34,7 +34,7 @@ public class FortSiegeGuardManager
 {
 	private static final Logger _log = Logger.getLogger(FortSiegeGuardManager.class.getName());
 	
-	private Fort _fort;
+	private final Fort _fort;
 	protected FastMap<Integer, FastList<L2Spawn>> _siegeGuards = new FastMap<>();
 	protected FastList<L2Spawn> _siegeGuardsSpawns;
 	
@@ -44,7 +44,7 @@ public class FortSiegeGuardManager
 	}
 	
 	/**
-	 * Spawn guards.<BR><BR>
+	 * Spawn guards.
 	 */
 	public void spawnSiegeGuard()
 	{
@@ -57,9 +57,13 @@ public class FortSiegeGuardManager
 				{
 					spawnDat.doSpawn();
 					if (spawnDat.getLastSpawn() instanceof L2FortBallistaInstance)
+					{
 						spawnDat.stopRespawn();
+					}
 					else
+					{
 						spawnDat.startRespawn();
+					}
 				}
 			}
 		}
@@ -70,7 +74,7 @@ public class FortSiegeGuardManager
 	}
 	
 	/**
-	 * Unspawn guards.<BR><BR>
+	 * Unspawn guards.
 	 */
 	public void unspawnSiegeGuard()
 	{
@@ -84,7 +88,9 @@ public class FortSiegeGuardManager
 				{
 					spawnDat.stopRespawn();
 					if (spawnDat.getLastSpawn() != null)
+					{
 						spawnDat.getLastSpawn().doDie(spawnDat.getLastSpawn());
+					}
 				}
 			}
 		}
@@ -95,7 +101,7 @@ public class FortSiegeGuardManager
 	}
 	
 	/**
-	 * Load guards.<BR><BR>
+	 * Load guards.
 	 */
 	void loadSiegeGuard()
 	{

+ 41 - 9
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/FortSiegeManager.java

@@ -78,41 +78,55 @@ public class FortSiegeManager
 	
 	/**
 	 * @param activeChar The L2Character of the character can summon
-	 * @param isCheckOnly 
+	 * @param isCheckOnly
 	 * @return true if character summon
 	 */
 	public final boolean checkIfOkToSummon(L2Character activeChar, boolean isCheckOnly)
 	{
 		if (!(activeChar instanceof L2PcInstance))
+		{
 			return false;
+		}
 		
 		String text = "";
 		L2PcInstance player = (L2PcInstance) activeChar;
 		Fort fort = FortManager.getInstance().getFort(player);
 		
-		if (fort == null || fort.getFortId() <= 0)
+		if ((fort == null) || (fort.getFortId() <= 0))
+		{
 			text = "You must be on fort ground to summon this";
+		}
 		else if (!fort.getSiege().getIsInProgress())
+		{
 			text = "You can only summon this during a siege.";
-		else if (player.getClanId() != 0 && fort.getSiege().getAttackerClan(player.getClanId()) == null)
+		}
+		else if ((player.getClanId() != 0) && (fort.getSiege().getAttackerClan(player.getClanId()) == null))
+		{
 			text = "You can only summon this as a registered attacker.";
+		}
 		else
+		{
 			return true;
+		}
 		
 		if (!isCheckOnly)
+		{
 			player.sendMessage(text);
+		}
 		return false;
 	}
 	
 	/**
 	 * @param clan The L2Clan of the player
-	 * @param fortid 
+	 * @param fortid
 	 * @return true if the clan is registered or owner of a fort
 	 */
 	public final boolean checkIsRegistered(L2Clan clan, int fortid)
 	{
 		if (clan == null)
+		{
 			return false;
+		}
 		
 		boolean register = false;
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
@@ -177,7 +191,9 @@ public class FortSiegeManager
 			{
 				String _spawnParams = siegeSettings.getProperty(fort.getName().replace(" ", "") + "Commander" + i, "");
 				if (_spawnParams.isEmpty())
+				{
 					break;
+				}
 				StringTokenizer st = new StringTokenizer(_spawnParams.trim(), ",");
 				
 				try
@@ -202,7 +218,9 @@ public class FortSiegeManager
 			{
 				String _spawnParams = siegeSettings.getProperty(fort.getName().replace(" ", "") + "Flag" + i, "");
 				if (_spawnParams.isEmpty())
+				{
 					break;
+				}
 				StringTokenizer st = new StringTokenizer(_spawnParams.trim(), ",");
 				
 				try
@@ -235,7 +253,9 @@ public class FortSiegeManager
 	public final FastList<CombatFlag> getFlagList(int _fortId)
 	{
 		if (_flagList.containsKey(_fortId))
+		{
 			return _flagList.get(_fortId);
+		}
 		return null;
 	}
 	
@@ -262,8 +282,12 @@ public class FortSiegeManager
 	public final FortSiege getSiege(int x, int y, int z)
 	{
 		for (Fort fort : FortManager.getInstance().getForts())
+		{
 			if (fort.getSiege().checkIfInZone(x, y, z))
+			{
 				return fort.getSiege();
+			}
+		}
 		return null;
 	}
 	
@@ -285,14 +309,18 @@ public class FortSiegeManager
 	public final List<FortSiege> getSieges()
 	{
 		if (_sieges == null)
+		{
 			_sieges = new FastList<>();
+		}
 		return _sieges;
 	}
 	
 	public final void addSiege(FortSiege fortSiege)
 	{
 		if (_sieges == null)
+		{
 			_sieges = new FastList<>();
+		}
 		_sieges.add(fortSiege);
 	}
 	
@@ -304,7 +332,9 @@ public class FortSiegeManager
 	public boolean activateCombatFlag(L2PcInstance player, L2ItemInstance item)
 	{
 		if (!checkIfCanPickup(player))
+		{
 			return false;
+		}
 		
 		Fort fort = FortManager.getInstance().getFort(player);
 		
@@ -335,7 +365,7 @@ public class FortSiegeManager
 		// here check if is siege is attacker
 		Fort fort = FortManager.getInstance().getFort(player);
 		
-		if (fort == null || fort.getFortId() <= 0)
+		if ((fort == null) || (fort.getFortId() <= 0))
 		{
 			player.sendPacket(sm);
 			return false;
@@ -365,7 +395,9 @@ public class FortSiegeManager
 			{
 				cf.dropIt();
 				if (fort.getSiege().getIsInProgress())
+				{
 					cf.spawnMe();
+				}
 			}
 		}
 	}
@@ -373,10 +405,10 @@ public class FortSiegeManager
 	public static class SiegeSpawn
 	{
 		Location _location;
-		private int _npcId;
-		private int _heading;
-		private int _fortId;
-		private int _id;
+		private final int _npcId;
+		private final int _heading;
+		private final int _fortId;
+		private final int _id;
 		
 		public SiegeSpawn(int fort_id, int x, int y, int z, int heading, int npc_id, int id)
 		{

+ 161 - 80
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/FourSepulchersManager.java

@@ -14,9 +14,6 @@
  */
 package com.l2jserver.gameserver.instancemanager;
 
-import gnu.trove.map.hash.TIntIntHashMap;
-import gnu.trove.map.hash.TIntObjectHashMap;
-
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -52,9 +49,12 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
 import com.l2jserver.gameserver.util.Util;
 import com.l2jserver.util.Rnd;
 
+import gnu.trove.map.hash.TIntIntHashMap;
+import gnu.trove.map.hash.TIntObjectHashMap;
+
 /**
+ * Zoey76: TODO: Use Location DTO instead of array of int.
  * @author sandman
- * 
  */
 public class FourSepulchersManager
 {
@@ -79,43 +79,48 @@ public class FourSepulchersManager
 	protected ScheduledFuture<?> _changeAttackTimeTask = null;
 	protected ScheduledFuture<?> _onPartyAnnihilatedTask = null;
 	
-	private int[][] _startHallSpawn = {
-			{ 181632, -85587, -7218 },
-			{ 179963, -88978, -7218 },
-			{ 173217, -86132, -7218 },
-			{ 175608, -82296, -7218 }
+	// @formatter:off
+	private final int[][] _startHallSpawn =
+	{
+		{ 181632, -85587, -7218 },
+		{ 179963, -88978, -7218 },
+		{ 173217, -86132, -7218 },
+		{ 175608, -82296, -7218 }
 	};
 	
-	private int[][][] _shadowSpawnLoc = {
-			{
-				{ 25339, 191231, -85574, -7216, 33380 },
-				{ 25349, 189534, -88969, -7216, 32768 },
-				{ 25346, 173195, -76560, -7215, 49277 },
-				{ 25342, 175591, -72744, -7215, 49317 }
-			},
-			{
-				{ 25342, 191231, -85574, -7216, 33380 },
-				{ 25339, 189534, -88969, -7216, 32768 },
-				{ 25349, 173195, -76560, -7215, 49277 },
-				{ 25346, 175591, -72744, -7215, 49317 }
-			},
-			{
-				{ 25346, 191231, -85574, -7216, 33380 },
-				{ 25342, 189534, -88969, -7216, 32768 },
-				{ 25339, 173195, -76560, -7215, 49277 },
-				{ 25349, 175591, -72744, -7215, 49317 }
-			},
-			{
-				{ 25349, 191231, -85574, -7216, 33380 },
-				{ 25346, 189534, -88969, -7216, 32768 },
-				{ 25342, 173195, -76560, -7215, 49277 },
-				{ 25339, 175591, -72744, -7215, 49317 }
-			},
+	private final int[][][] _shadowSpawnLoc =
+	{
+		{
+			{ 25339, 191231, -85574, -7216, 33380 },
+			{ 25349, 189534, -88969, -7216, 32768 },
+			{ 25346, 173195, -76560, -7215, 49277 },
+			{ 25342, 175591, -72744, -7215, 49317 }
+		},
+		{
+			{ 25342, 191231, -85574, -7216, 33380 },
+			{ 25339, 189534, -88969, -7216, 32768 },
+			{ 25349, 173195, -76560, -7215, 49277 },
+			{ 25346, 175591, -72744, -7215, 49317 }
+		},
+		{
+			{ 25346, 191231, -85574, -7216, 33380 },
+			{ 25342, 189534, -88969, -7216, 32768 },
+			{ 25339, 173195, -76560, -7215, 49277 },
+			{ 25349, 175591, -72744, -7215, 49317 }
+		},
+		{
+			{ 25349, 191231, -85574, -7216, 33380 },
+			{ 25346, 189534, -88969, -7216, 32768 },
+			{ 25342, 173195, -76560, -7215, 49277 },
+			{ 25339, 175591, -72744, -7215, 49317 }
+		},
 	};
+	// @formatter:on
+	
 	protected FastMap<Integer, Boolean> _archonSpawned = new FastMap<>();
 	protected FastMap<Integer, Boolean> _hallInUse = new FastMap<>();
 	protected FastMap<Integer, L2PcInstance> _challengers = new FastMap<>();
-	protected TIntObjectHashMap<int []> _startHallSpawns = new TIntObjectHashMap<>();
+	protected TIntObjectHashMap<int[]> _startHallSpawns = new TIntObjectHashMap<>();
 	protected TIntIntHashMap _hallGateKeepers = new TIntIntHashMap();
 	protected TIntIntHashMap _keyBoxNpc = new TIntIntHashMap();
 	protected TIntIntHashMap _victim = new TIntIntHashMap();
@@ -147,13 +152,21 @@ public class FourSepulchersManager
 	public void init()
 	{
 		if (_changeCoolDownTimeTask != null)
+		{
 			_changeCoolDownTimeTask.cancel(true);
+		}
 		if (_changeEntryTimeTask != null)
+		{
 			_changeEntryTimeTask.cancel(true);
+		}
 		if (_changeWarmUpTimeTask != null)
+		{
 			_changeWarmUpTimeTask.cancel(true);
+		}
 		if (_changeAttackTimeTask != null)
+		{
 			_changeAttackTimeTask.cancel(true);
+		}
 		
 		_changeCoolDownTimeTask = null;
 		_changeEntryTimeTask = null;
@@ -186,33 +199,33 @@ public class FourSepulchersManager
 		long currentTime = Calendar.getInstance().getTimeInMillis();
 		// if current time >= time of entry beginning and if current time < time
 		// of entry beginning + time of entry end
-		if (currentTime >= _coolDownTimeEnd && currentTime < _entryTimeEnd) // entry
-			// time
-			// check
+		if ((currentTime >= _coolDownTimeEnd) && (currentTime < _entryTimeEnd)) // entry
+		// time
+		// check
 		{
 			clean();
 			_changeEntryTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeEntryTime(), 0);
 			_log.info(getClass().getSimpleName() + ": Beginning in Entry time");
 		}
-		else if (currentTime >= _entryTimeEnd && currentTime < _warmUpTimeEnd) // warmup
-			// time
-			// check
+		else if ((currentTime >= _entryTimeEnd) && (currentTime < _warmUpTimeEnd)) // warmup
+		// time
+		// check
 		{
 			clean();
 			_changeWarmUpTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeWarmUpTime(), 0);
 			_log.info(getClass().getSimpleName() + ": Beginning in WarmUp time");
 		}
-		else if (currentTime >= _warmUpTimeEnd && currentTime < _attackTimeEnd) // attack
-			// time
-			// check
+		else if ((currentTime >= _warmUpTimeEnd) && (currentTime < _attackTimeEnd)) // attack
+		// time
+		// check
 		{
 			clean();
 			_changeAttackTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeAttackTime(), 0);
 			_log.info(getClass().getSimpleName() + ": Beginning in Attack time");
 		}
 		else
-			// else cooldown time and without cleanup because it's already
-			// implemented
+		// else cooldown time and without cleanup because it's already
+		// implemented
 		{
 			_changeCoolDownTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeCoolDownTime(), 0);
 			_log.info(getClass().getSimpleName() + ": Beginning in Cooldown time");
@@ -224,12 +237,14 @@ public class FourSepulchersManager
 	{
 		Calendar tmp = Calendar.getInstance();
 		if (tmp.get(Calendar.MINUTE) < _newCycleMin)
+		{
 			tmp.set(Calendar.HOUR, Calendar.getInstance().get(Calendar.HOUR) - 1);
+		}
 		tmp.set(Calendar.MINUTE, _newCycleMin);
 		_coolDownTimeEnd = tmp.getTimeInMillis();
-		_entryTimeEnd = _coolDownTimeEnd + Config.FS_TIME_ENTRY * 60000L;
-		_warmUpTimeEnd = _entryTimeEnd + Config.FS_TIME_WARMUP * 60000L;
-		_attackTimeEnd = _warmUpTimeEnd + Config.FS_TIME_ATTACK * 60000L;
+		_entryTimeEnd = _coolDownTimeEnd + (Config.FS_TIME_ENTRY * 60000L);
+		_warmUpTimeEnd = _entryTimeEnd + (Config.FS_TIME_WARMUP * 60000L);
+		_attackTimeEnd = _warmUpTimeEnd + (Config.FS_TIME_ATTACK * 60000L);
 	}
 	
 	public void clean()
@@ -268,11 +283,15 @@ public class FourSepulchersManager
 		int i = 31921;
 		for (L2Spawn spawnDat; i <= 31924; i++)
 		{
-			if (i < 31921 || i > 31924)
+			if ((i < 31921) || (i > 31924))
+			{
 				continue;
+			}
 			L2NpcTemplate template1 = NpcTable.getInstance().getTemplate(i);
 			if (template1 == null)
+			{
 				continue;
+			}
 			try
 			{
 				spawnDat = new L2Spawn(template1);
@@ -433,8 +452,7 @@ public class FourSepulchersManager
 				}
 				else
 				{
-					_log.warning("FourSepulchersManager.LoadMysteriousBox: Data missing in NPC table for ID: "
-							+ rset.getInt("npc_templateid") + ".");
+					_log.warning("FourSepulchersManager.LoadMysteriousBox: Data missing in NPC table for ID: " + rset.getInt("npc_templateid") + ".");
 				}
 			}
 			
@@ -473,8 +491,7 @@ public class FourSepulchersManager
 				}
 				else
 				{
-					_log.warning("FourSepulchersManager.InitKeyBoxSpawns: Data missing in NPC table for ID: " + _keyBoxNpc.get(keyNpcId)
-							+ ".");
+					_log.warning("FourSepulchersManager.InitKeyBoxSpawns: Data missing in NPC table for ID: " + _keyBoxNpc.get(keyNpcId) + ".");
 				}
 			}
 			catch (Exception e)
@@ -751,7 +768,13 @@ public class FourSepulchersManager
 	protected void initLocationShadowSpawns()
 	{
 		int locNo = Rnd.get(4);
-		final int[] gateKeeper = { 31929, 31934, 31939, 31944 };
+		final int[] gateKeeper =
+		{
+			31929,
+			31934,
+			31939,
+			31944
+		};
 		
 		L2Spawn spawnDat;
 		L2NpcTemplate template;
@@ -782,8 +805,7 @@ public class FourSepulchersManager
 			}
 			else
 			{
-				_log.warning("FourSepulchersManager.InitLocationShadowSpawns: Data missing in NPC table for ID: "
-						+ _shadowSpawnLoc[locNo][i][0] + ".");
+				_log.warning("FourSepulchersManager.InitLocationShadowSpawns: Data missing in NPC table for ID: " + _shadowSpawnLoc[locNo][i][0] + ".");
 			}
 		}
 	}
@@ -812,8 +834,7 @@ public class FourSepulchersManager
 				}
 				else
 				{
-					_log.warning("FourSepulchersManager.InitExecutionerSpawns: Data missing in NPC table for ID: " + _victim.get(keyNpcId)
-							+ ".");
+					_log.warning("FourSepulchersManager.InitExecutionerSpawns: Data missing in NPC table for ID: " + _victim.get(keyNpcId) + ".");
 				}
 			}
 			catch (Exception e)
@@ -844,19 +865,18 @@ public class FourSepulchersManager
 		int npcId = npc.getNpcId();
 		switch (npcId)
 		{
-			// ID ok
+		// ID ok
 			case 31921:
 			case 31922:
 			case 31923:
 			case 31924:
 				break;
-				// ID not ok
+			// ID not ok
 			default:
 				if (!player.isGM())
 				{
 					_log.warning("Player " + player.getName() + "(" + player.getObjectId() + ") tried to cheat in four sepulchers.");
-					Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName()
-							+ " tried to enter four sepulchers with invalid npc id.", Config.DEFAULT_PUNISH);
+					Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " tried to enter four sepulchers with invalid npc id.", Config.DEFAULT_PUNISH);
 				}
 				return;
 		}
@@ -869,7 +889,7 @@ public class FourSepulchersManager
 		
 		if (Config.FS_PARTY_MEMBER_COUNT > 1)
 		{
-			if (!player.isInParty() || player.getParty().getMemberCount() < Config.FS_PARTY_MEMBER_COUNT)
+			if (!player.isInParty() || (player.getParty().getMemberCount() < Config.FS_PARTY_MEMBER_COUNT))
 			{
 				showHtmlFile(player, npcId + "-SP.htm", npc, null);
 				return;
@@ -884,7 +904,7 @@ public class FourSepulchersManager
 			for (L2PcInstance mem : player.getParty().getMembers())
 			{
 				QuestState qs = mem.getQuestState(hostQuest.getName());
-				if (qs == null || (!qs.isStarted() && !qs.isCompleted()))
+				if ((qs == null) || (!qs.isStarted() && !qs.isCompleted()))
 				{
 					showHtmlFile(player, npcId + "-NS.htm", npc, mem);
 					return;
@@ -902,7 +922,7 @@ public class FourSepulchersManager
 				}
 			}
 		}
-		else if (Config.FS_PARTY_MEMBER_COUNT <= 1 && player.isInParty())
+		else if ((Config.FS_PARTY_MEMBER_COUNT <= 1) && player.isInParty())
 		{
 			if (!player.getParty().isLeader(player))
 			{
@@ -912,7 +932,7 @@ public class FourSepulchersManager
 			for (L2PcInstance mem : player.getParty().getMembers())
 			{
 				QuestState qs = mem.getQuestState(hostQuest.getName());
-				if (qs == null || (!qs.isStarted() && !qs.isCompleted()))
+				if ((qs == null) || (!qs.isStarted() && !qs.isCompleted()))
 				{
 					showHtmlFile(player, npcId + "-NS.htm", npc, mem);
 					return;
@@ -933,7 +953,7 @@ public class FourSepulchersManager
 		else
 		{
 			QuestState qs = player.getQuestState(hostQuest.getName());
-			if (qs == null || (!qs.isStarted() && !qs.isCompleted()))
+			if ((qs == null) || (!qs.isStarted() && !qs.isCompleted()))
 			{
 				showHtmlFile(player, npcId + "-NS.htm", npc, player);
 				return;
@@ -1004,7 +1024,7 @@ public class FourSepulchersManager
 			_hallInUse.remove(npcId);
 			_hallInUse.put(npcId, true);
 		}
-		if (Config.FS_PARTY_MEMBER_COUNT <= 1 && player.isInParty())
+		if ((Config.FS_PARTY_MEMBER_COUNT <= 1) && player.isInParty())
 		{
 			List<L2PcInstance> members = new FastList<>();
 			for (L2PcInstance mem : player.getParty().getMembers())
@@ -1069,7 +1089,9 @@ public class FourSepulchersManager
 	public void spawnMysteriousBox(int npcId)
 	{
 		if (!isAttackTime())
+		{
 			return;
+		}
 		
 		L2Spawn spawnDat = _mysteriousBoxSpawns.get(npcId);
 		if (spawnDat != null)
@@ -1082,7 +1104,9 @@ public class FourSepulchersManager
 	public void spawnMonster(int npcId)
 	{
 		if (!isAttackTime())
+		{
 			return;
+		}
 		
 		FastList<L2Spawn> monsterList;
 		FastList<L2SepulcherMonsterInstance> mobs = new FastList<>();
@@ -1193,7 +1217,7 @@ public class FourSepulchersManager
 				case 31484:
 					_viscountMobs.put(npcId, mobs);
 					break;
-					
+				
 				case 31472:
 				case 31477:
 				case 31482:
@@ -1209,12 +1233,16 @@ public class FourSepulchersManager
 		FastList<L2SepulcherMonsterInstance> mobs = _viscountMobs.get(npcId);
 		
 		if (mobs == null)
+		{
 			return true;
+		}
 		
 		for (L2SepulcherMonsterInstance mob : mobs)
 		{
 			if (!mob.isDead())
+			{
 				return false;
+			}
 		}
 		
 		return true;
@@ -1225,12 +1253,16 @@ public class FourSepulchersManager
 		FastList<L2SepulcherMonsterInstance> mobs = _dukeMobs.get(npcId);
 		
 		if (mobs == null)
+		{
 			return true;
+		}
 		
 		for (L2SepulcherMonsterInstance mob : mobs)
 		{
 			if (!mob.isDead())
+			{
 				return false;
+			}
 		}
 		
 		return true;
@@ -1239,7 +1271,9 @@ public class FourSepulchersManager
 	public void spawnKeyBox(L2Npc activeChar)
 	{
 		if (!isAttackTime())
+		{
 			return;
+		}
 		
 		L2Spawn spawnDat = _keyBoxSpawns.get(activeChar.getNpcId());
 		
@@ -1260,7 +1294,9 @@ public class FourSepulchersManager
 	public void spawnExecutionerOfHalisha(L2Npc activeChar)
 	{
 		if (!isAttackTime())
+		{
 			return;
+		}
 		
 		L2Spawn spawnDat = _executionerSpawns.get(activeChar.getNpcId());
 		
@@ -1280,10 +1316,14 @@ public class FourSepulchersManager
 	public void spawnArchonOfHalisha(int npcId)
 	{
 		if (!isAttackTime())
+		{
 			return;
+		}
 		
 		if (_archonSpawned.get(npcId))
+		{
 			return;
+		}
 		
 		FastList<L2Spawn> monsterList = _dukeFinalMobs.get(npcId);
 		
@@ -1307,7 +1347,9 @@ public class FourSepulchersManager
 	public void spawnEmperorsGraveNpc(int npcId)
 	{
 		if (!isAttackTime())
+		{
 			return;
+		}
 		
 		FastList<L2Spawn> monsterList = _emperorsGraveNpcs.get(npcId);
 		
@@ -1326,7 +1368,13 @@ public class FourSepulchersManager
 		int locNo = Rnd.get(4);
 		// _log.info("FourSepulchersManager.LocationShadowSpawns: Location index
 		// is " + locNo + ".");
-		final int[] gateKeeper = { 31929, 31934, 31939, 31944 };
+		final int[] gateKeeper =
+		{
+			31929,
+			31934,
+			31939,
+			31944
+		};
 		
 		L2Spawn spawnDat;
 		
@@ -1345,7 +1393,9 @@ public class FourSepulchersManager
 	public void spawnShadow(int npcId)
 	{
 		if (!isAttackTime())
+		{
 			return;
+		}
 		
 		L2Spawn spawnDat = _shadowSpawns.get(npcId);
 		if (spawnDat != null)
@@ -1366,12 +1416,16 @@ public class FourSepulchersManager
 		for (L2Npc mob : _allMobs)
 		{
 			if (mob == null)
+			{
 				continue;
+			}
 			
 			try
 			{
 				if (mob.getSpawn() != null)
+				{
 					mob.getSpawn().stopRespawn();
+				}
 				mob.deleteMe();
 			}
 			catch (Exception e)
@@ -1407,7 +1461,7 @@ public class FourSepulchersManager
 	
 	protected byte minuteSelect(byte min)
 	{
-		if ((double) min % 5 != 0)// if doesn't divides on 5 fully
+		if (((double) min % 5) != 0)// if doesn't divides on 5 fully
 		{
 			// mad table for selecting proper minutes...
 			// may be there is a better way to do this
@@ -1488,14 +1542,18 @@ public class FourSepulchersManager
 		if (_inAttackTime)
 		{
 			if (min < 5)
+			{
 				return; // do not shout when < 5 minutes
+			}
 			
 			min = minuteSelect(min);
 			
 			NpcStringId msg = NpcStringId.MINUTES_HAVE_PASSED;
 			
 			if (min == 90)
+			{
 				msg = NpcStringId.GAME_OVER_THE_TELEPORT_WILL_APPEAR_MOMENTARILY;
+			}
 			
 			for (L2Spawn temp : _managers)
 			{
@@ -1513,7 +1571,9 @@ public class FourSepulchersManager
 				// anything :)
 				// if you don't need this - delete next two lines.
 				if (!_hallInUse.get(temp.getNpcid()).booleanValue())
+				{
 					continue;
+				}
 				
 				((L2SepulcherNpcInstance) temp.getLastSpawn()).sayInShout(msg);
 			}
@@ -1550,7 +1610,7 @@ public class FourSepulchersManager
 			{
 				Calendar tmp = Calendar.getInstance();
 				tmp.setTimeInMillis(Calendar.getInstance().getTimeInMillis() - _warmUpTimeEnd);
-				if (tmp.get(Calendar.MINUTE) + 5 < Config.FS_TIME_ATTACK)
+				if ((tmp.get(Calendar.MINUTE) + 5) < Config.FS_TIME_ATTACK)
 				{
 					managerSay((byte) tmp.get(Calendar.MINUTE)); // byte
 					// because
@@ -1561,13 +1621,15 @@ public class FourSepulchersManager
 					ThreadPoolManager.getInstance().scheduleGeneral(new ManagerSay(), 5 * 60000);
 				}
 				// attack time ending chat
-				else if (tmp.get(Calendar.MINUTE) + 5 >= Config.FS_TIME_ATTACK)
+				else if ((tmp.get(Calendar.MINUTE) + 5) >= Config.FS_TIME_ATTACK)
 				{
 					managerSay((byte) 90); // sending a unique id :D
 				}
 			}
 			else if (_inEntryTime)
+			{
 				managerSay((byte) 0);
+			}
 		}
 	}
 	
@@ -1589,10 +1651,14 @@ public class FourSepulchersManager
 			// time
 			// and then launching change time task
 			if (_firstTimeRun)
+			{
 				interval = _entryTimeEnd - Calendar.getInstance().getTimeInMillis();
+			}
 			else
+			{
 				interval = Config.FS_TIME_ENTRY * 60000L; // else use stupid
-			// method
+				// method
+			}
 			
 			// launching saying process...
 			ThreadPoolManager.getInstance().scheduleGeneral(new ManagerSay(), 0);
@@ -1623,9 +1689,13 @@ public class FourSepulchersManager
 			// current time
 			// and then launching change time task
 			if (_firstTimeRun)
+			{
 				interval = _warmUpTimeEnd - Calendar.getInstance().getTimeInMillis();
+			}
 			else
+			{
 				interval = Config.FS_TIME_WARMUP * 60000L;
+			}
 			_changeAttackTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeAttackTime(), interval);
 			
 			if (_changeWarmUpTimeTask != null)
@@ -1666,27 +1736,32 @@ public class FourSepulchersManager
 				for (double min = Calendar.getInstance().get(Calendar.MINUTE); min < _newCycleMin; min++)
 				{
 					// looking for next shout time....
-					if (min % 5 == 0)// check if min can be divided by 5
+					if ((min % 5) == 0)// check if min can be divided by 5
 					{
 						_log.info(getClass().getSimpleName() + ": " + Calendar.getInstance().getTime() + " Atk announce scheduled to " + min + " minute of this hour.");
 						Calendar inter = Calendar.getInstance();
 						inter.set(Calendar.MINUTE, (int) min);
-						ThreadPoolManager.getInstance().scheduleGeneral(new ManagerSay(), inter.getTimeInMillis()
-								- Calendar.getInstance().getTimeInMillis());
+						ThreadPoolManager.getInstance().scheduleGeneral(new ManagerSay(), inter.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
 						break;
 					}
 				}
 			}
 			else
+			{
 				ThreadPoolManager.getInstance().scheduleGeneral(new ManagerSay(), 5 * 60400);
+			}
 			// searching time when attack time will be ended:
 			// counting difference between time when attack time ends and
 			// current time
 			// and then launching change time task
 			if (_firstTimeRun)
+			{
 				interval = _attackTimeEnd - Calendar.getInstance().getTimeInMillis();
+			}
 			else
+			{
 				interval = Config.FS_TIME_ATTACK * 60000L;
+			}
 			_changeCoolDownTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeCoolDownTime(), interval);
 			
 			if (_changeAttackTimeTask != null)
@@ -1713,13 +1788,17 @@ public class FourSepulchersManager
 			Calendar time = Calendar.getInstance();
 			// one hour = 55th min to 55 min of next hour, so we check for this,
 			// also check for first launch
-			if (Calendar.getInstance().get(Calendar.MINUTE) > _newCycleMin && !_firstTimeRun)
+			if ((Calendar.getInstance().get(Calendar.MINUTE) > _newCycleMin) && !_firstTimeRun)
+			{
 				time.set(Calendar.HOUR, Calendar.getInstance().get(Calendar.HOUR) + 1);
+			}
 			time.set(Calendar.MINUTE, _newCycleMin);
 			_log.info(getClass().getSimpleName() + ": Entry time: " + time.getTime());
 			if (_firstTimeRun)
+			{
 				_firstTimeRun = false; // cooldown phase ends event hour, so it
-			// will be not first run
+				// will be not first run
+			}
 			
 			long interval = time.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
 			_changeEntryTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeEntryTime(), interval);
@@ -1742,7 +1821,9 @@ public class FourSepulchersManager
 		NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
 		html.setFile(player.getHtmlPrefix(), "data/html/SepulcherNpc/" + file);
 		if (member != null)
+		{
 			html.replace("%member%", member.getName());
+		}
 		player.sendPacket(html);
 	}
 	

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/GlobalVariablesManager.java

@@ -68,7 +68,7 @@ public class GlobalVariablesManager
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
 			PreparedStatement statement = con.prepareStatement(SAVE_VAR))
 		{
-			for(String var : _variablesMap.keySet())
+			for (String var : _variablesMap.keySet())
 			{
 				statement.setString(1, var);
 				statement.setString(2, _variablesMap.get(var));

+ 38 - 54
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/GrandBossManager.java

@@ -14,9 +14,6 @@
  */
 package com.l2jserver.gameserver.instancemanager;
 
-import gnu.trove.map.hash.TIntIntHashMap;
-import gnu.trove.map.hash.TIntObjectHashMap;
-
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -39,50 +36,18 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.zone.type.L2BossZone;
 import com.l2jserver.util.L2FastList;
 
+import gnu.trove.map.hash.TIntIntHashMap;
+import gnu.trove.map.hash.TIntObjectHashMap;
+
 /**
- * @author DaRkRaGe
- * Revised by Emperorc
+ * @author DaRkRaGe Revised by Emperorc
  */
 public class GrandBossManager
 {
-	/* =========================================================
-	 * This class handles all Grand Bosses:
-	 * <ul>
-	 * <li>25333-25338  Anakazel</li>
-	 * <li>29001        Queen Ant</li>
-	 * <li>29006        Core</li>
-	 * <li>29014        Orfen</li>
-	 * <li>29019        Antharas</li>
-	 * <li>29020        Baium</li>
-	 * <li>29022        Zaken</li>
-	 * <li>29028        Valakas</li>
-	 * <li>29045        Frintezza</li>
-	 * <li>29046-29047  Scarlet van Halisha</li>
-	 * </ul>
-	 *
-	 * It handles the saving of hp, mp, location, and status
-	 * of all Grand Bosses. It also manages the zones associated
-	 * with the Grand Bosses.
-	 * NOTE: The current version does NOT spawn the Grand Bosses,
-	 * it just stores and retrieves the values on reboot/startup,
-	 * for AI scripts to utilize as needed.
-	 */
-	
-	/**
-	 * DELETE FROM grandboss_list
-	 */
+	// SQL queries
 	private static final String DELETE_GRAND_BOSS_LIST = "DELETE FROM grandboss_list";
-	
-	/**
-	 * INSERT INTO grandboss_list (player_id,zone) VALUES (?,?)
-	 */
 	private static final String INSERT_GRAND_BOSS_LIST = "INSERT INTO grandboss_list (player_id,zone) VALUES (?,?)";
-	
-	/**
-	 * UPDATE grandboss_data set loc_x = ?, loc_y = ?, loc_z = ?, heading = ?, respawn_time = ?, currentHP = ?, currentMP = ?, status = ? where boss_id = ?
-	 */
 	private static final String UPDATE_GRAND_BOSS_DATA = "UPDATE grandboss_data set loc_x = ?, loc_y = ?, loc_z = ?, heading = ?, respawn_time = ?, currentHP = ?, currentMP = ?, status = ? where boss_id = ?";
-	
 	private static final String UPDATE_GRAND_BOSS_DATA2 = "UPDATE grandboss_data set status = ? where boss_id = ?";
 	
 	protected static Logger _log = Logger.getLogger(GrandBossManager.class.getName());
@@ -113,8 +78,8 @@ public class GrandBossManager
 			ResultSet rset = statement.executeQuery();
 			while (rset.next())
 			{
-				//Read all info from DB, and store it for AI to read and decide what to do
-				//faster than accessing DB in real time
+				// Read all info from DB, and store it for AI to read and decide what to do
+				// faster than accessing DB in real time
 				StatsSet info = new StatsSet();
 				int bossId = rset.getInt("boss_id");
 				info.set("loc_x", rset.getInt("loc_x"));
@@ -122,18 +87,20 @@ public class GrandBossManager
 				info.set("loc_z", rset.getInt("loc_z"));
 				info.set("heading", rset.getInt("heading"));
 				info.set("respawn_time", rset.getLong("respawn_time"));
-				double HP = rset.getDouble("currentHP"); //jython doesn't recognize doubles
-				int true_HP = (int) HP; //so use java's ability to type cast
-				info.set("currentHP", true_HP); //to convert double to int
+				double HP = rset.getDouble("currentHP"); // jython doesn't recognize doubles
+				int true_HP = (int) HP; // so use java's ability to type cast
+				info.set("currentHP", true_HP); // to convert double to int
 				double MP = rset.getDouble("currentMP");
 				int true_MP = (int) MP;
 				info.set("currentMP", true_MP);
 				int status = rset.getInt("status");
 				_bossStatus.put(bossId, status);
 				_storedInfo.put(bossId, info);
-				_log.info(getClass().getSimpleName() + ": " +NpcTable.getInstance().getTemplate(bossId).getName()+"(" +bossId+ ") status is "+ status+".");
+				_log.info(getClass().getSimpleName() + ": " + NpcTable.getInstance().getTemplate(bossId).getName() + "(" + bossId + ") status is " + status + ".");
 				if (status > 0)
-					_log.info(getClass().getSimpleName() + ": Next spawn date of " +NpcTable.getInstance().getTemplate(bossId).getName()+" is "+ new Date(info.getLong("respawn_time"))+".");
+				{
+					_log.info(getClass().getSimpleName() + ": Next spawn date of " + NpcTable.getInstance().getTemplate(bossId).getName() + " is " + new Date(info.getLong("respawn_time")) + ".");
+				}
 				
 				info = null;
 			}
@@ -168,7 +135,9 @@ public class GrandBossManager
 		for (L2BossZone zone : _zones)
 		{
 			if (zone == null)
+			{
 				continue;
+			}
 			zones.put(zone.getId(), new L2FastList<Integer>());
 		}
 		
@@ -201,7 +170,9 @@ public class GrandBossManager
 		for (L2BossZone zone : _zones)
 		{
 			if (zone == null)
+			{
 				continue;
+			}
 			zone.setAllowedPlayers(zones.get(zone.getId()));
 		}
 		
@@ -223,7 +194,9 @@ public class GrandBossManager
 			for (L2BossZone temp : _zones)
 			{
 				if (temp.isCharacterInZone(character))
+				{
 					return temp;
+				}
 			}
 		}
 		return null;
@@ -241,7 +214,9 @@ public class GrandBossManager
 			for (L2BossZone temp : _zones)
 			{
 				if (temp.isInsideZone(x, y, z))
+				{
 					return temp;
+				}
 			}
 		}
 		return null;
@@ -251,7 +226,9 @@ public class GrandBossManager
 	{
 		L2BossZone temp = getZone(obj.getX(), obj.getY(), obj.getZ());
 		if (temp == null)
+		{
 			return false;
+		}
 		
 		return temp.getName().equalsIgnoreCase(zoneType);
 	}
@@ -259,10 +236,14 @@ public class GrandBossManager
 	public boolean checkIfInZone(L2PcInstance player)
 	{
 		if (player == null)
+		{
 			return false;
+		}
 		L2BossZone temp = getZone(player.getX(), player.getY(), player.getZ());
 		if (temp == null)
+		{
 			return false;
+		}
 		
 		return true;
 	}
@@ -275,13 +256,13 @@ public class GrandBossManager
 	public void setBossStatus(int bossId, int status)
 	{
 		_bossStatus.put(bossId, status);
-		_log.info(getClass().getSimpleName()+": Updated "+NpcTable.getInstance().getTemplate(bossId).getName()+"(" +bossId+ ") status to " +status);
+		_log.info(getClass().getSimpleName() + ": Updated " + NpcTable.getInstance().getTemplate(bossId).getName() + "(" + bossId + ") status to " + status);
 		updateDb(bossId, true);
 	}
 	
 	/**
 	 * Adds a L2GrandBossInstance to the list of bosses.
-	 * @param boss 
+	 * @param boss
 	 */
 	public void addBoss(L2GrandBossInstance boss)
 	{
@@ -319,11 +300,15 @@ public class GrandBossManager
 				for (L2BossZone zone : _zones)
 				{
 					if (zone == null)
+					{
 						continue;
+					}
 					Integer id = zone.getId();
 					L2FastList<Integer> list = zone.getAllowedPlayers();
-					if (list == null || list.isEmpty())
+					if ((list == null) || list.isEmpty())
+					{
 						continue;
+					}
 					for (Integer player : list)
 					{
 						insert.setInt(1, player);
@@ -337,7 +322,7 @@ public class GrandBossManager
 			{
 				final L2GrandBossInstance boss = _bosses.get(bossId);
 				StatsSet info = _storedInfo.get(bossId);
-				if (boss == null || info == null)
+				if ((boss == null) || (info == null))
 				{
 					try (PreparedStatement update = con.prepareStatement(UPDATE_GRAND_BOSS_DATA2))
 					{
@@ -386,7 +371,7 @@ public class GrandBossManager
 			L2GrandBossInstance boss = _bosses.get(bossId);
 			StatsSet info = _storedInfo.get(bossId);
 			
-			if (statusOnly || boss == null || info == null)
+			if (statusOnly || (boss == null) || (info == null))
 			{
 				try (PreparedStatement statement = con.prepareStatement(UPDATE_GRAND_BOSS_DATA2))
 				{
@@ -426,8 +411,7 @@ public class GrandBossManager
 	}
 	
 	/**
-	 * Saves all Grand Boss info and then clears all info from memory,
-	 * including all schedules.
+	 * Saves all Grand Boss info and then clears all info from memory, including all schedules.
 	 */
 	public void cleanUp()
 	{

+ 102 - 73
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/HandysBlockCheckerManager.java

@@ -39,7 +39,7 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
  * as the clearance of the participants list or liberate the arena.
  * @author BiggBoss
  */
-public final class HandysBlockCheckerManager 
+public final class HandysBlockCheckerManager
 {
 	// All the participants and their team classified by arena
 	private static final ArenaParticipantsHolder[] _arenaPlayers = new ArenaParticipantsHolder[4];
@@ -54,8 +54,7 @@ public final class HandysBlockCheckerManager
 	protected static List<Integer> _registrationPenalty = new ArrayList<>();
 	
 	/**
-	 * Return the number of event-start votes for the specified
-	 * arena id
+	 * Return the number of event-start votes for the specified arena id
 	 * @param arenaId
 	 * @return int (number of votes)
 	 */
@@ -65,8 +64,7 @@ public final class HandysBlockCheckerManager
 	}
 	
 	/**
-	 * Add a new vote to start the event for the specified
-	 * arena id
+	 * Add a new vote to start the event for the specified arena id
 	 * @param arena
 	 */
 	public synchronized void increaseArenaVotes(int arena)
@@ -74,13 +72,17 @@ public final class HandysBlockCheckerManager
 		int newVotes = _arenaVotes.get(arena) + 1;
 		ArenaParticipantsHolder holder = _arenaPlayers[arena];
 		
-		if(newVotes > holder.getAllPlayers().size() / 2 && !holder.getEvent().isStarted())
+		if ((newVotes > (holder.getAllPlayers().size() / 2)) && !holder.getEvent().isStarted())
 		{
 			clearArenaVotes(arena);
-			if(holder.getBlueTeamSize() == 0 || holder.getRedTeamSize() == 0)
+			if ((holder.getBlueTeamSize() == 0) || (holder.getRedTeamSize() == 0))
+			{
 				return;
-			if(Config.HBCE_FAIR_PLAY)
+			}
+			if (Config.HBCE_FAIR_PLAY)
+			{
 				holder.checkAndShuffle();
+			}
 			ThreadPoolManager.getInstance().executeTask(holder.getEvent().new StartEvent());
 		}
 		else
@@ -90,15 +92,14 @@ public final class HandysBlockCheckerManager
 	}
 	
 	/**
-	 * Will clear the votes queue (of event start) for the
-	 * specified arena id
+	 * Will clear the votes queue (of event start) for the specified arena id
 	 * @param arena
 	 */
 	public synchronized void clearArenaVotes(int arena)
 	{
 		_arenaVotes.put(arena, 0);
 	}
-
+	
 	protected HandysBlockCheckerManager()
 	{
 		// Initialize arena status
@@ -117,36 +118,35 @@ public final class HandysBlockCheckerManager
 	{
 		return _arenaPlayers[arena];
 	}
-		
+	
 	/**
 	 * Initializes the participants holder
 	 */
 	public void startUpParticipantsQueue()
 	{
-		for(int i = 0; i < 4; ++i)
+		for (int i = 0; i < 4; ++i)
 		{
 			_arenaPlayers[i] = new ArenaParticipantsHolder(i);
 		}
 	}
 	
 	/**
-	 * Add the player to the specified arena (through the specified
-	 * arena manager) and send the needed server ->  client packets
+	 * Add the player to the specified arena (through the specified arena manager) and send the needed server -> client packets
 	 * @param player
 	 * @param arenaId
-	 * @return 
+	 * @return
 	 */
 	public boolean addPlayerToArena(L2PcInstance player, int arenaId)
 	{
 		ArenaParticipantsHolder holder = _arenaPlayers[arenaId];
 		
-		synchronized(holder)
+		synchronized (holder)
 		{
 			boolean isRed;
 			
-			for(int i = 0; i < 4; i++)
+			for (int i = 0; i < 4; i++)
 			{
-				if(_arenaPlayers[i].getAllPlayers().contains(player))
+				if (_arenaPlayers[i].getAllPlayers().contains(player))
 				{
 					SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_MATCH_WAITING_LIST);
 					msg.addCharName(player);
@@ -154,44 +154,43 @@ public final class HandysBlockCheckerManager
 					return false;
 				}
 			}
-				
-			if(player.isCursedWeaponEquipped())
+			
+			if (player.isCursedWeaponEquipped())
 			{
 				player.sendPacket(SystemMessageId.CANNOT_REGISTER_PROCESSING_CURSED_WEAPON);
 				return false;
 			}
 			
-			if(TvTEvent.isPlayerParticipant(player.getObjectId()) || player.isInOlympiadMode())
+			if (TvTEvent.isPlayerParticipant(player.getObjectId()) || player.isInOlympiadMode())
 			{
 				player.sendMessage("Couldnt register you due other event participation");
 				return false;
 			}
-
-			if(OlympiadManager.getInstance().isRegistered(player))
+			
+			if (OlympiadManager.getInstance().isRegistered(player))
 			{
 				OlympiadManager.getInstance().unRegisterNoble(player);
 				player.sendPacket(SystemMessageId.COLISEUM_OLYMPIAD_KRATEIS_APPLICANTS_CANNOT_PARTICIPATE);
-			}				
-			/*
-			if(UnderGroundColiseum.getInstance().isRegisteredPlayer(player))
-			{
-				UngerGroundColiseum.getInstance().removeParticipant(player);
-				player.sendPacket(SystemMessageId.COLISEUM_OLYMPIAD_KRATEIS_APPLICANTS_CANNOT_PARTICIPATE));
 			}
-			if(KrateiCubeManager.getInstance().isRegisteredPlayer(player))
-			{
-				KrateiCubeManager.getInstance().removeParticipant(player);
-				player.sendPacket(SystemMessageId.COLISEUM_OLYMPIAD_KRATEIS_APPLICANTS_CANNOT_PARTICIPATE));
-			}
-			*/
 			
-			if(_registrationPenalty.contains(player.getObjectId()))
+			// if(UnderGroundColiseum.getInstance().isRegisteredPlayer(player))
+			// {
+			// UngerGroundColiseum.getInstance().removeParticipant(player);
+			// player.sendPacket(SystemMessageId.COLISEUM_OLYMPIAD_KRATEIS_APPLICANTS_CANNOT_PARTICIPATE));
+			// }
+			// if(KrateiCubeManager.getInstance().isRegisteredPlayer(player))
+			// {
+			// KrateiCubeManager.getInstance().removeParticipant(player);
+			// player.sendPacket(SystemMessageId.COLISEUM_OLYMPIAD_KRATEIS_APPLICANTS_CANNOT_PARTICIPATE));
+			// }
+			
+			if (_registrationPenalty.contains(player.getObjectId()))
 			{
 				player.sendPacket(SystemMessageId.CANNOT_REQUEST_REGISTRATION_10_SECS_AFTER);
 				return false;
 			}
 			
-			if(holder.getBlueTeamSize() < holder.getRedTeamSize())
+			if (holder.getBlueTeamSize() < holder.getRedTeamSize())
 			{
 				holder.addPlayer(player, 1);
 				isRed = false;
@@ -207,17 +206,15 @@ public final class HandysBlockCheckerManager
 	}
 	
 	/**
-	 * Will remove the specified player from the specified 
-	 * team and arena and will send the needed packet to all
-	 * his team mates / enemy team mates
+	 * Will remove the specified player from the specified team and arena and will send the needed packet to all his team mates / enemy team mates
 	 * @param player
 	 * @param arenaId
-	 * @param team 
+	 * @param team
 	 */
 	public void removePlayer(L2PcInstance player, int arenaId, int team)
 	{
 		ArenaParticipantsHolder holder = _arenaPlayers[arenaId];
-		synchronized(holder)
+		synchronized (holder)
 		{
 			boolean isRed = team == 0 ? true : false;
 			
@@ -225,20 +222,23 @@ public final class HandysBlockCheckerManager
 			holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed));
 			
 			// End event if theres an empty team
-			int teamSize = isRed? holder.getRedTeamSize() : holder.getBlueTeamSize();
-			if(teamSize == 0)
+			int teamSize = isRed ? holder.getRedTeamSize() : holder.getBlueTeamSize();
+			if (teamSize == 0)
+			{
 				holder.getEvent().endEventAbnormally();
+			}
 			
 			Integer objId = player.getObjectId();
-			if(!_registrationPenalty.contains(objId))
+			if (!_registrationPenalty.contains(objId))
+			{
 				_registrationPenalty.add(objId);
+			}
 			schedulePenaltyRemoval(objId);
 		}
 	}
 	
 	/**
-	 * Will change the player from one team to other (if possible)
-	 * and will send the needed packets
+	 * Will change the player from one team to other (if possible) and will send the needed packets
 	 * @param player
 	 * @param arena
 	 * @param team
@@ -247,28 +247,32 @@ public final class HandysBlockCheckerManager
 	{
 		ArenaParticipantsHolder holder = _arenaPlayers[arena];
 		
-		synchronized(holder)
+		synchronized (holder)
 		{
 			boolean isFromRed = holder._redPlayers.contains(player);
 			
-			if(isFromRed && holder.getBlueTeamSize() == 6)
+			if (isFromRed && (holder.getBlueTeamSize() == 6))
 			{
 				player.sendMessage("The team is full");
 				return;
 			}
-			else if(!isFromRed && holder.getRedTeamSize() == 6)
+			else if (!isFromRed && (holder.getRedTeamSize() == 6))
 			{
 				player.sendMessage("The team is full");
 				return;
 			}
 			
-			int futureTeam = isFromRed? 1 : 0;
+			int futureTeam = isFromRed ? 1 : 0;
 			holder.addPlayer(player, futureTeam);
 			
-			if(isFromRed)
+			if (isFromRed)
+			{
 				holder.removePlayer(player, 0);
+			}
 			else
+			{
 				holder.removePlayer(player, 1);
+			}
 			holder.broadCastPacketToTeam(new ExCubeGameChangeTeam(player, isFromRed));
 		}
 	}
@@ -289,8 +293,10 @@ public final class HandysBlockCheckerManager
 	 */
 	public boolean arenaIsBeingUsed(int arenaId)
 	{
-		if(arenaId < 0 || arenaId > 3) 
+		if ((arenaId < 0) || (arenaId > 3))
+		{
 			return false;
+		}
 		return _arenaStatus.get(arenaId);
 	}
 	
@@ -304,8 +310,7 @@ public final class HandysBlockCheckerManager
 	}
 	
 	/**
-	 * Set as free the specified arena for future
-	 * events
+	 * Set as free the specified arena for future events
 	 * @param arenaId
 	 */
 	public void setArenaFree(int arenaId)
@@ -314,8 +319,7 @@ public final class HandysBlockCheckerManager
 	}
 	
 	/**
-	 * Called when played logs out while participating
-	 * in Block Checker Event
+	 * Called when played logs out while participating in Block Checker Event
 	 * @param player
 	 */
 	public void onDisconnect(L2PcInstance player)
@@ -323,7 +327,7 @@ public final class HandysBlockCheckerManager
 		int arena = player.getBlockCheckerArena();
 		int team = getHolder(arena).getPlayerTeam(player);
 		HandysBlockCheckerManager.getInstance().removePlayer(player, arena, team);
-		if (player.getTeam() > 0 )
+		if (player.getTeam() > 0)
 		{
 			player.stopAllEffects();
 			// Remove team aura
@@ -332,12 +336,12 @@ public final class HandysBlockCheckerManager
 			// Remove the event items
 			PcInventory inv = player.getInventory();
 			
-			if(inv.getItemByItemId(13787) != null)
+			if (inv.getItemByItemId(13787) != null)
 			{
 				long count = inv.getInventoryItemCount(13787, 0);
 				inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player);
 			}
-			if(inv.getItemByItemId(13788) != null)
+			if (inv.getItemByItemId(13788) != null)
 			{
 				long count = inv.getInventoryItemCount(13788, 0);
 				inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player);
@@ -383,28 +387,42 @@ public final class HandysBlockCheckerManager
 		
 		public void addPlayer(L2PcInstance player, int team)
 		{
-			if(team == 0)
+			if (team == 0)
+			{
 				_redPlayers.add(player);
+			}
 			else
+			{
 				_bluePlayers.add(player);
+			}
 		}
 		
 		public void removePlayer(L2PcInstance player, int team)
 		{
-			if(team == 0)
+			if (team == 0)
+			{
 				_redPlayers.remove(player);
+			}
 			else
+			{
 				_bluePlayers.remove(player);
+			}
 		}
 		
 		public int getPlayerTeam(L2PcInstance player)
 		{
-			if(_redPlayers.contains(player))
+			if (_redPlayers.contains(player))
+			{
 				return 0;
-			else if(_bluePlayers.contains(player))
+			}
+			else if (_bluePlayers.contains(player))
+			{
 				return 1;
+			}
 			else
+			{
 				return -1;
+			}
 		}
 		
 		public int getRedTeamSize()
@@ -419,10 +437,14 @@ public final class HandysBlockCheckerManager
 		
 		public void broadCastPacketToTeam(L2GameServerPacket packet)
 		{
-			for(L2PcInstance p : _redPlayers)
+			for (L2PcInstance p : _redPlayers)
+			{
 				p.sendPacket(packet);
-			for(L2PcInstance p : _bluePlayers)
+			}
+			for (L2PcInstance p : _bluePlayers)
+			{
 				p.sendPacket(packet);
+			}
 		}
 		
 		public void clearPlayers()
@@ -445,25 +467,31 @@ public final class HandysBlockCheckerManager
 		{
 			int redSize = _redPlayers.size();
 			int blueSize = _bluePlayers.size();
-			if(redSize > blueSize + 1)
+			if (redSize > (blueSize + 1))
 			{
 				broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.TEAM_ADJUSTED_BECAUSE_WRONG_POPULATION_RATIO));
 				int needed = redSize - (blueSize + 1);
-				for(int i = 0; i < needed+1; i++)
+				for (int i = 0; i < (needed + 1); i++)
 				{
 					L2PcInstance plr = _redPlayers.get(i);
-					if(plr == null) continue;
+					if (plr == null)
+					{
+						continue;
+					}
 					changePlayerToTeam(plr, _arena, 1);
 				}
 			}
-			else if(blueSize > redSize + 1)
+			else if (blueSize > (redSize + 1))
 			{
 				broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.TEAM_ADJUSTED_BECAUSE_WRONG_POPULATION_RATIO));
 				int needed = blueSize - (redSize + 1);
-				for(int i = 0; i < needed+1; i++)
+				for (int i = 0; i < (needed + 1); i++)
 				{
 					L2PcInstance plr = _bluePlayers.get(i);
-					if(plr == null) continue;
+					if (plr == null)
+					{
+						continue;
+					}
 					changePlayerToTeam(plr, _arena, 0);
 				}
 			}
@@ -478,6 +506,7 @@ public final class HandysBlockCheckerManager
 	private class PenaltyRemove implements Runnable
 	{
 		private final Integer objectId;
+		
 		public PenaltyRemove(Integer id)
 		{
 			objectId = id;

+ 2 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/HellboundManager.java

@@ -39,9 +39,7 @@ public class HellboundManager
 {
 	private static final Logger _log = Logger.getLogger(HellboundManager.class.getName());
 	
-	private static final String LOAD_SPAWNS = "SELECT npc_templateid, locx, locy, locz, heading, " +
-		"respawn_delay, respawn_random, min_hellbound_level, " +
-		"max_hellbound_level FROM hellbound_spawnlist ORDER BY npc_templateid";
+	private static final String LOAD_SPAWNS = "SELECT npc_templateid, locx, locy, locz, heading, " + "respawn_delay, respawn_random, min_hellbound_level, " + "max_hellbound_level FROM hellbound_spawnlist ORDER BY npc_templateid";
 	
 	private int _level = 0;
 	private int _trust = 0;
@@ -52,7 +50,7 @@ public class HellboundManager
 	private final List<HellboundSpawn> _population = new ArrayList<>();
 	
 	protected HellboundManager()
-	{	
+	{
 		loadData();
 		loadSpawns();
 	}

+ 6 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/ItemAuctionManager.java

@@ -14,8 +14,6 @@
  */
 package com.l2jserver.gameserver.instancemanager;
 
-import gnu.trove.map.hash.TIntObjectHashMap;
-
 import java.io.File;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
@@ -36,6 +34,8 @@ import com.l2jserver.Config;
 import com.l2jserver.L2DatabaseFactory;
 import com.l2jserver.gameserver.model.itemauction.ItemAuctionInstance;
 
+import gnu.trove.map.hash.TIntObjectHashMap;
+
 /**
  * @author Forsaiken
  */
@@ -62,7 +62,9 @@ public final class ItemAuctionManager
 			ResultSet rset = statement.executeQuery("SELECT auctionId FROM item_auction ORDER BY auctionId DESC LIMIT 0, 1"))
 		{
 			if (rset.next())
+			{
 				_auctionIds.set(rset.getInt(1) + 1);
+			}
 		}
 		catch (final SQLException e)
 		{
@@ -95,7 +97,9 @@ public final class ItemAuctionManager
 							final int instanceId = Integer.parseInt(nab.getNamedItem("id").getNodeValue());
 							
 							if (_managerInstances.containsKey(instanceId))
+							{
 								throw new Exception("Dublicated instanceId " + instanceId);
+							}
 							
 							final ItemAuctionInstance instance = new ItemAuctionInstance(instanceId, _auctionIds, nb);
 							_managerInstances.put(instanceId, instance);

+ 0 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/ItemsOnGroundManager.java

@@ -192,7 +192,6 @@ public class ItemsOnGroundManager implements Runnable
 		}
 	}
 	
-
 	@Override
 	public synchronized void run()
 	{

+ 29 - 19
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/MailManager.java

@@ -38,13 +38,13 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
 import com.l2jserver.util.L2FastMap;
 
 /**
- * @author Migi, DS<br>
+ * @author Migi, DS
  */
 public class MailManager
 {
 	private static Logger _log = Logger.getLogger(MailManager.class.getName());
 	
-	private Map<Integer, Message> _messages = new L2FastMap<>(true);
+	private final Map<Integer, Message> _messages = new L2FastMap<>(true);
 	
 	protected MailManager()
 	{
@@ -56,7 +56,7 @@ public class MailManager
 		int count = 0;
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
 		{
-			PreparedStatement statement = con.prepareStatement("SELECT * FROM messages ORDER BY expiration");			
+			PreparedStatement statement = con.prepareStatement("SELECT * FROM messages ORDER BY expiration");
 			ResultSet rset1 = statement.executeQuery();
 			while (rset1.next())
 			{
@@ -71,9 +71,13 @@ public class MailManager
 				long expiration = msg.getExpiration();
 				
 				if (expiration < System.currentTimeMillis())
+				{
 					ThreadPoolManager.getInstance().scheduleGeneral(new MessageDeletionTask(msgId), 10000);
+				}
 				else
+				{
 					ThreadPoolManager.getInstance().scheduleGeneral(new MessageDeletionTask(msgId), expiration - System.currentTimeMillis());
+				}
 			}
 			rset1.close();
 			statement.close();
@@ -100,10 +104,10 @@ public class MailManager
 		final int objectId = player.getObjectId();
 		for (Message msg : getMessages())
 		{
-			if (msg != null
-					&& msg.getReceiverId() == objectId
-					&& msg.isUnread())
+			if ((msg != null) && (msg.getReceiverId() == objectId) && msg.isUnread())
+			{
 				return true;
+			}
 		}
 		return false;
 	}
@@ -113,10 +117,10 @@ public class MailManager
 		int size = 0;
 		for (Message msg : getMessages())
 		{
-			if (msg != null
-					&& msg.getReceiverId() == objectId
-					&& !msg.isDeletedByReceiver())
+			if ((msg != null) && (msg.getReceiverId() == objectId) && !msg.isDeletedByReceiver())
+			{
 				size++;
+			}
 		}
 		return size;
 	}
@@ -126,10 +130,10 @@ public class MailManager
 		int size = 0;
 		for (Message msg : getMessages())
 		{
-			if (msg != null
-					&& msg.getSenderId() == objectId
-					&& !msg.isDeletedBySender())
+			if ((msg != null) && (msg.getSenderId() == objectId) && !msg.isDeletedBySender())
+			{
 				size++;
+			}
 		}
 		return size;
 	}
@@ -139,10 +143,10 @@ public class MailManager
 		List<Message> inbox = new FastList<>();
 		for (Message msg : getMessages())
 		{
-			if (msg != null
-					&& msg.getReceiverId() == objectId
-					&& !msg.isDeletedByReceiver())
+			if ((msg != null) && (msg.getReceiverId() == objectId) && !msg.isDeletedByReceiver())
+			{
 				inbox.add(msg);
+			}
 		}
 		return inbox;
 	}
@@ -152,10 +156,10 @@ public class MailManager
 		List<Message> outbox = new FastList<>();
 		for (Message msg : getMessages())
 		{
-			if (msg != null
-					&& msg.getSenderId() == objectId
-					&& !msg.isDeletedBySender())
+			if ((msg != null) && (msg.getSenderId() == objectId) && !msg.isDeletedBySender())
+			{
 				outbox.add(msg);
+			}
 		}
 		return outbox;
 	}
@@ -176,7 +180,9 @@ public class MailManager
 		
 		final L2PcInstance receiver = L2World.getInstance().getPlayer(msg.getReceiverId());
 		if (receiver != null)
+		{
 			receiver.sendPacket(ExNoticePostArrived.valueOf(true));
+		}
 		
 		ThreadPoolManager.getInstance().scheduleGeneral(new MessageDeletionTask(msg.getId()), msg.getExpiration() - System.currentTimeMillis());
 	}
@@ -197,7 +203,9 @@ public class MailManager
 		{
 			final Message msg = getMessage(_msgId);
 			if (msg == null)
+			{
 				return;
+			}
 			
 			if (msg.hasAttachments())
 			{
@@ -210,7 +218,9 @@ public class MailManager
 						sender.sendPacket(SystemMessageId.MAIL_RETURNED);
 					}
 					else
+					{
 						msg.getAttachments().returnToWh(null);
+					}
 					
 					msg.getAttachments().deleteMe();
 					msg.removeAttachments();
@@ -219,7 +229,7 @@ public class MailManager
 					if (receiver != null)
 					{
 						SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.MAIL_RETURNED);
-						//sm.addString(msg.getReceiverName());
+						// sm.addString(msg.getReceiverName());
 						receiver.sendPacket(sm);
 					}
 				}

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác