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 years ago
parent
commit
15293bcdbb
100 changed files with 4082 additions and 2689 deletions
  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

File diff suppressed because it is too large
+ 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)
 			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(";");
 			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...");
 				_log.log(Level.INFO, "Network Config: ipconfig.xml exists using manual configuration...");
 				parseFile(new File(IP_CONFIG_FILE));
 				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...");
 				_log.log(Level.INFO, "Network Config: ipconfig.xml doesn't exists using automatic configuration...");
 				autoIpConfig();
 				autoIpConfig();
@@ -4363,7 +4364,7 @@ public final class Config
 		protected void autoIpConfig()
 		protected void autoIpConfig()
 		{
 		{
 			String externalIp = "127.0.0.1";
 			String externalIp = "127.0.0.1";
-			try 
+			try
 			{
 			{
 				URL autoIp = new URL("http://api.externalip.net/ip/");
 				URL autoIp = new URL("http://api.externalip.net/ip/");
 				try (BufferedReader in = new BufferedReader(new InputStreamReader(autoIp.openStream())))
 				try (BufferedReader in = new BufferedReader(new InputStreamReader(autoIp.openStream())))
@@ -4387,15 +4388,21 @@ public final class Config
 					NetworkInterface ni = niList.nextElement();
 					NetworkInterface ni = niList.nextElement();
 					
 					
 					if (!ni.isUp() || ni.isVirtual())
 					if (!ni.isUp() || ni.isVirtual())
+					{
 						continue;
 						continue;
+					}
 					
 					
-					if (!ni.isLoopback() && ni.getHardwareAddress().length != 6)
+					if (!ni.isLoopback() && (ni.getHardwareAddress().length != 6))
+					{
 						continue;
 						continue;
+					}
 					
 					
 					for (InterfaceAddress ia : ni.getInterfaceAddresses())
 					for (InterfaceAddress ia : ni.getInterfaceAddresses())
 					{
 					{
 						if (ia.getAddress() instanceof Inet6Address)
 						if (ia.getAddress() instanceof Inet6Address)
+						{
 							continue;
 							continue;
+						}
 						
 						
 						sub.setIPAddress(ia.getAddress().getHostAddress());
 						sub.setIPAddress(ia.getAddress().getHostAddress());
 						sub.setMaskedBits(ia.getNetworkPrefixLength());
 						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.gameserver.util.Broadcast;
 import com.l2jserver.util.StringUtil;
 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
 public class Announcements
 {
 {
 	private static Logger _log = Logger.getLogger(Announcements.class.getName());
 	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()
 	protected Announcements()
 	{
 	{
@@ -70,7 +65,9 @@ public class Announcements
 		readFromDisk("data/critannouncements.txt", _critAnnouncements);
 		readFromDisk("data/critannouncements.txt", _critAnnouncements);
 		
 		
 		if (Config.DEBUG)
 		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)
 	public void showAnnouncements(L2PcInstance activeChar)
@@ -98,9 +95,9 @@ public class Announcements
 			if (!validDateRange.isValid() || validDateRange.isWithinRange(currentDate))
 			if (!validDateRange.isValid() || validDateRange.isWithinRange(currentDate))
 			{
 			{
 				SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1);
 				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);
 				activeChar.sendPacket(sm);
 			}
 			}
@@ -124,8 +121,7 @@ public class Announcements
 		final StringBuilder replyMSG = StringUtil.startAppend(500, "<br>");
 		final StringBuilder replyMSG = StringUtil.startAppend(500, "<br>");
 		for (int i = 0; i < _announcements.size(); i++)
 		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());
 		adminReply.replace("%announces%", replyMSG.toString());
 		activeChar.sendPacket(adminReply);
 		activeChar.sendPacket(adminReply);
@@ -139,8 +135,7 @@ public class Announcements
 		final StringBuilder replyMSG = StringUtil.startAppend(500, "<br>");
 		final StringBuilder replyMSG = StringUtil.startAppend(500, "<br>");
 		for (int i = 0; i < _critAnnouncements.size(); i++)
 		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());
 		adminReply.replace("%critannounces%", replyMSG.toString());
 		activeChar.sendPacket(adminReply);
 		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.entity.Castle;
 import com.l2jserver.gameserver.model.itemcontainer.ItemContainer;
 import com.l2jserver.gameserver.model.itemcontainer.ItemContainer;
 
 
-
 /**
 /**
  * Class managing periodical events with castle
  * Class managing periodical events with castle
  * @author Thorgrim - 2005
  * @author Thorgrim - 2005
@@ -31,7 +30,7 @@ import com.l2jserver.gameserver.model.itemcontainer.ItemContainer;
 public class CastleUpdater implements Runnable
 public class CastleUpdater implements Runnable
 {
 {
 	protected static final Logger _log = Logger.getLogger(CastleUpdater.class.getName());
 	protected static final Logger _log = Logger.getLogger(CastleUpdater.class.getName());
-	private L2Clan _clan;
+	private final L2Clan _clan;
 	private int _runCount = 0;
 	private int _runCount = 0;
 	
 	
 	public CastleUpdater(L2Clan clan, int runCount)
 	public CastleUpdater(L2Clan clan, int runCount)
@@ -52,12 +51,14 @@ public class CastleUpdater implements Runnable
 				Castle castle = CastleManager.getInstance().getCastleById(_clan.getCastleId());
 				Castle castle = CastleManager.getInstance().getCastleById(_clan.getCastleId());
 				if (!Config.ALT_MANOR_SAVE_ALL_ACTIONS)
 				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.saveSeedData();
 						castle.saveCropData();
 						castle.saveCropData();
 						if (Config.DEBUG)
 						if (Config.DEBUG)
+						{
 							_log.info("Manor System: all data for " + castle.getName() + " saved");
 							_log.info("Manor System: all data for " + castle.getName() + " saved");
+						}
 					}
 					}
 				}
 				}
 				CastleUpdater cu = new CastleUpdater(_clan, ++_runCount);
 				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
 public class FortUpdater implements Runnable
 {
 {
 	protected static Logger _log = Logger.getLogger(FortUpdater.class.getName());
 	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 int _runCount;
-	private UpdaterType _updaterType;
+	private final UpdaterType _updaterType;
 	
 	
 	public enum UpdaterType
 	public enum UpdaterType
 	{
 	{
@@ -53,12 +53,14 @@ public class FortUpdater implements Runnable
 	{
 	{
 		try
 		try
 		{
 		{
-			switch(_updaterType)
+			switch (_updaterType)
 			{
 			{
 				case PERIODIC_UPDATE:
 				case PERIODIC_UPDATE:
 					_runCount++;
 					_runCount++;
-					if (_fort.getOwnerClan() == null || _fort.getOwnerClan() != _clan)
+					if ((_fort.getOwnerClan() == null) || (_fort.getOwnerClan() != _clan))
+					{
 						return;
 						return;
+					}
 					
 					
 					_fort.setBloodOathReward(_fort.getBloodOathReward() + Config.FS_BLOOD_OATH_COUNT);
 					_fort.setBloodOathReward(_fort.getBloodOathReward() + Config.FS_BLOOD_OATH_COUNT);
 					if (_fort.getFortState() == 2)
 					if (_fort.getFortState() == 2)
@@ -70,14 +72,18 @@ public class FortUpdater implements Runnable
 							_fort.raiseSupplyLvL();
 							_fort.raiseSupplyLvL();
 						}
 						}
 						else
 						else
+						{
 							_fort.setFortState(1, 0);
 							_fort.setFortState(1, 0);
+						}
 					}
 					}
 					_fort.saveFortVariables();
 					_fort.saveFortVariables();
 					break;
 					break;
 				case MAX_OWN_TIME:
 				case MAX_OWN_TIME:
-					if (_fort.getOwnerClan() == null || _fort.getOwnerClan() != _clan)
+					if ((_fort.getOwnerClan() == null) || (_fort.getOwnerClan() != _clan))
+					{
 						return;
 						return;
-					if (_fort.getOwnedTime() > Config.FS_MAX_OWN_TIME * 3600)
+					}
+					if (_fort.getOwnedTime() > (Config.FS_MAX_OWN_TIME * 3600))
 					{
 					{
 						_fort.removeOwner(true);
 						_fort.removeOwner(true);
 						_fort.setFortState(0, 0);
 						_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.DeadLockDetector;
 import com.l2jserver.util.IPv4Filter;
 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
 public class GameServer
 {
 {
 	private static final Logger _log = Logger.getLogger(GameServer.class.getName());
 	private static final Logger _log = Logger.getLogger(GameServer.class.getName());
@@ -246,7 +241,7 @@ public class GameServer
 		PetDataTable.getInstance();
 		PetDataTable.getInstance();
 		CharSummonTable.getInstance().init();
 		CharSummonTable.getInstance().init();
 		
 		
-		printSection("Clans"); 
+		printSection("Clans");
 		ClanTable.getInstance();
 		ClanTable.getInstance();
 		CHSiegeManager.getInstance();
 		CHSiegeManager.getInstance();
 		ClanHallManager.getInstance();
 		ClanHallManager.getInstance();
@@ -255,7 +250,9 @@ public class GameServer
 		printSection("Geodata");
 		printSection("Geodata");
 		GeoData.getInstance();
 		GeoData.getInstance();
 		if (Config.GEODATA == 2)
 		if (Config.GEODATA == 2)
+		{
 			PathFinding.getInstance();
 			PathFinding.getInstance();
+		}
 		
 		
 		printSection("NPCs");
 		printSection("NPCs");
 		HerbDropTable.getInstance();
 		HerbDropTable.getInstance();
@@ -314,8 +311,10 @@ public class GameServer
 		{
 		{
 			_log.info(getClass().getSimpleName() + ": Loading Server Scripts");
 			_log.info(getClass().getSimpleName() + ": Loading Server Scripts");
 			File scripts = new File(Config.DATAPACK_ROOT, "data/scripts.cfg");
 			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);
 				L2ScriptEngineManager.getInstance().executeScriptList(scripts);
+			}
 		}
 		}
 		catch (IOException ioe)
 		catch (IOException ioe)
 		{
 		{
@@ -326,10 +325,14 @@ public class GameServer
 		TransformationManager.getInstance().report();
 		TransformationManager.getInstance().report();
 		
 		
 		if (Config.SAVE_DROPPED_ITEM)
 		if (Config.SAVE_DROPPED_ITEM)
+		{
 			ItemsOnGroundManager.getInstance();
 			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();
 			ItemsAutoDestroy.getInstance();
+		}
 		
 		
 		MonsterRace.getInstance();
 		MonsterRace.getInstance();
 		
 		
@@ -345,20 +348,26 @@ public class GameServer
 		_log.info("AutoSpawnHandler: Loaded " + AutoSpawnHandler.getInstance().size() + " handlers in total.");
 		_log.info("AutoSpawnHandler: Loaded " + AutoSpawnHandler.getInstance().size() + " handlers in total.");
 		
 		
 		if (Config.L2JMOD_ALLOW_WEDDING)
 		if (Config.L2JMOD_ALLOW_WEDDING)
+		{
 			CoupleManager.getInstance();
 			CoupleManager.getInstance();
+		}
 		
 		
 		TaskManager.getInstance();
 		TaskManager.getInstance();
-
+		
 		AntiFeedManager.getInstance().registerEvent(AntiFeedManager.GAME_ID);
 		AntiFeedManager.getInstance().registerEvent(AntiFeedManager.GAME_ID);
 		MerchantPriceConfigTable.getInstance().updateReferences();
 		MerchantPriceConfigTable.getInstance().updateReferences();
 		CastleManager.getInstance().activateInstances();
 		CastleManager.getInstance().activateInstances();
 		FortManager.getInstance().activateInstances();
 		FortManager.getInstance().activateInstances();
 		
 		
 		if (Config.ALLOW_MAIL)
 		if (Config.ALLOW_MAIL)
+		{
 			MailManager.getInstance();
 			MailManager.getInstance();
+		}
 		
 		
 		if (Config.ACCEPT_GEOEDITOR_CONN)
 		if (Config.ACCEPT_GEOEDITOR_CONN)
+		{
 			GeoEditorListener.getInstance();
 			GeoEditorListener.getInstance();
+		}
 		
 		
 		Runtime.getRuntime().addShutdownHook(Shutdown.getInstance());
 		Runtime.getRuntime().addShutdownHook(Shutdown.getInstance());
 		
 		
@@ -368,7 +377,9 @@ public class GameServer
 		KnownListUpdateTaskManager.getInstance();
 		KnownListUpdateTaskManager.getInstance();
 		
 		
 		if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
 		if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
+		{
 			OfflineTradersTable.getInstance().restoreOfflineTraders();
 			OfflineTradersTable.getInstance().restoreOfflineTraders();
+		}
 		
 		
 		if (Config.DEADLOCK_DETECTOR)
 		if (Config.DEADLOCK_DETECTOR)
 		{
 		{
@@ -377,12 +388,14 @@ public class GameServer
 			_deadDetectThread.start();
 			_deadDetectThread.start();
 		}
 		}
 		else
 		else
+		{
 			_deadDetectThread = null;
 			_deadDetectThread = null;
+		}
 		System.gc();
 		System.gc();
 		// maxMemory is the upper limit the jvm can use, totalMemory the size of
 		// maxMemory is the upper limit the jvm can use, totalMemory the size of
 		// the current allocation pool, freeMemory the unused memory in the
 		// the current allocation pool, freeMemory the unused memory in the
 		// allocation pool
 		// 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;
 		long totalMem = Runtime.getRuntime().maxMemory() / 1048576;
 		_log.info(getClass().getSimpleName() + ": Started, free memory " + freeMem + " Mb of " + totalMem + " Mb");
 		_log.info(getClass().getSimpleName() + ": Started, free memory " + freeMem + " Mb of " + totalMem + " Mb");
 		Toolkit.getDefaultToolkit().beep();
 		Toolkit.getDefaultToolkit().beep();
@@ -471,7 +484,9 @@ public class GameServer
 	{
 	{
 		s = "=[ " + s + " ]";
 		s = "=[ " + s + " ]";
 		while (s.length() < 78)
 		while (s.length() < 78)
+		{
 			s = "-" + s;
 			s = "-" + s;
+		}
 		_log.info(s);
 		_log.info(s);
 	}
 	}
 }
 }

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

@@ -14,9 +14,6 @@
  */
  */
 package com.l2jserver.gameserver;
 package com.l2jserver.gameserver;
 
 
-import gnu.trove.map.hash.TIntObjectHashMap;
-import gnu.trove.procedure.TObjectProcedure;
-
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.logging.Level;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 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.instancemanager.DayNightSpawnManager;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Character;
 
 
+import gnu.trove.map.hash.TIntObjectHashMap;
+import gnu.trove.procedure.TObjectProcedure;
+
 /**
 /**
  * Removed TimerThread watcher [DrHouse]<br>
  * Removed TimerThread watcher [DrHouse]<br>
  * One in-game day is 240 real minutes.
  * One in-game day is 240 real minutes.
@@ -107,7 +107,9 @@ public class GameTimeController
 	public void registerMovingObject(L2Character cha)
 	public void registerMovingObject(L2Character cha)
 	{
 	{
 		if (cha == null)
 		if (cha == null)
+		{
 			return;
 			return;
+		}
 		
 		
 		_lock.lock();
 		_lock.lock();
 		try
 		try
@@ -124,9 +126,8 @@ public class GameTimeController
 	 * Move all characters contained in movingObjects of GameTimeController.<br>
 	 * Move all characters contained in movingObjects of GameTimeController.<br>
 	 * All characters in movement are identified in <b>movingObjects</b> of GameTimeController.<br>
 	 * All characters in movement are identified in <b>movingObjects</b> of GameTimeController.<br>
 	 * <b><u> Actions</u> :</b><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()
 	protected void moveObjects()
 	{
 	{
@@ -185,7 +186,7 @@ public class GameTimeController
 			long runtime;
 			long runtime;
 			int sleepTime;
 			int sleepTime;
 			
 			
-			for(;;)
+			for (;;)
 			{
 			{
 				try
 				try
 				{
 				{
@@ -195,22 +196,28 @@ public class GameTimeController
 					_gameTicks = (int) (runtime / MILLIS_IN_TICK); // new ticks value (ticks now)
 					_gameTicks = (int) (runtime / MILLIS_IN_TICK); // new ticks value (ticks now)
 					
 					
 					if (oldTicks != _gameTicks)
 					if (oldTicks != _gameTicks)
+					{
 						moveObjects(); // Runs possibly too often
 						moveObjects(); // Runs possibly too often
+					}
 					
 					
 					runtime = (System.currentTimeMillis() - _gameStartTime) - runtime;
 					runtime = (System.currentTimeMillis() - _gameStartTime) - runtime;
 					
 					
 					// calculate sleep time... time needed to next tick minus time it takes to call moveObjects()
 					// 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)
 					if (sleepTime > 0)
+					{
 						Thread.sleep(sleepTime);
 						Thread.sleep(sleepTime);
+					}
 				}
 				}
 				catch (InterruptedException ie)
 				catch (InterruptedException ie)
 				{
 				{
 					if (_interruptRequest)
 					if (_interruptRequest)
+					{
 						return;
 						return;
+					}
 					
 					
 					_log.log(Level.WARNING, "", ie);
 					_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 (_ended.hasAI()) // AI could be just disabled due to region turn off
 				{
 				{
 					if (Config.MOVE_BASED_KNOWNLIST)
 					if (Config.MOVE_BASED_KNOWNLIST)
+					{
 						_ended.getKnownList().findObjects();
 						_ended.getKnownList().findObjects();
+					}
 					_ended.getAI().notifyEvent(CtrlEvent.EVT_ARRIVED);
 					_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;
 import com.l2jserver.gameserver.model.items.type.L2EtcItemType;
 
 
 public class ItemsAutoDestroy
 public class ItemsAutoDestroy
-{	
+{
 	protected List<L2ItemInstance> _items = null;
 	protected List<L2ItemInstance> _items = null;
 	protected static long _sleep;
 	protected static long _sleep;
 	
 	
@@ -33,8 +33,10 @@ public class ItemsAutoDestroy
 	{
 	{
 		_items = new FastList<>();
 		_items = new FastList<>();
 		_sleep = Config.AUTODESTROY_ITEM_AFTER * 1000;
 		_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;
 			_sleep = 3600000;
+		}
 		ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new CheckItemsForDestroy(), 5000, 5000);
 		ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new CheckItemsForDestroy(), 5000, 5000);
 	}
 	}
 	
 	
@@ -52,13 +54,17 @@ public class ItemsAutoDestroy
 	public synchronized void removeItems()
 	public synchronized void removeItems()
 	{
 	{
 		if (_items.isEmpty())
 		if (_items.isEmpty())
+		{
 			return;
 			return;
+		}
 		
 		
 		long curtime = System.currentTimeMillis();
 		long curtime = System.currentTimeMillis();
 		for (L2ItemInstance item : _items)
 		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);
 				_items.remove(item);
+			}
 			else
 			else
 			{
 			{
 				if (item.getItem().getAutoDestroyTime() > 0)
 				if (item.getItem().getAutoDestroyTime() > 0)
@@ -69,7 +75,9 @@ public class ItemsAutoDestroy
 						L2World.getInstance().removeObject(item);
 						L2World.getInstance().removeObject(item);
 						_items.remove(item);
 						_items.remove(item);
 						if (Config.SAVE_DROPPED_ITEM)
 						if (Config.SAVE_DROPPED_ITEM)
+						{
 							ItemsOnGroundManager.getInstance().removeObject(item);
 							ItemsOnGroundManager.getInstance().removeObject(item);
+						}
 					}
 					}
 				}
 				}
 				else if (item.getItemType() == L2EtcItemType.HERB)
 				else if (item.getItemType() == L2EtcItemType.HERB)
@@ -80,7 +88,9 @@ public class ItemsAutoDestroy
 						L2World.getInstance().removeObject(item);
 						L2World.getInstance().removeObject(item);
 						_items.remove(item);
 						_items.remove(item);
 						if (Config.SAVE_DROPPED_ITEM)
 						if (Config.SAVE_DROPPED_ITEM)
+						{
 							ItemsOnGroundManager.getInstance().removeObject(item);
 							ItemsOnGroundManager.getInstance().removeObject(item);
+						}
 					}
 					}
 				}
 				}
 				else if ((curtime - item.getDropTime()) > _sleep)
 				else if ((curtime - item.getDropTime()) > _sleep)
@@ -89,10 +99,12 @@ public class ItemsAutoDestroy
 					L2World.getInstance().removeObject(item);
 					L2World.getInstance().removeObject(item);
 					_items.remove(item);
 					_items.remove(item);
 					if (Config.SAVE_DROPPED_ITEM)
 					if (Config.SAVE_DROPPED_ITEM)
+					{
 						ItemsOnGroundManager.getInstance().removeObject(item);
 						ItemsOnGroundManager.getInstance().removeObject(item);
+					}
 				}
 				}
 			}
 			}
-		}		
+		}
 	}
 	}
 	
 	
 	protected class CheckItemsForDestroy extends Thread
 	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 _log = Logger.getLogger(LoginServerThread.class.getName());
 	protected static final Logger _logAccounting = Logger.getLogger("accounting");
 	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 static final int REVISION = 0x0106;
 	private RSAPublicKey _publicKey;
 	private RSAPublicKey _publicKey;
 	private final String _hostname;
 	private final String _hostname;
@@ -348,7 +346,7 @@ public class LoginServerThread extends Thread
 			}
 			}
 			catch (UnknownHostException e)
 			catch (UnknownHostException e)
 			{
 			{
-				_log.log(Level.WARNING, "", e);	
+				_log.log(Level.WARNING, "", e);
 			}
 			}
 			catch (SocketException e)
 			catch (SocketException e)
 			{
 			{
@@ -556,7 +554,10 @@ public class LoginServerThread extends Thread
 		if (client != null)
 		if (client != null)
 		{
 		{
 			LogRecord record = new LogRecord(Level.WARNING, "Kicked by login");
 			LogRecord record = new LogRecord(Level.WARNING, "Kicked by login");
-			record.setParameters(new Object[]{client});
+			record.setParameters(new Object[]
+			{
+				client
+			});
 			_logAccounting.log(record);
 			_logAccounting.log(record);
 			client.setAditionalClosePacket(SystemMessage.getSystemMessage(SystemMessageId.ANOTHER_LOGIN_WITH_ACCOUNT));
 			client.setAditionalClosePacket(SystemMessage.getSystemMessage(SystemMessageId.ANOTHER_LOGIN_WITH_ACCOUNT));
 			client.closeNow();
 			client.closeNow();
@@ -583,7 +584,9 @@ public class LoginServerThread extends Thread
 					chars++;
 					chars++;
 					long delTime = rs.getLong("deletetime");
 					long delTime = rs.getLong("deletetime");
 					if (delTime != 0)
 					if (delTime != 0)
+					{
 						charToDel.add(delTime);
 						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.gameserver.model.actor.templates.L2NpcTemplate;
 import com.l2jserver.util.Rnd;
 import com.l2jserver.util.Rnd;
 
 
-
 public class MonsterRace
 public class MonsterRace
 {
 {
 	protected static final Logger _log = Logger.getLogger(MonsterRace.class.getName());
 	protected static final Logger _log = Logger.getLogger(MonsterRace.class.getName());
 	
 	
-	private L2Npc[] _monsters;
+	private final L2Npc[] _monsters;
 	private Constructor<?> _constructor;
 	private Constructor<?> _constructor;
 	private int[][] _speeds;
 	private int[][] _speeds;
-	private int[] _first, _second;
+	private final int[] _first, _second;
 	
 	
 	protected MonsterRace()
 	protected MonsterRace()
 	{
 	{
@@ -78,7 +77,7 @@ public class MonsterRace
 			{
 			{
 				_log.log(Level.WARNING, "", e);
 				_log.log(Level.WARNING, "", e);
 			}
 			}
-			//_log.info("Monster "+i+" is id: "+(id+random));
+			// _log.info("Monster "+i+" is id: "+(id+random));
 		}
 		}
 		newSpeeds();
 		newSpeeds();
 	}
 	}
@@ -95,9 +94,13 @@ public class MonsterRace
 			for (int j = 0; j < 20; j++)
 			for (int j = 0; j < 20; j++)
 			{
 			{
 				if (j == 19)
 				if (j == 19)
+				{
 					_speeds[i][j] = 100;
 					_speeds[i][j] = 100;
+				}
 				else
 				else
+				{
 					_speeds[i][j] = Rnd.get(60) + 65;
 					_speeds[i][j] = Rnd.get(60) + 65;
+				}
 				total += _speeds[i][j];
 				total += _speeds[i][j];
 			}
 			}
 			if (total >= _first[1])
 			if (total >= _first[1])

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

@@ -14,8 +14,6 @@
  */
  */
 package com.l2jserver.gameserver;
 package com.l2jserver.gameserver;
 
 
-import gnu.trove.procedure.TObjectProcedure;
-
 import java.sql.Connection;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 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.network.serverpackets.SystemMessage;
 import com.l2jserver.gameserver.util.Broadcast;
 import com.l2jserver.gameserver.util.Broadcast;
 
 
+import gnu.trove.procedure.TObjectProcedure;
+
 /**
 /**
- *  Seven Signs Engine
- *  @author Tempy
+ * Seven Signs engine.
+ * @author Tempy
  */
  */
 public class SevenSigns
 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_GREEN_ID = 6361;
 	public static final int SEAL_STONE_RED_ID = 6362;
 	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_BLUE_VALUE = 3;
 	public static final int SEAL_STONE_GREEN_VALUE = 5;
 	public static final int SEAL_STONE_GREEN_VALUE = 5;
@@ -127,9 +132,9 @@ public class SevenSigns
 	
 	
 	protected Map<Integer, StatsSet> _signsPlayerData;
 	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 _merchantSpawn;
 	private AutoSpawnInstance _blacksmithSpawn;
 	private AutoSpawnInstance _blacksmithSpawn;
@@ -141,26 +146,15 @@ public class SevenSigns
 	private Map<Integer, AutoSpawnInstance> _preacherSpawns;
 	private Map<Integer, AutoSpawnInstance> _preacherSpawns;
 	private Map<Integer, AutoSpawnInstance> _marketeerSpawns;
 	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 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()
 	protected SevenSigns()
 	{
 	{
@@ -182,14 +176,24 @@ public class SevenSigns
 		initializeSeals();
 		initializeSeals();
 		
 		
 		if (isSealValidationPeriod())
 		if (isSealValidationPeriod())
+		{
 			if (getCabalHighestScore() == CABAL_NULL)
 			if (getCabalHighestScore() == CABAL_NULL)
+			{
 				_log.info("SevenSigns: The competition ended with a tie last week.");
 				_log.info("SevenSigns: The competition ended with a tie last week.");
+			}
 			else
 			else
+			{
 				_log.info("SevenSigns: The " + getCabalName(getCabalHighestScore()) + " were victorious last week.");
 				_log.info("SevenSigns: The " + getCabalName(getCabalHighestScore()) + " were victorious last week.");
+			}
+		}
 		else if (getCabalHighestScore() == CABAL_NULL)
 		else if (getCabalHighestScore() == CABAL_NULL)
+		{
 			_log.info("SevenSigns: The competition, if the current trend continues, will end in a tie this week.");
 			_log.info("SevenSigns: The competition, if the current trend continues, will end in a tie this week.");
+		}
 		else
 		else
+		{
 			_log.info("SevenSigns: The " + getCabalName(getCabalHighestScore()) + " are in the lead this week.");
 			_log.info("SevenSigns: The " + getCabalName(getCabalHighestScore()) + " are in the lead this week.");
+		}
 		
 		
 		long milliToChange = 0;
 		long milliToChange = 0;
 		if (isNextPeriodChangeInPast())
 		if (isNextPeriodChangeInPast())
@@ -202,7 +206,6 @@ public class SevenSigns
 			milliToChange = getMilliToPeriodChange();
 			milliToChange = getMilliToPeriodChange();
 		}
 		}
 		
 		
-		
 		// Schedule a time for the next period change.
 		// Schedule a time for the next period change.
 		SevenSignsPeriodChange sspc = new SevenSignsPeriodChange();
 		SevenSignsPeriodChange sspc = new SevenSignsPeriodChange();
 		ThreadPoolManager.getInstance().scheduleGeneral(sspc, milliToChange);
 		ThreadPoolManager.getInstance().scheduleGeneral(sspc, milliToChange);
@@ -232,7 +235,9 @@ public class SevenSigns
 				lastPeriodChange.set(Calendar.SECOND, 0);
 				lastPeriodChange.set(Calendar.SECOND, 0);
 				// if we hit next week, just turn back 1 week
 				// if we hit next week, just turn back 1 week
 				if (Calendar.getInstance().before(lastPeriodChange))
 				if (Calendar.getInstance().before(lastPeriodChange))
-					lastPeriodChange.add(Calendar.HOUR, -24*7);
+				{
+					lastPeriodChange.add(Calendar.HOUR, -24 * 7);
+				}
 				break;
 				break;
 			case PERIOD_COMP_RECRUITING:
 			case PERIOD_COMP_RECRUITING:
 			case PERIOD_COMP_RESULTS:
 			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
 		// 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 true;
+		}
 		return false;
 		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()
 	public void spawnSevenSignsNPC()
 	{
 	{
@@ -268,60 +272,85 @@ public class SevenSigns
 		if (isSealValidationPeriod() || isCompResultsPeriod())
 		if (isSealValidationPeriod() || isCompResultsPeriod())
 		{
 		{
 			for (AutoSpawnInstance spawnInst : _marketeerSpawns.values())
 			for (AutoSpawnInstance spawnInst : _marketeerSpawns.values())
+			{
 				AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, true);
 				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)
 				if (!Config.ANNOUNCE_MAMMON_SPAWN)
+				{
 					_blacksmithSpawn.setBroadcast(false);
 					_blacksmithSpawn.setBroadcast(false);
+				}
 				
 				
 				if (!AutoSpawnHandler.getInstance().getAutoSpawnInstance(_blacksmithSpawn.getObjectId(), true).isSpawnActive())
 				if (!AutoSpawnHandler.getInstance().getAutoSpawnInstance(_blacksmithSpawn.getObjectId(), true).isSpawnActive())
+				{
 					AutoSpawnHandler.getInstance().setSpawnActive(_blacksmithSpawn, true);
 					AutoSpawnHandler.getInstance().setSpawnActive(_blacksmithSpawn, true);
+				}
 				
 				
 				for (AutoSpawnInstance spawnInst : _oratorSpawns.values())
 				for (AutoSpawnInstance spawnInst : _oratorSpawns.values())
+				{
 					if (!AutoSpawnHandler.getInstance().getAutoSpawnInstance(spawnInst.getObjectId(), true).isSpawnActive())
 					if (!AutoSpawnHandler.getInstance().getAutoSpawnInstance(spawnInst.getObjectId(), true).isSpawnActive())
+					{
 						AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, true);
 						AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, true);
+					}
+				}
 				
 				
 				for (AutoSpawnInstance spawnInst : _preacherSpawns.values())
 				for (AutoSpawnInstance spawnInst : _preacherSpawns.values())
+				{
 					if (!AutoSpawnHandler.getInstance().getAutoSpawnInstance(spawnInst.getObjectId(), true).isSpawnActive())
 					if (!AutoSpawnHandler.getInstance().getAutoSpawnInstance(spawnInst.getObjectId(), true).isSpawnActive())
+					{
 						AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, true);
 						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);
 					AutoChatHandler.getInstance().setAutoChatActive(true);
+				}
 			}
 			}
 			else
 			else
 			{
 			{
 				AutoSpawnHandler.getInstance().setSpawnActive(_blacksmithSpawn, false);
 				AutoSpawnHandler.getInstance().setSpawnActive(_blacksmithSpawn, false);
 				
 				
 				for (AutoSpawnInstance spawnInst : _oratorSpawns.values())
 				for (AutoSpawnInstance spawnInst : _oratorSpawns.values())
+				{
 					AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, false);
 					AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, false);
+				}
 				
 				
 				for (AutoSpawnInstance spawnInst : _preacherSpawns.values())
 				for (AutoSpawnInstance spawnInst : _preacherSpawns.values())
+				{
 					AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, false);
 					AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, false);
+				}
 				
 				
 				AutoChatHandler.getInstance().setAutoChatActive(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)
 				if (!Config.ANNOUNCE_MAMMON_SPAWN)
+				{
 					_merchantSpawn.setBroadcast(false);
 					_merchantSpawn.setBroadcast(false);
+				}
 				
 				
 				if (!AutoSpawnHandler.getInstance().getAutoSpawnInstance(_merchantSpawn.getObjectId(), true).isSpawnActive())
 				if (!AutoSpawnHandler.getInstance().getAutoSpawnInstance(_merchantSpawn.getObjectId(), true).isSpawnActive())
+				{
 					AutoSpawnHandler.getInstance().setSpawnActive(_merchantSpawn, true);
 					AutoSpawnHandler.getInstance().setSpawnActive(_merchantSpawn, true);
+				}
 				
 				
 				switch (getCabalHighestScore())
 				switch (getCabalHighestScore())
 				{
 				{
 					case CABAL_DAWN:
 					case CABAL_DAWN:
 						if (!AutoSpawnHandler.getInstance().getAutoSpawnInstance(_lilithSpawn.getObjectId(), true).isSpawnActive())
 						if (!AutoSpawnHandler.getInstance().getAutoSpawnInstance(_lilithSpawn.getObjectId(), true).isSpawnActive())
+						{
 							AutoSpawnHandler.getInstance().setSpawnActive(_lilithSpawn, true);
 							AutoSpawnHandler.getInstance().setSpawnActive(_lilithSpawn, true);
+						}
 						
 						
 						AutoSpawnHandler.getInstance().setSpawnActive(_anakimSpawn, false);
 						AutoSpawnHandler.getInstance().setSpawnActive(_anakimSpawn, false);
 						
 						
 						for (AutoSpawnInstance dawnCrest : _crestofdawnspawns.values())
 						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);
 								AutoSpawnHandler.getInstance().setSpawnActive(dawnCrest, true);
 							}
 							}
@@ -332,16 +361,18 @@ public class SevenSigns
 							AutoSpawnHandler.getInstance().setSpawnActive(duskCrest, false);
 							AutoSpawnHandler.getInstance().setSpawnActive(duskCrest, false);
 						}
 						}
 						break;
 						break;
-						
+					
 					case CABAL_DUSK:
 					case CABAL_DUSK:
 						if (!AutoSpawnHandler.getInstance().getAutoSpawnInstance(_anakimSpawn.getObjectId(), true).isSpawnActive())
 						if (!AutoSpawnHandler.getInstance().getAutoSpawnInstance(_anakimSpawn.getObjectId(), true).isSpawnActive())
+						{
 							AutoSpawnHandler.getInstance().setSpawnActive(_anakimSpawn, true);
 							AutoSpawnHandler.getInstance().setSpawnActive(_anakimSpawn, true);
+						}
 						
 						
 						AutoSpawnHandler.getInstance().setSpawnActive(_lilithSpawn, false);
 						AutoSpawnHandler.getInstance().setSpawnActive(_lilithSpawn, false);
 						
 						
 						for (AutoSpawnInstance duskCrest : _crestofduskspawns.values())
 						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);
 								AutoSpawnHandler.getInstance().setSpawnActive(duskCrest, true);
 							}
 							}
@@ -384,13 +415,19 @@ public class SevenSigns
 				AutoSpawnHandler.getInstance().setSpawnActive(duskCrest, false);
 				AutoSpawnHandler.getInstance().setSpawnActive(duskCrest, false);
 			}
 			}
 			for (AutoSpawnInstance spawnInst : _oratorSpawns.values())
 			for (AutoSpawnInstance spawnInst : _oratorSpawns.values())
+			{
 				AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, false);
 				AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, false);
+			}
 			
 			
 			for (AutoSpawnInstance spawnInst : _preacherSpawns.values())
 			for (AutoSpawnInstance spawnInst : _preacherSpawns.values())
+			{
 				AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, false);
 				AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, false);
+			}
 			
 			
 			for (AutoSpawnInstance spawnInst : _marketeerSpawns.values())
 			for (AutoSpawnInstance spawnInst : _marketeerSpawns.values())
+			{
 				AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, false);
 				AutoSpawnHandler.getInstance().setSpawnActive(spawnInst, false);
+			}
 			
 			
 			AutoChatHandler.getInstance().setAutoChatActive(false);
 			AutoChatHandler.getInstance().setAutoChatActive(false);
 		}
 		}
@@ -480,7 +517,9 @@ public class SevenSigns
 		int numDays = _nextPeriodChange.get(Calendar.DAY_OF_WEEK) - PERIOD_START_DAY;
 		int numDays = _nextPeriodChange.get(Calendar.DAY_OF_WEEK) - PERIOD_START_DAY;
 		
 		
 		if (numDays < 0)
 		if (numDays < 0)
+		{
 			return 0 - numDays;
 			return 0 - numDays;
+		}
 		
 		
 		return 7 - numDays;
 		return 7 - numDays;
 	}
 	}
@@ -504,14 +543,22 @@ public class SevenSigns
 				int daysToChange = getDaysToPeriodChange();
 				int daysToChange = getDaysToPeriodChange();
 				
 				
 				if (daysToChange == 7)
 				if (daysToChange == 7)
+				{
 					if (_nextPeriodChange.get(Calendar.HOUR_OF_DAY) < PERIOD_START_HOUR)
 					if (_nextPeriodChange.get(Calendar.HOUR_OF_DAY) < PERIOD_START_HOUR)
+					{
 						daysToChange = 0;
 						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;
 						daysToChange = 0;
+					}
+				}
 				
 				
 				// Otherwise...
 				// Otherwise...
 				if (daysToChange > 0)
 				if (daysToChange > 0)
+				{
 					_nextPeriodChange.add(Calendar.DATE, daysToChange);
 					_nextPeriodChange.add(Calendar.DATE, daysToChange);
+				}
 				
 				
 				_nextPeriodChange.set(Calendar.HOUR_OF_DAY, PERIOD_START_HOUR);
 				_nextPeriodChange.set(Calendar.HOUR_OF_DAY, PERIOD_START_HOUR);
 				_nextPeriodChange.set(Calendar.MINUTE, PERIOD_START_MINS);
 				_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
 	 * returns true if the given date is in Seal Validation or in Quest Event Results period
 	 * @param date
 	 * @param date
-	 * @return 
+	 * @return
 	 */
 	 */
 	public boolean isDateInSealValidPeriod(Calendar date)
 	public boolean isDateInSealValidPeriod(Calendar date)
 	{
 	{
@@ -568,10 +615,14 @@ public class SevenSigns
 		long nextQuestStart = 0;
 		long nextQuestStart = 0;
 		long nextValidStart = 0;
 		long nextValidStart = 0;
 		long tillDate = date.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
 		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)
 		while (tillDate < 0)
-			tillDate += (2 * PERIOD_MAJOR_LENGTH + 2 * PERIOD_MINOR_LENGTH);
+		{
+			tillDate += ((2 * PERIOD_MAJOR_LENGTH) + (2 * PERIOD_MINOR_LENGTH));
+		}
 		
 		
 		switch (getCurrentPeriod())
 		switch (getCurrentPeriod())
 		{
 		{
@@ -593,9 +644,10 @@ public class SevenSigns
 				break;
 				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 false;
+		}
 		return true;
 		return true;
 	}
 	}
 	
 	
@@ -608,11 +660,9 @@ public class SevenSigns
 			case CABAL_NULL:
 			case CABAL_NULL:
 				return 0;
 				return 0;
 			case CABAL_DAWN:
 			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:
 			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;
 		return 0;
@@ -651,11 +701,17 @@ public class SevenSigns
 	public final int getCabalHighestScore()
 	public final int getCabalHighestScore()
 	{
 	{
 		if (getCurrentScore(CABAL_DUSK) == getCurrentScore(CABAL_DAWN))
 		if (getCurrentScore(CABAL_DUSK) == getCurrentScore(CABAL_DAWN))
+		{
 			return CABAL_NULL;
 			return CABAL_NULL;
+		}
 		else if (getCurrentScore(CABAL_DUSK) > getCurrentScore(CABAL_DAWN))
 		else if (getCurrentScore(CABAL_DUSK) > getCurrentScore(CABAL_DAWN))
+		{
 			return CABAL_DUSK;
 			return CABAL_DUSK;
+		}
 		else
 		else
+		{
 			return CABAL_DAWN;
 			return CABAL_DAWN;
+		}
 	}
 	}
 	
 	
 	public final int getSealOwner(int seal)
 	public final int getSealOwner(int seal)
@@ -666,11 +722,17 @@ public class SevenSigns
 	public final int getSealProportion(int seal, int cabal)
 	public final int getSealProportion(int seal, int cabal)
 	{
 	{
 		if (cabal == CABAL_NULL)
 		if (cabal == CABAL_NULL)
+		{
 			return 0;
 			return 0;
+		}
 		else if (cabal == CABAL_DUSK)
 		else if (cabal == CABAL_DUSK)
+		{
 			return _signsDuskSealTotals.get(seal);
 			return _signsDuskSealTotals.get(seal);
+		}
 		else
 		else
+		{
 			return _signsDawnSealTotals.get(seal);
 			return _signsDawnSealTotals.get(seal);
+		}
 	}
 	}
 	
 	
 	public final int getTotalMembers(int cabal)
 	public final int getTotalMembers(int cabal)
@@ -679,8 +741,12 @@ public class SevenSigns
 		String cabalName = getCabalShortName(cabal);
 		String cabalName = getCabalShortName(cabal);
 		
 		
 		for (StatsSet sevenDat : _signsPlayerData.values())
 		for (StatsSet sevenDat : _signsPlayerData.values())
+		{
 			if (sevenDat.getString("cabal").equals(cabalName))
 			if (sevenDat.getString("cabal").equals(cabalName))
+			{
 				cabalMembers++;
 				cabalMembers++;
+			}
+		}
 		
 		
 		return cabalMembers;
 		return cabalMembers;
 	}
 	}
@@ -689,7 +755,9 @@ public class SevenSigns
 	{
 	{
 		final StatsSet currPlayer = _signsPlayerData.get(objectId);
 		final StatsSet currPlayer = _signsPlayerData.get(objectId);
 		if (currPlayer == null)
 		if (currPlayer == null)
+		{
 			return 0;
 			return 0;
+		}
 		
 		
 		int stoneCount = 0;
 		int stoneCount = 0;
 		stoneCount += currPlayer.getInteger("red_stones");
 		stoneCount += currPlayer.getInteger("red_stones");
@@ -703,7 +771,9 @@ public class SevenSigns
 	{
 	{
 		final StatsSet currPlayer = _signsPlayerData.get(objectId);
 		final StatsSet currPlayer = _signsPlayerData.get(objectId);
 		if (currPlayer == null)
 		if (currPlayer == null)
+		{
 			return 0;
 			return 0;
+		}
 		
 		
 		return currPlayer.getInteger("contribution_score");
 		return currPlayer.getInteger("contribution_score");
 	}
 	}
@@ -712,7 +782,9 @@ public class SevenSigns
 	{
 	{
 		final StatsSet currPlayer = _signsPlayerData.get(objectId);
 		final StatsSet currPlayer = _signsPlayerData.get(objectId);
 		if (currPlayer == null)
 		if (currPlayer == null)
+		{
 			return 0;
 			return 0;
+		}
 		
 		
 		return currPlayer.getInteger("ancient_adena_amount");
 		return currPlayer.getInteger("ancient_adena_amount");
 	}
 	}
@@ -721,7 +793,9 @@ public class SevenSigns
 	{
 	{
 		final StatsSet currPlayer = _signsPlayerData.get(objectId);
 		final StatsSet currPlayer = _signsPlayerData.get(objectId);
 		if (currPlayer == null)
 		if (currPlayer == null)
+		{
 			return SEAL_NULL;
 			return SEAL_NULL;
+		}
 		
 		
 		return currPlayer.getInteger("seal");
 		return currPlayer.getInteger("seal");
 	}
 	}
@@ -730,15 +804,23 @@ public class SevenSigns
 	{
 	{
 		final StatsSet currPlayer = _signsPlayerData.get(objectId);
 		final StatsSet currPlayer = _signsPlayerData.get(objectId);
 		if (currPlayer == null)
 		if (currPlayer == null)
+		{
 			return CABAL_NULL;
 			return CABAL_NULL;
+		}
 		
 		
 		String playerCabal = currPlayer.getString("cabal");
 		String playerCabal = currPlayer.getString("cabal");
 		if (playerCabal.equalsIgnoreCase("dawn"))
 		if (playerCabal.equalsIgnoreCase("dawn"))
+		{
 			return CABAL_DAWN;
 			return CABAL_DAWN;
+		}
 		else if (playerCabal.equalsIgnoreCase("dusk"))
 		else if (playerCabal.equalsIgnoreCase("dusk"))
+		{
 			return CABAL_DUSK;
 			return CABAL_DUSK;
+		}
 		else
 		else
+		{
 			return CABAL_NULL;
 			return CABAL_NULL;
+		}
 	}
 	}
 	
 	
 	/**
 	/**
@@ -812,7 +894,7 @@ public class SevenSigns
 	 * Should be called on period change and shutdown only.
 	 * Should be called on period change and shutdown only.
 	 */
 	 */
 	public void saveSevenSignsData()
 	public void saveSevenSignsData()
-	{	
+	{
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
 			PreparedStatement ps = con.prepareStatement(UPDATE_PLAYER))
 			PreparedStatement ps = con.prepareStatement(UPDATE_PLAYER))
 		{
 		{
@@ -840,7 +922,9 @@ public class SevenSigns
 	{
 	{
 		StatsSet sevenDat = _signsPlayerData.get(objectId);
 		StatsSet sevenDat = _signsPlayerData.get(objectId);
 		if (sevenDat == null)
 		if (sevenDat == null)
+		{
 			return;
 			return;
+		}
 		
 		
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
 			PreparedStatement ps = con.prepareStatement(UPDATE_PLAYER))
 			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.
 	 * Primarily used when beginning a new cycle, and should otherwise never be called.
 	 */
 	 */
 	protected void resetPlayerData()
 	protected void resetPlayerData()
-	{	
+	{
 		int charObjId;
 		int charObjId;
 		
 		
 		// Reset each player's contribution data as well as seal and cabal.
 		// 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.
 		// Increasing Seal total score for the player chosen Seal.
 		if ("dawn".equals(currPlayerData.getString("cabal")))
 		if ("dawn".equals(currPlayerData.getString("cabal")))
+		{
 			_signsDawnSealTotals.put(chosenSeal, _signsDawnSealTotals.get(chosenSeal) + 1);
 			_signsDawnSealTotals.put(chosenSeal, _signsDawnSealTotals.get(chosenSeal) + 1);
+		}
 		else
 		else
+		{
 			_signsDuskSealTotals.put(chosenSeal, _signsDuskSealTotals.get(chosenSeal) + 1);
 			_signsDuskSealTotals.put(chosenSeal, _signsDuskSealTotals.get(chosenSeal) + 1);
+		}
 		
 		
 		if (!Config.ALT_SEVENSIGNS_LAZY_UPDATE)
 		if (!Config.ALT_SEVENSIGNS_LAZY_UPDATE)
+		{
 			saveSevenSignsStatus();
 			saveSevenSignsStatus();
+		}
 		
 		
 		return chosenCabal;
 		return chosenCabal;
 	}
 	}
 	
 	
 	/**
 	/**
 	 * Returns the amount of ancient adena the specified player can claim, if any.<BR>
 	 * 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 objectId
 	 * @param removeReward
 	 * @param removeReward
 	 * @return
 	 * @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.
 	 * Each stone count <B>must be</B> broken down and specified by the stone's color.
 	 * @param objectId
 	 * @param objectId
 	 * @param blueCount
 	 * @param blueCount
@@ -1034,7 +1121,9 @@ public class SevenSigns
 		long totalContribScore = currPlayer.getLong("contribution_score") + contribScore;
 		long totalContribScore = currPlayer.getLong("contribution_score") + contribScore;
 		
 		
 		if (totalContribScore > Config.ALT_MAXIMUM_PLAYER_CONTRIB)
 		if (totalContribScore > Config.ALT_MAXIMUM_PLAYER_CONTRIB)
+		{
 			return -1;
 			return -1;
+		}
 		
 		
 		currPlayer.set("red_stones", currPlayer.getInteger("red_stones") + redCount);
 		currPlayer.set("red_stones", currPlayer.getInteger("red_stones") + redCount);
 		currPlayer.set("green_stones", currPlayer.getInteger("green_stones") + greenCount);
 		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 cabal
 	 * @param amount
 	 * @param amount
 	 */
 	 */
@@ -1078,20 +1165,23 @@ public class SevenSigns
 			
 			
 			// To prevent negative scores!
 			// To prevent negative scores!
 			if (_dawnFestivalScore >= amount)
 			if (_dawnFestivalScore >= amount)
+			{
 				_dawnFestivalScore -= amount;
 				_dawnFestivalScore -= amount;
+			}
 		}
 		}
 		else
 		else
 		{
 		{
 			_dawnFestivalScore += amount;
 			_dawnFestivalScore += amount;
 			
 			
 			if (_duskFestivalScore >= amount)
 			if (_duskFestivalScore >= amount)
+			{
 				_duskFestivalScore -= amount;
 				_duskFestivalScore -= amount;
+			}
 		}
 		}
 	}
 	}
 	
 	
 	/**
 	/**
 	 * Send info on the current Seven Signs period to the specified player.
 	 * Send info on the current Seven Signs period to the specified player.
-	 *
 	 * @param player
 	 * @param player
 	 */
 	 */
 	public void sendCurrentPeriodMsg(L2PcInstance 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.
 	 * Sends the built-in system message specified by sysMsgId to all online players.
-	 *
 	 * @param sysMsgId
 	 * @param sysMsgId
 	 */
 	 */
 	public void sendMessageToAll(SystemMessageId 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()
 	protected void initializeSeals()
 	{
 	{
@@ -1139,12 +1229,20 @@ public class SevenSigns
 			int sealOwner = _signsSealOwners.get(currSeal);
 			int sealOwner = _signsSealOwners.get(currSeal);
 			
 			
 			if (sealOwner != CABAL_NULL)
 			if (sealOwner != CABAL_NULL)
+			{
 				if (isSealValidationPeriod())
 				if (isSealValidationPeriod())
+				{
 					_log.info("SevenSigns: The " + getCabalName(sealOwner) + " have won the " + getSealName(currSeal, false) + ".");
 					_log.info("SevenSigns: The " + getCabalName(sealOwner) + " have won the " + getSealName(currSeal, false) + ".");
+				}
 				else
 				else
+				{
 					_log.info("SevenSigns: The " + getSealName(currSeal, false) + " is currently owned by " + getCabalName(sealOwner) + ".");
 					_log.info("SevenSigns: The " + getSealName(currSeal, false) + " is currently owned by " + getCabalName(sealOwner) + ".");
+				}
+			}
 			else
 			else
+			{
 				_log.info("SevenSigns: The " + getSealName(currSeal, false) + " remains unclaimed.");
 				_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.
 	 * Should only ever called at the beginning of a new cycle.
 	 */
 	 */
 	protected void calcNewSealOwners()
 	protected void calcNewSealOwners()
-	{	
+	{
 		for (Integer currSeal : _signsDawnSealTotals.keySet())
 		for (Integer currSeal : _signsDawnSealTotals.keySet())
 		{
 		{
 			int prevSealOwner = _signsSealOwners.get(currSeal);
 			int prevSealOwner = _signsSealOwners.get(currSeal);
@@ -1180,14 +1277,11 @@ public class SevenSigns
 			int totalDuskMembers = getTotalMembers(CABAL_DUSK) == 0 ? 1 : getTotalMembers(CABAL_DUSK);
 			int totalDuskMembers = getTotalMembers(CABAL_DUSK) == 0 ? 1 : getTotalMembers(CABAL_DUSK);
 			int duskPercent = Math.round(((float) duskProportion / (float) totalDuskMembers) * 100);
 			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)
 			switch (prevSealOwner)
 			{
 			{
@@ -1199,15 +1293,23 @@ public class SevenSigns
 							break;
 							break;
 						case CABAL_DAWN:
 						case CABAL_DAWN:
 							if (dawnPercent >= 35)
 							if (dawnPercent >= 35)
+							{
 								newSealOwner = CABAL_DAWN;
 								newSealOwner = CABAL_DAWN;
+							}
 							else
 							else
+							{
 								newSealOwner = CABAL_NULL;
 								newSealOwner = CABAL_NULL;
+							}
 							break;
 							break;
 						case CABAL_DUSK:
 						case CABAL_DUSK:
 							if (duskPercent >= 35)
 							if (duskPercent >= 35)
+							{
 								newSealOwner = CABAL_DUSK;
 								newSealOwner = CABAL_DUSK;
+							}
 							else
 							else
+							{
 								newSealOwner = CABAL_NULL;
 								newSealOwner = CABAL_NULL;
+							}
 							break;
 							break;
 					}
 					}
 					break;
 					break;
@@ -1216,23 +1318,37 @@ public class SevenSigns
 					{
 					{
 						case CABAL_NULL:
 						case CABAL_NULL:
 							if (dawnPercent >= 10)
 							if (dawnPercent >= 10)
+							{
 								newSealOwner = CABAL_DAWN;
 								newSealOwner = CABAL_DAWN;
+							}
 							else
 							else
+							{
 								newSealOwner = CABAL_NULL;
 								newSealOwner = CABAL_NULL;
+							}
 							break;
 							break;
 						case CABAL_DAWN:
 						case CABAL_DAWN:
 							if (dawnPercent >= 10)
 							if (dawnPercent >= 10)
+							{
 								newSealOwner = CABAL_DAWN;
 								newSealOwner = CABAL_DAWN;
+							}
 							else
 							else
+							{
 								newSealOwner = CABAL_NULL;
 								newSealOwner = CABAL_NULL;
+							}
 							break;
 							break;
 						case CABAL_DUSK:
 						case CABAL_DUSK:
 							if (duskPercent >= 35)
 							if (duskPercent >= 35)
+							{
 								newSealOwner = CABAL_DUSK;
 								newSealOwner = CABAL_DUSK;
+							}
 							else if (dawnPercent >= 10)
 							else if (dawnPercent >= 10)
+							{
 								newSealOwner = CABAL_DAWN;
 								newSealOwner = CABAL_DAWN;
+							}
 							else
 							else
+							{
 								newSealOwner = CABAL_NULL;
 								newSealOwner = CABAL_NULL;
+							}
 							break;
 							break;
 					}
 					}
 					break;
 					break;
@@ -1241,23 +1357,37 @@ public class SevenSigns
 					{
 					{
 						case CABAL_NULL:
 						case CABAL_NULL:
 							if (duskPercent >= 10)
 							if (duskPercent >= 10)
+							{
 								newSealOwner = CABAL_DUSK;
 								newSealOwner = CABAL_DUSK;
+							}
 							else
 							else
+							{
 								newSealOwner = CABAL_NULL;
 								newSealOwner = CABAL_NULL;
+							}
 							break;
 							break;
 						case CABAL_DAWN:
 						case CABAL_DAWN:
 							if (dawnPercent >= 35)
 							if (dawnPercent >= 35)
+							{
 								newSealOwner = CABAL_DAWN;
 								newSealOwner = CABAL_DAWN;
+							}
 							else if (duskPercent >= 10)
 							else if (duskPercent >= 10)
+							{
 								newSealOwner = CABAL_DUSK;
 								newSealOwner = CABAL_DUSK;
+							}
 							else
 							else
+							{
 								newSealOwner = CABAL_NULL;
 								newSealOwner = CABAL_NULL;
+							}
 							break;
 							break;
 						case CABAL_DUSK:
 						case CABAL_DUSK:
 							if (duskPercent >= 10)
 							if (duskPercent >= 10)
+							{
 								newSealOwner = CABAL_DUSK;
 								newSealOwner = CABAL_DUSK;
+							}
 							else
 							else
+							{
 								newSealOwner = CABAL_NULL;
 								newSealOwner = CABAL_NULL;
+							}
 							break;
 							break;
 					}
 					}
 					break;
 					break;
@@ -1270,21 +1400,33 @@ public class SevenSigns
 			{
 			{
 				case SEAL_AVARICE:
 				case SEAL_AVARICE:
 					if (newSealOwner == CABAL_DAWN)
 					if (newSealOwner == CABAL_DAWN)
+					{
 						sendMessageToAll(SystemMessageId.DAWN_OBTAINED_AVARICE);
 						sendMessageToAll(SystemMessageId.DAWN_OBTAINED_AVARICE);
+					}
 					else if (newSealOwner == CABAL_DUSK)
 					else if (newSealOwner == CABAL_DUSK)
+					{
 						sendMessageToAll(SystemMessageId.DUSK_OBTAINED_AVARICE);
 						sendMessageToAll(SystemMessageId.DUSK_OBTAINED_AVARICE);
+					}
 					break;
 					break;
 				case SEAL_GNOSIS:
 				case SEAL_GNOSIS:
 					if (newSealOwner == CABAL_DAWN)
 					if (newSealOwner == CABAL_DAWN)
+					{
 						sendMessageToAll(SystemMessageId.DAWN_OBTAINED_GNOSIS);
 						sendMessageToAll(SystemMessageId.DAWN_OBTAINED_GNOSIS);
+					}
 					else if (newSealOwner == CABAL_DUSK)
 					else if (newSealOwner == CABAL_DUSK)
+					{
 						sendMessageToAll(SystemMessageId.DUSK_OBTAINED_GNOSIS);
 						sendMessageToAll(SystemMessageId.DUSK_OBTAINED_GNOSIS);
+					}
 					break;
 					break;
 				case SEAL_STRIFE:
 				case SEAL_STRIFE:
 					if (newSealOwner == CABAL_DAWN)
 					if (newSealOwner == CABAL_DAWN)
+					{
 						sendMessageToAll(SystemMessageId.DAWN_OBTAINED_STRIFE);
 						sendMessageToAll(SystemMessageId.DAWN_OBTAINED_STRIFE);
+					}
 					else if (newSealOwner == CABAL_DUSK)
 					else if (newSealOwner == CABAL_DUSK)
+					{
 						sendMessageToAll(SystemMessageId.DUSK_OBTAINED_STRIFE);
 						sendMessageToAll(SystemMessageId.DUSK_OBTAINED_STRIFE);
+					}
 					
 					
 					CastleManager.getInstance().validateTaxes(newSealOwner);
 					CastleManager.getInstance().validateTaxes(newSealOwner);
 					break;
 					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>
 	 * 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.
 	 * Should only ever called at the beginning of Seal Validation.
-	 * @param compWinner 
+	 * @param compWinner
 	 */
 	 */
 	protected void teleLosingCabalFromDungeons(String compWinner)
 	protected void teleLosingCabalFromDungeons(String compWinner)
 	{
 	{
@@ -1320,7 +1462,7 @@ public class SevenSigns
 				
 				
 				if (isSealValidationPeriod() || isCompResultsPeriod())
 				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.teleToLocation(MapRegionManager.TeleportWhereType.Town);
 						onlinePlayer.setIsIn7sDungeon(false);
 						onlinePlayer.setIsIn7sDungeon(false);
@@ -1329,7 +1471,7 @@ public class SevenSigns
 				}
 				}
 				else
 				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.teleToLocation(MapRegionManager.TeleportWhereType.Town);
 						onlinePlayer.setIsIn7sDungeon(false);
 						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.
 	 * This runs all related tasks depending on the period that is about to begin.
-	 *
 	 * @author Tempy
 	 * @author Tempy
 	 */
 	 */
 	protected class SevenSignsPeriodChange implements Runnable
 	protected class SevenSignsPeriodChange implements Runnable
@@ -1353,9 +1494,7 @@ public class SevenSigns
 		@Override
 		@Override
 		public void run()
 		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();
 			final int periodEnded = getCurrentPeriod();
 			_activePeriod++;
 			_activePeriod++;
 			
 			
@@ -1398,7 +1537,7 @@ public class SevenSigns
 					
 					
 					// Perform initial Seal Validation set up.
 					// Perform initial Seal Validation set up.
 					initializeSeals();
 					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));
 					giveCPMult(getSealOwner(SEAL_STRIFE));
 					// Send message that Seal Validation has begun.
 					// Send message that Seal Validation has begun.
 					sendMessageToAll(SystemMessageId.SEAL_VALIDATION_PERIOD_BEGUN);
 					sendMessageToAll(SystemMessageId.SEAL_VALIDATION_PERIOD_BEGUN);
@@ -1406,7 +1545,9 @@ public class SevenSigns
 					// Change next Territory War date
 					// Change next Territory War date
 					Quest twQuest = QuestManager.getInstance().getQuest(TerritoryWarManager.qn);
 					Quest twQuest = QuestManager.getInstance().getQuest(TerritoryWarManager.qn);
 					if (twQuest != null)
 					if (twQuest != null)
+					{
 						twQuest.startQuestTimer("setNextTWDate", 30000, null, null);
 						twQuest.startQuestTimer("setNextTWDate", 30000, null, null);
+					}
 					
 					
 					_log.info("SevenSigns: The " + getCabalName(_previousWinner) + " have won the competition with " + getCurrentScore(_previousWinner) + " points!");
 					_log.info("SevenSigns: The " + getCabalName(_previousWinner) + " have won the competition with " + getCurrentScore(_previousWinner) + " points!");
 					break;
 					break;
@@ -1417,7 +1558,7 @@ public class SevenSigns
 					
 					
 					// Send message that Seal Validation has ended.
 					// Send message that Seal Validation has ended.
 					sendMessageToAll(SystemMessageId.SEAL_VALIDATION_PERIOD_ENDED);
 					sendMessageToAll(SystemMessageId.SEAL_VALIDATION_PERIOD_ENDED);
-					//Clear Seal of Strife influence.
+					// Clear Seal of Strife influence.
 					removeCPMult();
 					removeCPMult();
 					// Reset all data
 					// Reset all data
 					resetPlayerData();
 					resetPlayerData();
@@ -1465,37 +1606,61 @@ public class SevenSigns
 	
 	
 	public boolean checkIsDawnPostingTicket(int itemId)
 	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;
 			return true;
-		if (itemId > 6801 && itemId < 6812)
+		}
+		if ((itemId > 6801) && (itemId < 6812))
+		{
 			return true;
 			return true;
-		if (itemId > 7997 && itemId < 8008)
+		}
+		if ((itemId > 7997) && (itemId < 8008))
+		{
 			return true;
 			return true;
-		if (itemId > 7940 && itemId < 7951)
+		}
+		if ((itemId > 7940) && (itemId < 7951))
+		{
 			return true;
 			return true;
-		if (itemId > 6294 && itemId < 6307)
+		}
+		if ((itemId > 6294) && (itemId < 6307))
+		{
 			return true;
 			return true;
-		if (itemId > 6831 && itemId < 6834)
+		}
+		if ((itemId > 6831) && (itemId < 6834))
+		{
 			return true;
 			return true;
-		if (itemId > 8027 && itemId < 8030)
+		}
+		if ((itemId > 8027) && (itemId < 8030))
+		{
 			return true;
 			return true;
-		if (itemId > 7970 && itemId < 7973)
+		}
+		if ((itemId > 7970) && (itemId < 7973))
+		{
 			return true;
 			return true;
+		}
 		return false;
 		return false;
 	}
 	}
 	
 	
 	public boolean checkIsRookiePostingTicket(int itemId)
 	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;
 			return true;
-		if (itemId > 6811 && itemId < 6832)
+		}
+		if ((itemId > 6811) && (itemId < 6832))
+		{
 			return true;
 			return true;
-		if (itemId > 7950 && itemId < 7971)
+		}
+		if ((itemId > 7950) && (itemId < 7971))
+		{
 			return true;
 			return true;
-		if (itemId > 8007 && itemId < 8028)
+		}
+		if ((itemId > 8007) && (itemId < 8028))
+		{
 			return true;
 			return true;
+		}
 		return false;
 		return false;
 	}
 	}
 	
 	
@@ -1518,14 +1683,20 @@ public class SevenSigns
 		{
 		{
 			if (character != null)
 			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());
 				int cabal = getPlayerCabal(character.getObjectId());
 				if (cabal != SevenSigns.CABAL_NULL)
 				if (cabal != SevenSigns.CABAL_NULL)
+				{
 					if (cabal == _strifeOwner)
 					if (cabal == _strifeOwner)
+					{
 						character.addSkill(SkillTable.FrequentSkill.THE_VICTOR_OF_WAR.getSkill());
 						character.addSkill(SkillTable.FrequentSkill.THE_VICTOR_OF_WAR.getSkill());
+					}
 					else
 					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());
 						character.addSkill(SkillTable.FrequentSkill.THE_VANQUISHED_OF_WAR.getSkill());
+					}
+				}
 			}
 			}
 			return true;
 			return true;
 		}
 		}
@@ -1537,13 +1708,13 @@ public class SevenSigns
 	}
 	}
 	
 	
 	protected final class RemoveCPMult implements TObjectProcedure<L2PcInstance>
 	protected final class RemoveCPMult implements TObjectProcedure<L2PcInstance>
-	{	
+	{
 		@Override
 		@Override
 		public final boolean execute(final L2PcInstance character)
 		public final boolean execute(final L2PcInstance character)
 		{
 		{
 			if (character != null)
 			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_VICTOR_OF_WAR.getSkill());
 				character.removeSkill(SkillTable.FrequentSkill.THE_VANQUISHED_OF_WAR.getSkill());
 				character.removeSkill(SkillTable.FrequentSkill.THE_VANQUISHED_OF_WAR.getSkill());
 			}
 			}
@@ -1554,15 +1725,21 @@ public class SevenSigns
 	public boolean checkSummonConditions(L2PcInstance activeChar)
 	public boolean checkSummonConditions(L2PcInstance activeChar)
 	{
 	{
 		if (activeChar == null)
 		if (activeChar == null)
+		{
 			return true;
 			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 (isSealValidationPeriod())
+		{
 			if (getSealOwner(SEAL_STRIFE) == CABAL_DAWN)
 			if (getSealOwner(SEAL_STRIFE) == CABAL_DAWN)
+			{
 				if (getPlayerCabal(activeChar.getObjectId()) == CABAL_DUSK)
 				if (getPlayerCabal(activeChar.getObjectId()) == CABAL_DUSK)
 				{
 				{
 					activeChar.sendMessage("You cannot summon Siege Golem or Cannon while Seal of Strife posessed by Lords of Dawn.");
 					activeChar.sendMessage("You cannot summon Siege Golem or Cannon while Seal of Strife posessed by Lords of Dawn.");
 					return true;
 					return true;
 				}
 				}
+			}
+		}
 		
 		
 		return false;
 		return false;
 	}
 	}

File diff suppressed because it is too large
+ 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;
 package com.l2jserver.gameserver;
 
 
-import gnu.trove.procedure.TObjectProcedure;
-
 import java.util.logging.Level;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 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.network.serverpackets.SystemMessage;
 import com.l2jserver.gameserver.util.Broadcast;
 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.
  * It closes all open client connections and saves all data.
- *
  * @version $Revision: 1.2.4.5 $ $Date: 2005/03/27 15:29:09 $
  * @version $Revision: 1.2.4.5 $ $Date: 2005/03/27 15:29:09 $
  */
  */
 public class Shutdown extends Thread
 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 static Shutdown _counterInstance = null;
 	
 	
 	private int _secondsShut;
 	private int _secondsShut;
@@ -64,11 +61,16 @@ public class Shutdown extends Thread
 	public static final int GM_SHUTDOWN = 1;
 	public static final int GM_SHUTDOWN = 1;
 	public static final int GM_RESTART = 2;
 	public static final int GM_RESTART = 2;
 	public static final int ABORT = 3;
 	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())
 	 * This function starts a shutdown count down from Telnet (Copied from Function startShutdown())
-	 *
 	 * @param seconds seconds until shutdown
 	 * @param seconds seconds until shutdown
 	 */
 	 */
 	private void SendServerQuit(int seconds)
 	private void SendServerQuit(int seconds)
@@ -81,7 +83,6 @@ public class Shutdown extends Thread
 	public void startTelnetShutdown(String IP, int seconds, boolean restart)
 	public void startTelnetShutdown(String IP, int seconds, boolean restart)
 	{
 	{
 		_log.warning("IP: " + IP + " issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!");
 		_log.warning("IP: " + IP + " issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!");
-		//_an.announceToAll("Server is " + _modeText[shutdownMode] + " in "+seconds+ " seconds!");
 		
 		
 		if (restart)
 		if (restart)
 		{
 		{
@@ -128,7 +129,6 @@ public class Shutdown extends Thread
 	
 	
 	/**
 	/**
 	 * This function aborts a running countdown
 	 * This function aborts a running countdown
-	 *
 	 * @param IP IP Which Issued shutdown command
 	 * @param IP IP Which Issued shutdown command
 	 */
 	 */
 	public void telnetAbort(String IP)
 	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
 	 * Default constructor is only used internal to create the shutdown-hook instance
-	 *
 	 */
 	 */
 	protected Shutdown()
 	protected Shutdown()
 	{
 	{
@@ -155,10 +154,8 @@ public class Shutdown extends Thread
 	
 	
 	/**
 	/**
 	 * This creates a countdown instance of Shutdown.
 	 * 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)
 	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
 	@Override
 	public void run()
 	public void run()
 	{
 	{
-		if (this == SingletonHolder._instance)
+		if (this == getInstance())
 		{
 		{
 			TimeCounter tc = new TimeCounter();
 			TimeCounter tc = new TimeCounter();
 			TimeCounter tc1 = 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)
 				if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
 				{
 				{
 					OfflineTradersTable.getInstance().storeOffliners();
 					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)
 			catch (Throwable t)
 			{
 			{
-				_log.log(Level.WARNING, "Error saving offline shops.",t);
+				_log.log(Level.WARNING, "Error saving offline shops.", t);
 			}
 			}
 			
 			
 			try
 			try
 			{
 			{
 				disconnectAllCharacters();
 				disconnectAllCharacters();
-				_log.info("All players disconnected and saved("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+				_log.info("All players disconnected and saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 			}
 			}
 			catch (Throwable t)
 			catch (Throwable t)
 			{
 			{
@@ -239,7 +213,7 @@ public class Shutdown extends Thread
 			try
 			try
 			{
 			{
 				GameTimeController.getInstance().stopTimer();
 				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)
 			catch (Throwable t)
 			{
 			{
@@ -250,7 +224,7 @@ public class Shutdown extends Thread
 			try
 			try
 			{
 			{
 				ThreadPoolManager.getInstance().shutdown();
 				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)
 			catch (Throwable t)
 			{
 			{
@@ -260,7 +234,7 @@ public class Shutdown extends Thread
 			try
 			try
 			{
 			{
 				CommunityServerThread.getInstance().interrupt();
 				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)
 			catch (Throwable t)
 			{
 			{
@@ -270,7 +244,7 @@ public class Shutdown extends Thread
 			try
 			try
 			{
 			{
 				LoginServerThread.getInstance().interrupt();
 				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)
 			catch (Throwable t)
 			{
 			{
@@ -285,7 +259,7 @@ public class Shutdown extends Thread
 			try
 			try
 			{
 			{
 				GameServer.gameServer.getSelectorThread().shutdown();
 				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)
 			catch (Throwable t)
 			{
 			{
@@ -296,7 +270,7 @@ public class Shutdown extends Thread
 			try
 			try
 			{
 			{
 				L2DatabaseFactory.getInstance().shutdown();
 				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)
 			catch (Throwable t)
 			{
 			{
@@ -304,7 +278,7 @@ public class Shutdown extends Thread
 			}
 			}
 			
 			
 			// server will quit, when this function ends.
 			// server will quit, when this function ends.
-			if (SingletonHolder._instance._shutdownMode == GM_RESTART)
+			if (getInstance()._shutdownMode == GM_RESTART)
 			{
 			{
 				Runtime.getRuntime().halt(2);
 				Runtime.getRuntime().halt(2);
 			}
 			}
@@ -313,7 +287,7 @@ public class Shutdown extends Thread
 				Runtime.getRuntime().halt(0);
 				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
 		else
 		{
 		{
@@ -324,11 +298,11 @@ public class Shutdown extends Thread
 			switch (_shutdownMode)
 			switch (_shutdownMode)
 			{
 			{
 				case GM_SHUTDOWN:
 				case GM_SHUTDOWN:
-					SingletonHolder._instance.setMode(GM_SHUTDOWN);
+					getInstance().setMode(GM_SHUTDOWN);
 					System.exit(0);
 					System.exit(0);
 					break;
 					break;
 				case GM_RESTART:
 				case GM_RESTART:
-					SingletonHolder._instance.setMode(GM_RESTART);
+					getInstance().setMode(GM_RESTART);
 					System.exit(2);
 					System.exit(2);
 					break;
 					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)
 	public void startShutdown(L2PcInstance activeChar, int seconds, boolean restart)
 	{
 	{
@@ -353,8 +326,7 @@ public class Shutdown extends Thread
 			_shutdownMode = GM_SHUTDOWN;
 			_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)
 		if (_shutdownMode > 0)
 		{
 		{
@@ -387,20 +359,18 @@ public class Shutdown extends Thread
 			_counterInstance._abort();
 			_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 = new Shutdown(seconds, restart);
 		_counterInstance.start();
 		_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)
 	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)
 		if (_counterInstance != null)
 		{
 		{
 			_counterInstance._abort();
 			_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)
 	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()
 	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()
 	private void countdown()
 	{
 	{
@@ -466,7 +434,7 @@ public class Shutdown extends Thread
 						SendServerQuit(120);
 						SendServerQuit(120);
 						break;
 						break;
 					case 60:
 					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);
 						SendServerQuit(60);
 						break;
 						break;
 					case 30:
 					case 30:
@@ -494,22 +462,23 @@ public class Shutdown extends Thread
 				
 				
 				_secondsShut--;
 				_secondsShut--;
 				
 				
-				int delay = 1000; //milliseconds
+				int delay = 1000; // milliseconds
 				Thread.sleep(delay);
 				Thread.sleep(delay);
 				
 				
 				if (_shutdownMode == ABORT)
 				if (_shutdownMode == ABORT)
+				{
 					break;
 					break;
+				}
 			}
 			}
 		}
 		}
 		catch (InterruptedException e)
 		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()
 	private void saveData()
 	{
 	{
@@ -524,70 +493,71 @@ public class Shutdown extends Thread
 			case GM_RESTART:
 			case GM_RESTART:
 				_log.info("GM restart received. Restarting NOW!");
 				_log.info("GM restart received. Restarting NOW!");
 				break;
 				break;
-				
+		
 		}
 		}
 		
 		
-		/*if (Config.ACTIVATE_POSITION_RECORDER)
-			Universe.getInstance().implode(true);*/
+		/*
+		 * if (Config.ACTIVATE_POSITION_RECORDER) Universe.getInstance().implode(true);
+		 */
 		TimeCounter tc = new TimeCounter();
 		TimeCounter tc = new TimeCounter();
 		// Seven Signs data is now saved along with Festival data.
 		// Seven Signs data is now saved along with Festival data.
 		if (!SevenSigns.getInstance().isSealValidationPeriod())
 		if (!SevenSigns.getInstance().isSealValidationPeriod())
 		{
 		{
 			SevenSignsFestival.getInstance().saveFestivalData(false);
 			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. :)
 		// Save Seven Signs data before closing. :)
 		SevenSigns.getInstance().saveSevenSignsData();
 		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();
 		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 ^_^
 		// Save all raidboss and GrandBoss status ^_^
 		RaidBossSpawnManager.getInstance().cleanUp();
 		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();
 		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();
 		HellboundManager.getInstance().cleanUp();
 		_log.info("Hellbound Manager: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 		_log.info("Hellbound Manager: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 		_log.info("TradeController saving data.. This action may take some minutes! Please wait until completed!");
 		_log.info("TradeController saving data.. This action may take some minutes! Please wait until completed!");
 		TradeController.getInstance().dataCountStore();
 		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();
 		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();
 		Olympiad.getInstance().saveOlympiadStatus();
-		_log.info("Olympiad System: Data saved("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+		_log.info("Olympiad System: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 		Hero.getInstance().shutdown();
 		Hero.getInstance().shutdown();
-		_log.info("Hero System: Data saved("+tc.getEstimatedTimeAndRestartCounter()+"ms).");
+		_log.info("Hero System: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
 		ClanTable.getInstance().storeClanScore();
 		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.
 		// Save Cursed Weapons data before closing.
 		CursedWeaponsManager.getInstance().saveData();
 		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
 		// Save all manor data
 		CastleManorManager.getInstance().save();
 		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();
 		CHSiegeManager.getInstance().onServerShutDown();
 		_log.info("CHSiegeManager: Siegable hall attacker lists saved!");
 		_log.info("CHSiegeManager: Siegable hall attacker lists saved!");
 		
 		
 		// Save all global (non-player specific) Quest data that needs to persist after reboot
 		// Save all global (non-player specific) Quest data that needs to persist after reboot
 		QuestManager.getInstance().save();
 		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
 		// Save all global variables data
 		GlobalVariablesManager.getInstance().saveVars();
 		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)
 		if (Config.SAVE_DROPPED_ITEM)
 		{
 		{
 			ItemsOnGroundManager.getInstance().saveInDb();
 			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();
 			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
 		try
@@ -597,13 +567,12 @@ public class Shutdown extends Thread
 		}
 		}
 		catch (InterruptedException e)
 		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()
 	private void disconnectAllCharacters()
 	{
 	{
@@ -619,11 +588,11 @@ public class Shutdown extends Thread
 		{
 		{
 			if (player != null)
 			if (player != null)
 			{
 			{
-				//Logout Character
+				// Logout Character
 				try
 				try
 				{
 				{
 					L2GameClient client = player.getClient();
 					L2GameClient client = player.getClient();
-					if (client != null && !client.isDetached())
+					if ((client != null) && !client.isDetached())
 					{
 					{
 						client.close(ServerClose.STATIC_PACKET);
 						client.close(ServerClose.STATIC_PACKET);
 						client.setActiveChar(null);
 						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
 	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
 	private static class SingletonHolder
 	{
 	{
 		protected static final Shutdown _instance = new Shutdown();
 		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
 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;
 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>
  * <ul>
  * <li>{@link #scheduleEffect(Runnable, long)} : for effects Tasks that needs to be executed only once.</li>
  * <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>
  * <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 #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 #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>
  * <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>
  * <ul>
  * <li>{@link #_generalPacketsThreadPool GeneralPackets} where most packets handler are executed.</li>
  * <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>
  * <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>
  * </ul>
  * </p>
  * </p>
  * @author -Wooden-
  * @author -Wooden-
- *
  */
  */
 public class ThreadPoolManager
 public class ThreadPoolManager
 {
 {
@@ -90,7 +93,9 @@ public class ThreadPoolManager
 				final Thread t = Thread.currentThread();
 				final Thread t = Thread.currentThread();
 				final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
 				final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
 				if (h != null)
 				if (h != null)
+				{
 					h.uncaughtException(t, e);
 					h.uncaughtException(t, e);
+				}
 			}
 			}
 		}
 		}
 	}
 	}
@@ -98,10 +103,9 @@ public class ThreadPoolManager
 	protected ScheduledThreadPoolExecutor _effectsScheduledThreadPool;
 	protected ScheduledThreadPoolExecutor _effectsScheduledThreadPool;
 	protected ScheduledThreadPoolExecutor _generalScheduledThreadPool;
 	protected ScheduledThreadPoolExecutor _generalScheduledThreadPool;
 	protected ScheduledThreadPoolExecutor _aiScheduledThreadPool;
 	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 */
 	/** temp workaround for VM issue */
 	private static final long MAX_DELAY = Long.MAX_VALUE / 1000000 / 2;
 	private static final long MAX_DELAY = Long.MAX_VALUE / 1000000 / 2;
@@ -128,9 +132,13 @@ public class ThreadPoolManager
 	public static long validateDelay(long delay)
 	public static long validateDelay(long delay)
 	{
 	{
 		if (delay < 0)
 		if (delay < 0)
+		{
 			delay = 0;
 			delay = 0;
+		}
 		else if (delay > MAX_DELAY)
 		else if (delay > MAX_DELAY)
+		{
 			delay = MAX_DELAY;
 			delay = MAX_DELAY;
+		}
 		return delay;
 		return delay;
 	}
 	}
 	
 	
@@ -254,73 +262,74 @@ public class ThreadPoolManager
 	
 	
 	public String[] getStats()
 	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 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)
 		public PriorityThreadFactory(String name, int prio)
 		{
 		{
@@ -392,12 +401,13 @@ public class ThreadPoolManager
 			int count = ptf.getGroup().activeCount();
 			int count = ptf.getGroup().activeCount();
 			Thread[] threads = new Thread[count + 2];
 			Thread[] threads = new Thread[count + 2];
 			ptf.getGroup().enumerate(threads);
 			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)
 			for (Thread t : threads)
 			{
 			{
 				if (t == null)
 				if (t == null)
+				{
 					continue;
 					continue;
+				}
 				
 				
 				StringUtil.append(sb, t.getName(), Config.EOL);
 				StringUtil.append(sb, t.getName(), Config.EOL);
 				for (StackTraceElement ste : t.getStackTrace())
 				for (StackTraceElement ste : t.getStackTrace())
@@ -423,13 +433,14 @@ public class ThreadPoolManager
 			int count = ptf.getGroup().activeCount();
 			int count = ptf.getGroup().activeCount();
 			Thread[] threads = new Thread[count + 2];
 			Thread[] threads = new Thread[count + 2];
 			ptf.getGroup().enumerate(threads);
 			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)
 			for (Thread t : threads)
 			{
 			{
 				if (t == null)
 				if (t == null)
+				{
 					continue;
 					continue;
+				}
 				
 				
 				StringUtil.append(sb, t.getName(), Config.EOL);
 				StringUtil.append(sb, t.getName(), Config.EOL);
 				
 				
@@ -456,13 +467,14 @@ public class ThreadPoolManager
 			int count = ptf.getGroup().activeCount();
 			int count = ptf.getGroup().activeCount();
 			Thread[] threads = new Thread[count + 2];
 			Thread[] threads = new Thread[count + 2];
 			ptf.getGroup().enumerate(threads);
 			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)
 			for (Thread t : threads)
 			{
 			{
 				if (t == null)
 				if (t == null)
+				{
 					continue;
 					continue;
+				}
 				
 				
 				StringUtil.append(sb, t.getName(), Config.EOL);
 				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 ...
  * This class ...
- *
  * @version $Revision: 1.5.4.13 $ $Date: 2005/04/06 16:13:38 $
  * @version $Revision: 1.5.4.13 $ $Date: 2005/04/06 16:13:38 $
  */
  */
 public class TradeController
 public class TradeController
@@ -43,12 +42,7 @@ public class TradeController
 	private static Logger _log = Logger.getLogger(TradeController.class.getName());
 	private static Logger _log = Logger.getLogger(TradeController.class.getName());
 	
 	
 	private int _nextListId;
 	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()
 	protected TradeController()
 	{
 	{
@@ -60,10 +54,7 @@ public class TradeController
 		{
 		{
 			int itemId, price, maxCount, currentCount, time;
 			int itemId, price, maxCount, currentCount, time;
 			long saveTimer;
 			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())
 				while (rs1.next())
 				{
 				{
@@ -138,10 +129,7 @@ public class TradeController
 				int initialSize = _lists.size();
 				int initialSize = _lists.size();
 				int itemId, price, maxCount, currentCount, time;
 				int itemId, price, maxCount, currentCount, time;
 				long saveTimer;
 				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())
 				while (rset1.next())
 				{
 				{
 					statement.setString(1, String.valueOf(rset1.getInt("shop_id")));
 					statement.setString(1, String.valueOf(rset1.getInt("shop_id")));
@@ -163,8 +151,7 @@ public class TradeController
 						L2TradeItem item = new L2TradeItem(shopId, itemId);
 						L2TradeItem item = new L2TradeItem(shopId, itemId);
 						if (ItemTable.getInstance().getTemplate(itemId) == null)
 						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;
 							continue;
 						}
 						}
 						
 						
@@ -225,9 +212,13 @@ public class TradeController
 		{
 		{
 			String tradeNpcId = list.getNpcId();
 			String tradeNpcId = list.getNpcId();
 			if (tradeNpcId.startsWith("gm"))
 			if (tradeNpcId.startsWith("gm"))
+			{
 				continue;
 				continue;
+			}
 			if (npcId == Integer.parseInt(tradeNpcId))
 			if (npcId == Integer.parseInt(tradeNpcId))
+			{
 				lists.add(list);
 				lists.add(list);
+			}
 		}
 		}
 		return lists;
 		return lists;
 	}
 	}
@@ -244,7 +235,7 @@ public class TradeController
 					for (L2TradeItem item : list.getItems())
 					for (L2TradeItem item : list.getItems())
 					{
 					{
 						long currentCount;
 						long currentCount;
-						if (item.hasLimitedStock() && (currentCount = item.getCurrentCount()) < item.getMaxCount())
+						if (item.hasLimitedStock() && ((currentCount = item.getCurrentCount()) < item.getMaxCount()))
 						{
 						{
 							statement.setLong(1, currentCount);
 							statement.setLong(1, currentCount);
 							statement.setInt(2, item.getItemId());
 							statement.setInt(2, item.getItemId());
@@ -270,6 +261,11 @@ public class TradeController
 		return _nextListId++;
 		return _nextListId++;
 	}
 	}
 	
 	
+	public static TradeController getInstance()
+	{
+		return SingletonHolder._instance;
+	}
+	
 	private static class SingletonHolder
 	private static class SingletonHolder
 	{
 	{
 		protected static final TradeController _instance = new TradeController();
 		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
 			try
 			{
 			{
 				if (_followTask == null)
 				if (_followTask == null)
+				{
 					return;
 					return;
+				}
 				
 				
 				L2Character followTarget = _followTarget; // copy to prevent NPE
 				L2Character followTarget = _followTarget; // copy to prevent NPE
 				if (followTarget == null)
 				if (followTarget == null)
 				{
 				{
 					if (_actor instanceof L2Summon)
 					if (_actor instanceof L2Summon)
+					{
 						((L2Summon) _actor).setFollowStatus(false);
 						((L2Summon) _actor).setFollowStatus(false);
+					}
 					setIntention(AI_INTENTION_IDLE);
 					setIntention(AI_INTENTION_IDLE);
 					return;
 					return;
 				}
 				}
@@ -102,7 +106,9 @@ public abstract class AbstractAI implements Ctrl
 					{
 					{
 						// if the target is too far (maybe also teleported)
 						// if the target is too far (maybe also teleported)
 						if (_actor instanceof L2Summon)
 						if (_actor instanceof L2Summon)
+						{
 							((L2Summon) _actor).setFollowStatus(false);
 							((L2Summon) _actor).setFollowStatus(false);
+						}
 						
 						
 						setIntention(AI_INTENTION_IDLE);
 						setIntention(AI_INTENTION_IDLE);
 						return;
 						return;
@@ -155,10 +161,8 @@ public abstract class AbstractAI implements Ctrl
 	private static final int ATTACK_FOLLOW_INTERVAL = 500;
 	private static final int ATTACK_FOLLOW_INTERVAL = 500;
 	
 	
 	/**
 	/**
-	 * Constructor of AbstractAI.<BR><BR>
-	 *
+	 * Constructor of AbstractAI.
 	 * @param accessor The AI accessor of the L2Character
 	 * @param accessor The AI accessor of the L2Character
-	 *
 	 */
 	 */
 	protected AbstractAI(L2Character.AIAccessor accessor)
 	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>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 intention The new Intention to set to the AI
 	 * @param arg0 The first parameter of the Intention
 	 * @param arg0 The first parameter of the Intention
 	 * @param arg1 The second parameter of the Intention
 	 * @param arg1 The second parameter of the Intention
-	 *
 	 */
 	 */
 	synchronized void changeIntention(CtrlIntention intention, Object arg0, Object arg1)
 	synchronized void changeIntention(CtrlIntention intention, Object arg0, Object arg1)
 	{
 	{
-		/*
-		 if (Config.DEBUG)
-		 _log.warning("AbstractAI: changeIntention -> " + intention + " " + arg0 + " " + arg1);
-		 */
-		
 		_intention = intention;
 		_intention = intention;
 		_intentionArg0 = arg0;
 		_intentionArg0 = arg0;
 		_intentionArg1 = arg1;
 		_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
 	 * @param intention The new Intention to set to the AI
-	 *
 	 */
 	 */
 	@Override
 	@Override
 	public final void setIntention(CtrlIntention intention)
 	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 intention The new Intention to set to the AI
 	 * @param arg0 The first parameter of the Intention (optional target)
 	 * @param arg0 The first parameter of the Intention (optional target)
-	 *
 	 */
 	 */
 	@Override
 	@Override
 	public final void setIntention(CtrlIntention intention, Object arg0)
 	public final void setIntention(CtrlIntention intention, Object arg0)
@@ -268,50 +257,14 @@ public abstract class AbstractAI implements Ctrl
 		setIntention(intention, arg0, null);
 		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
 	@Override
 	public final void setIntention(CtrlIntention intention, Object arg0, Object arg1)
 	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
 		// 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();
 			stopFollow();
+		}
 		
 		
 		// Launch the onIntention method of the L2CharacterAI corresponding to the new Intention
 		// Launch the onIntention method of the L2CharacterAI corresponding to the new Intention
 		switch (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
 	 * @param evt The event whose the AI must be notified
-	 *
 	 */
 	 */
 	@Override
 	@Override
 	public final void notifyEvent(CtrlEvent evt)
 	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 evt The event whose the AI must be notified
 	 * @param arg0 The first parameter of the Event (optional target)
 	 * @param arg0 The first parameter of the Event (optional target)
-	 *
 	 */
 	 */
 	@Override
 	@Override
 	public final void notifyEvent(CtrlEvent evt, Object arg0)
 	public final void notifyEvent(CtrlEvent evt, Object arg0)
@@ -383,46 +327,11 @@ public abstract class AbstractAI implements Ctrl
 		notifyEvent(evt, arg0, null);
 		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 evt The event whose the AI must be notified
 	 * @param arg0 The first parameter of the Event (optional target)
 	 * @param arg0 The first parameter of the Event (optional target)
 	 * @param arg1 The second parameter of the Event (optional target)
 	 * @param arg1 The second parameter of the Event (optional target)
-	 *
 	 */
 	 */
 	@Override
 	@Override
 	public final void notifyEvent(CtrlEvent evt, Object arg0, Object arg1)
 	public final void notifyEvent(CtrlEvent evt, Object arg0, Object arg1)
@@ -432,11 +341,6 @@ public abstract class AbstractAI implements Ctrl
 			return;
 			return;
 		}
 		}
 		
 		
-		/*
-		 if (Config.DEBUG)
-		 _log.warning("AbstractAI: notifyEvent -> " + evt + " " + arg0 + " " + arg1);
-		 */
-		
 		switch (evt)
 		switch (evt)
 		{
 		{
 			case EVT_THINK:
 			case EVT_THINK:
@@ -471,7 +375,9 @@ public abstract class AbstractAI implements Ctrl
 				break;
 				break;
 			case EVT_READY_TO_ACT:
 			case EVT_READY_TO_ACT:
 				if (!_actor.isCastingNow() && !_actor.isCastingSimultaneouslyNow())
 				if (!_actor.isCastingNow() && !_actor.isCastingSimultaneouslyNow())
+				{
 					onEvtReadyToAct();
 					onEvtReadyToAct();
+				}
 				break;
 				break;
 			case EVT_USER_CMD:
 			case EVT_USER_CMD:
 				onEvtUserCmd(arg0, arg1);
 				onEvtUserCmd(arg0, arg1);
@@ -479,12 +385,16 @@ public abstract class AbstractAI implements Ctrl
 			case EVT_ARRIVED:
 			case EVT_ARRIVED:
 				// happens e.g. from stopmove but we don't process it if we're casting
 				// happens e.g. from stopmove but we don't process it if we're casting
 				if (!_actor.isCastingNow() && !_actor.isCastingSimultaneouslyNow())
 				if (!_actor.isCastingNow() && !_actor.isCastingSimultaneouslyNow())
+				{
 					onEvtArrived();
 					onEvtArrived();
+				}
 				break;
 				break;
 			case EVT_ARRIVED_REVALIDATE:
 			case EVT_ARRIVED_REVALIDATE:
 				// this is disregarded if the char is not moving any more
 				// this is disregarded if the char is not moving any more
 				if (_actor.isMoving())
 				if (_actor.isMoving())
+				{
 					onEvtArrivedRevalidate();
 					onEvtArrivedRevalidate();
+				}
 				break;
 				break;
 			case EVT_ARRIVED_BLOCKED:
 			case EVT_ARRIVED_BLOCKED:
 				onEvtArrivedBlocked((L2CharPosition) arg0);
 				onEvtArrivedBlocked((L2CharPosition) arg0);
@@ -572,23 +482,21 @@ public abstract class AbstractAI implements Ctrl
 	protected abstract void onEvtFinishCasting();
 	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()
 	protected void clientActionFailed()
 	{
 	{
 		if (_actor instanceof L2PcInstance)
 		if (_actor instanceof L2PcInstance)
+		{
 			_actor.sendPacket(ActionFailed.STATIC_PACKET);
 			_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)
 	protected void moveToPawn(L2Object pawn, int offset)
 	{
 	{
@@ -596,24 +504,30 @@ public abstract class AbstractAI implements Ctrl
 		if (!_actor.isMovementDisabled())
 		if (!_actor.isMovementDisabled())
 		{
 		{
 			if (offset < 10)
 			if (offset < 10)
+			{
 				offset = 10;
 				offset = 10;
+			}
 			
 			
 			// prevent possible extra calls to this function (there is none?),
 			// prevent possible extra calls to this function (there is none?),
 			// also don't send movetopawn packets too often
 			// also don't send movetopawn packets too often
 			boolean sendPacket = true;
 			boolean sendPacket = true;
-			if (_clientMoving && _target == pawn)
+			if (_clientMoving && (_target == pawn))
 			{
 			{
 				if (_clientMovingToPawnOffset == offset)
 				if (_clientMovingToPawnOffset == offset)
 				{
 				{
 					if (GameTimeController.getGameTicks() < _moveToPawnTimeout)
 					if (GameTimeController.getGameTicks() < _moveToPawnTimeout)
+					{
 						return;
 						return;
+					}
 					sendPacket = false;
 					sendPacket = false;
 				}
 				}
 				else if (_actor.isOnGeodataPath())
 				else if (_actor.isOnGeodataPath())
 				{
 				{
 					// minimum time to calculate new route is 2 seconds
 					// minimum time to calculate new route is 2 seconds
 					if (GameTimeController.getGameTicks() < (_moveToPawnTimeout + 10))
 					if (GameTimeController.getGameTicks() < (_moveToPawnTimeout + 10))
+					{
 						return;
 						return;
+					}
 				}
 				}
 			}
 			}
 			
 			
@@ -624,8 +538,10 @@ public abstract class AbstractAI implements Ctrl
 			_moveToPawnTimeout = GameTimeController.getGameTicks();
 			_moveToPawnTimeout = GameTimeController.getGameTicks();
 			_moveToPawnTimeout += 1000 / GameTimeController.MILLIS_IN_TICK;
 			_moveToPawnTimeout += 1000 / GameTimeController.MILLIS_IN_TICK;
 			
 			
-			if (pawn == null || _accessor == null)
+			if ((pawn == null) || (_accessor == null))
+			{
 				return;
 				return;
+			}
 			
 			
 			// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
 			// 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);
 			_accessor.moveTo(pawn.getX(), pawn.getY(), pawn.getZ(), offset);
@@ -644,11 +560,15 @@ public abstract class AbstractAI implements Ctrl
 					_actor.broadcastPacket(new MoveToLocation(_actor));
 					_actor.broadcastPacket(new MoveToLocation(_actor));
 					_clientMovingToPawnOffset = 0;
 					_clientMovingToPawnOffset = 0;
 				}
 				}
-				else if (sendPacket) // don't repeat unnecessarily
+				else if (sendPacket)
+				{
 					_actor.broadcastPacket(new MoveToPawn(_actor, (L2Character) pawn, offset));
 					_actor.broadcastPacket(new MoveToPawn(_actor, (L2Character) pawn, offset));
+				}
 			}
 			}
 			else
 			else
+			{
 				_actor.broadcastPacket(new MoveToLocation(_actor));
 				_actor.broadcastPacket(new MoveToLocation(_actor));
+			}
 		}
 		}
 		else
 		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)
 	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)
 	protected void clientStopMoving(L2CharPosition pos)
 	{
 	{
-		/*
-		 if (Config.DEBUG)
-		 _log.warning("clientStopMoving();");
-		 */
-		
 		// Stop movement of the L2Character
 		// Stop movement of the L2Character
 		if (_actor.isMoving())
 		if (_actor.isMoving())
+		{
 			_accessor.stopMove(pos);
 			_accessor.stopMove(pos);
+		}
 		
 		
 		_clientMovingToPawnOffset = 0;
 		_clientMovingToPawnOffset = 0;
 		
 		
-		if (_clientMoving || pos != null)
+		if (_clientMoving || (pos != null))
 		{
 		{
 			_clientMoving = false;
 			_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()
 	protected void clientStoppedMoving()
 	{
 	{
 		if (_clientMovingToPawnOffset > 0) // movetoPawn needs to be stopped
 		if (_clientMovingToPawnOffset > 0) // movetoPawn needs to be stopped
@@ -747,17 +664,17 @@ public abstract class AbstractAI implements Ctrl
 		{
 		{
 			L2Summon summon = (L2Summon) _actor;
 			L2Summon summon = (L2Summon) _actor;
 			if (summon.getOwner() != null)
 			if (summon.getOwner() != null)
+			{
 				summon.getOwner().getAI().setAutoAttacking(isAutoAttacking);
 				summon.getOwner().getAI().setAutoAttacking(isAutoAttacking);
+			}
 			return;
 			return;
 		}
 		}
 		_clientAutoAttacking = isAutoAttacking;
 		_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()
 	public void clientStartAutoAttack()
 	{
 	{
@@ -765,13 +682,17 @@ public abstract class AbstractAI implements Ctrl
 		{
 		{
 			L2Summon summon = (L2Summon) _actor;
 			L2Summon summon = (L2Summon) _actor;
 			if (summon.getOwner() != null)
 			if (summon.getOwner() != null)
+			{
 				summon.getOwner().getAI().clientStartAutoAttack();
 				summon.getOwner().getAI().clientStartAutoAttack();
+			}
 			return;
 			return;
 		}
 		}
 		if (!isAutoAttacking())
 		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
 			// Send a Server->Client packet AutoAttackStart to the actor and all L2PcInstance in its _knownPlayers
 			_actor.broadcastPacket(new AutoAttackStart(_actor.getObjectId()));
 			_actor.broadcastPacket(new AutoAttackStart(_actor.getObjectId()));
 			setAutoAttacking(true);
 			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()
 	public void clientStopAutoAttack()
 	{
 	{
@@ -791,13 +710,17 @@ public abstract class AbstractAI implements Ctrl
 		{
 		{
 			L2Summon summon = (L2Summon) _actor;
 			L2Summon summon = (L2Summon) _actor;
 			if (summon.getOwner() != null)
 			if (summon.getOwner() != null)
+			{
 				summon.getOwner().getAI().clientStopAutoAttack();
 				summon.getOwner().getAI().clientStopAutoAttack();
+			}
 			return;
 			return;
 		}
 		}
 		if (_actor instanceof L2PcInstance)
 		if (_actor instanceof L2PcInstance)
 		{
 		{
 			if (!AttackStanceTaskManager.getInstance().hasAttackStanceTask(_actor) && isAutoAttacking())
 			if (!AttackStanceTaskManager.getInstance().hasAttackStanceTask(_actor) && isAutoAttacking())
+			{
 				AttackStanceTaskManager.getInstance().addAttackStanceTask(_actor);
 				AttackStanceTaskManager.getInstance().addAttackStanceTask(_actor);
+			}
 		}
 		}
 		else if (isAutoAttacking())
 		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()
 	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
 	 * @param player The L2PcIstance to notify with state of this L2Character
-	 *
 	 */
 	 */
 	public void describeStateToPlayer(L2PcInstance player)
 	public void describeStateToPlayer(L2PcInstance player)
 	{
 	{
 		if (_clientMoving)
 		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
 				// Send a Server->Client packet MoveToPawn to the actor and all L2PcInstance in its _knownPlayers
 				MoveToPawn msg = new MoveToPawn(_actor, _followTarget, _clientMovingToPawnOffset);
 				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
 	 * @param target The L2Character to follow
-	 *
 	 */
 	 */
 	public synchronized void startFollow(L2Character target)
 	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 target The L2Character to follow
-	 * @param range 
+	 * @param range
 	 */
 	 */
 	public synchronized void startFollow(L2Character target, int 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()
 	public synchronized void stopFollow()
 	{
 	{
@@ -932,8 +847,6 @@ public abstract class AbstractAI implements Ctrl
 	@Override
 	@Override
 	public String toString()
 	public String toString()
 	{
 	{
-		if (_actor == null)
-			return "Actor: null";
 		return "Actor: " + _actor;
 		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;
 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
 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
 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,
 	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.
 	 * this event if they already attack someone, or change target and so on.
 	 */
 	 */
 	EVT_ATTACKED,
 	EVT_ATTACKED,
@@ -40,27 +41,31 @@ public enum CtrlEvent
 	EVT_ROOTED,
 	EVT_ROOTED,
 	/** Actor evaded hit **/
 	/** Actor evaded hit **/
 	EVT_EVADED,
 	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,
 	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,
 	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,
 	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,
 	EVT_ARRIVED_REVALIDATE,
 	/** The actor cannot move anymore. */
 	/** The actor cannot move anymore. */
 	EVT_ARRIVED_BLOCKED,
 	EVT_ARRIVED_BLOCKED,
 	/** Forgets an object (if it's used as attack target, follow target and so on */
 	/** Forgets an object (if it's used as attack target, follow target and so on */
 	EVT_FORGET_OBJECT,
 	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.
 	 * attempt to cancel a cast/bow attack and so on.
 	 */
 	 */
 	EVT_CANCEL,
 	EVT_CANCEL,

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

@@ -15,8 +15,7 @@
 package com.l2jserver.gameserver.ai;
 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
 public enum CtrlIntention
 {
 {
@@ -26,8 +25,7 @@ public enum CtrlIntention
 	AI_INTENTION_ACTIVE,
 	AI_INTENTION_ACTIVE,
 	/** Rest (sit until attacked) */
 	/** Rest (sit until attacked) */
 	AI_INTENTION_REST,
 	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,
 	AI_INTENTION_ATTACK,
 	/** Cast a spell, depending on the spell - may start or stop attacking */
 	/** Cast a spell, depending on the spell - may start or stop attacking */
 	AI_INTENTION_CAST,
 	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)
 	protected void clientStopMoving(L2CharPosition pos)
 	{
 	{
 		if (_actor.isMoving())
 		if (_actor.isMoving())
+		{
 			_accessor.stopMove(pos);
 			_accessor.stopMove(pos);
+		}
 		
 		
-		if (_clientMoving || pos != null)
+		if (_clientMoving || (pos != null))
 		{
 		{
 			_clientMoving = false;
 			_clientMoving = false;
 			_actor.broadcastPacket(new ExStopMoveAirShip(getActor()));
 			_actor.broadcastPacket(new ExStopMoveAirShip(getActor()));
@@ -58,12 +60,14 @@ public class L2AirShipAI extends L2VehicleAI
 	public void describeStateToPlayer(L2PcInstance player)
 	public void describeStateToPlayer(L2PcInstance player)
 	{
 	{
 		if (_clientMoving)
 		if (_clientMoving)
+		{
 			player.sendPacket(new ExMoveToLocationAirShip(getActor()));
 			player.sendPacket(new ExMoveToLocationAirShip(getActor()));
+		}
 	}
 	}
 	
 	
 	@Override
 	@Override
 	public L2AirShipInstance getActor()
 	public L2AirShipInstance getActor()
 	{
 	{
-		return (L2AirShipInstance)_actor;
+		return (L2AirShipInstance) _actor;
 	}
 	}
 }
 }

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

File diff suppressed because it is too large
+ 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);
 		super(accessor);
 	}
 	}
 	
 	
-	// rather stupid AI... well,  it's for doors :D
+	// rather stupid AI... well, it's for doors :D
 	@Override
 	@Override
 	protected void onIntentionIdle()
 	protected void onIntentionIdle()
 	{
 	{
@@ -152,8 +152,8 @@ public class L2DoorAI extends L2CharacterAI
 	
 	
 	private class onEventAttackedDoorTask implements Runnable
 	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)
 		public onEventAttackedDoorTask(L2DoorInstance door, L2Character attacker)
 		{
 		{
@@ -166,7 +166,7 @@ public class L2DoorAI extends L2CharacterAI
 		{
 		{
 			for (L2DefenderInstance guard : _door.getKnownDefenders())
 			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);
 					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
 	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;
 	private Future<?> _aiTask;
 	
 	
 	/** For attack AI, analysis of mob and its targets */
 	/** 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 */
 	/** The delay after which the attacked is stopped */
 	private int _attackTimeout;
 	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 */
 	/** The flag used to indicate that a thinking action is in progress */
 	private boolean _thinking; // to prevent recursive thinking
 	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
 	 * @param accessor The AI accessor of the L2Character
-	 *
 	 */
 	 */
 	public L2FortSiegeGuardAI(L2Character.AIAccessor accessor)
 	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 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 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 target is in the actor Aggro range and is at the same height</li>
 	 * <li>The L2PcInstance target has karma (=PK)</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 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 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 target is in the actor Aggro range and is at the same height</li>
 	 * <li>A siege is in progress</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 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 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 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 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 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 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
 	 * @param target The targeted L2Object
 	 * @return True if the target is autoattackable (depends on the actor type).
 	 * @return True if the target is autoattackable (depends on the actor type).
 	 */
 	 */
 	private boolean autoAttackCondition(L2Character target)
 	private boolean autoAttackCondition(L2Character target)
 	{
 	{
 		// Check if the target isn't another guard, folk or a door
 		// 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;
 			L2PcInstance player = null;
 			if (target instanceof L2PcInstance)
 			if (target instanceof L2PcInstance)
-				player = ((L2PcInstance)target);
+			{
+				player = ((L2PcInstance) target);
+			}
 			else if (target instanceof L2Summon)
 			else if (target instanceof L2Summon)
+			{
 				player = ((L2Summon) target).getOwner();
 				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;
 				return false;
+			}
 		}
 		}
 		
 		
 		// Check if the target isn't invulnerable
 		// Check if the target isn't invulnerable
 		if ((target != null) && target.isInvul())
 		if ((target != null) && target.isInvul())
 		{
 		{
 			// However EffectInvincible requires to check GMs specially
 			// However EffectInvincible requires to check GMs specially
-			if (target instanceof L2PcInstance && ((L2PcInstance) target).isGM())
+			if ((target instanceof L2PcInstance) && ((L2PcInstance) target).isGM())
+			{
 				return false;
 				return false;
-			if (target instanceof L2Summon && ((L2Summon) target).getOwner().isGM())
+			}
+			if ((target instanceof L2Summon) && ((L2Summon) target).getOwner().isGM())
+			{
 				return false;
 				return false;
+			}
 		}
 		}
 		
 		
 		// Get the owner if the target is a summon
 		// 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();
 			L2PcInstance owner = ((L2Summon) target).getOwner();
 			if (_actor.isInsideRadius(owner, 1000, true, false))
 			if (_actor.isInsideRadius(owner, 1000, true, false))
+			{
 				target = owner;
 				target = owner;
+			}
 		}
 		}
 		
 		
 		// Check if the target is a L2PcInstance
 		// 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)
 			// Check if the target isn't in silent move mode AND too far (>100)
 			if (((L2Playable) target).isSilentMoving() && !_actor.isInsideRadius(target, 250, false, false))
 			if (((L2Playable) target).isSilentMoving() && !_actor.isInsideRadius(target, 250, false, false))
+			{
 				return false;
 				return false;
+			}
 		}
 		}
 		// Los Check Here
 		// Los Check Here
 		return (_actor.isAutoAttackable(target) && GeoData.getInstance().canSeeTarget(_actor, target));
 		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 intention The new Intention to set to the AI
 	 * @param arg0 The first parameter of the Intention
 	 * @param arg0 The first parameter of the Intention
 	 * @param arg1 The second parameter of the Intention
 	 * @param arg1 The second parameter of the Intention
-	 *
 	 */
 	 */
 	@Override
 	@Override
 	synchronized void changeIntention(CtrlIntention intention, Object arg0, Object arg1)
 	synchronized void changeIntention(CtrlIntention intention, Object arg0, Object arg1)
 	{
 	{
 		if (Config.DEBUG)
 		if (Config.DEBUG)
+		{
 			_log.warning(getClass().getSimpleName() + ": changeIntention(" + intention + ", " + arg0 + ", " + arg1 + ")");
 			_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
 			// Check if actor is not dead
 			if (!_actor.isAlikeDead())
 			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 its _knownPlayer isn't empty set the Intention to AI_INTENTION_ACTIVE
 				if (!npc.getKnownList().getKnownPlayers().isEmpty())
 				if (!npc.getKnownList().getKnownPlayers().isEmpty())
+				{
 					intention = AI_INTENTION_ACTIVE;
 					intention = AI_INTENTION_ACTIVE;
+				}
 				else
 				else
+				{
 					intention = AI_INTENTION_IDLE;
 					intention = AI_INTENTION_IDLE;
+				}
 			}
 			}
 			
 			
 			if (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
 	 * @param target The L2Character to attack
-	 *
 	 */
 	 */
 	@Override
 	@Override
 	protected void onIntentionAttack(L2Character target)
 	protected void onIntentionAttack(L2Character target)
@@ -237,18 +252,18 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 		_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks();
 		_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks();
 		
 		
 		// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
 		// 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);
 		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>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 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()
 	private void thinkActive()
 	{
 	{
@@ -258,9 +273,13 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 		if (_globalAggro != 0)
 		if (_globalAggro != 0)
 		{
 		{
 			if (_globalAggro < 0)
 			if (_globalAggro < 0)
+			{
 				_globalAggro++;
 				_globalAggro++;
+			}
 			else
 			else
+			{
 				_globalAggro--;
 				_globalAggro--;
+			}
 		}
 		}
 		
 		
 		// Add all autoAttackable L2Character in L2Attackable Aggro Range to its _aggroList with 0 damage and 1 hate
 		// 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))
 			for (L2Character target : npc.getKnownList().getKnownCharactersInRadius(_attackRange))
 			{
 			{
 				if (target == null)
 				if (target == null)
+				{
 					continue;
 					continue;
+				}
 				if (autoAttackCondition(target)) // check aggression
 				if (autoAttackCondition(target)) // check aggression
 				{
 				{
 					// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
 					// 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
 					// Add the attacker to the L2Attackable _aggroList with 0 damage and 1 hate
 					if (hating == 0)
 					if (hating == 0)
+					{
 						npc.addDamageHate(target, 0, 1);
 						npc.addDamageHate(target, 0, 1);
+					}
 				}
 				}
 			}
 			}
 			
 			
 			// Chose a target from its aggroList
 			// Chose a target from its aggroList
 			L2Character hated;
 			L2Character hated;
 			if (_actor.isConfused())
 			if (_actor.isConfused())
+			{
 				hated = getAttackTarget(); // Force mobs to attack anybody if confused
 				hated = getAttackTarget(); // Force mobs to attack anybody if confused
+			}
 			else
 			else
+			{
 				hated = npc.getMostHated();
 				hated = npc.getMostHated();
-			//_mostHatedAnalysis.Update(hated);
+				// _mostHatedAnalysis.Update(hated);
+			}
 			
 			
 			// Order to the L2Attackable to attack the target
 			// Order to the L2Attackable to attack the target
 			if (hated != null)
 			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
 				// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
 				int aggro = npc.getHating(hated);
 				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
 					// Set the L2Character movement type to run and send Server->Client packet ChangeMoveType to all others L2PcInstance
 					if (!_actor.isRunning())
 					if (!_actor.isRunning())
+					{
 						_actor.setRunning();
 						_actor.setRunning();
+					}
 					
 					
 					// Set the AI Intention to AI_INTENTION_ATTACK
 					// Set the AI Intention to AI_INTENTION_ATTACK
 					setIntention(CtrlIntention.AI_INTENTION_ATTACK, hated, null);
 					setIntention(CtrlIntention.AI_INTENTION_ATTACK, hated, null);
@@ -314,28 +343,33 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 		if (_actor.getWalkSpeed() >= 0)
 		if (_actor.getWalkSpeed() >= 0)
 		{
 		{
 			if (_actor instanceof L2DefenderInstance)
 			if (_actor instanceof L2DefenderInstance)
+			{
 				((L2DefenderInstance) _actor).returnHome();
 				((L2DefenderInstance) _actor).returnHome();
+			}
 			else
 			else
+			{
 				((L2FortCommanderInstance) _actor).returnHome();
 				((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>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>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>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)
 	 * TODO: Manage casting rules to healer mobs (like Ant Nurses)
-	 *
 	 */
 	 */
 	private void thinkAttack()
 	private void thinkAttack()
 	{
 	{
 		if (Config.DEBUG)
 		if (Config.DEBUG)
+		{
 			_log.warning(getClass().getSimpleName() + ": thinkAttack(); timeout=" + (_attackTimeout - GameTimeController.getGameTicks()));
 			_log.warning(getClass().getSimpleName() + ": thinkAttack(); timeout=" + (_attackTimeout - GameTimeController.getGameTicks()));
+		}
 		
 		
 		if (_attackTimeout < GameTimeController.getGameTicks())
 		if (_attackTimeout < GameTimeController.getGameTicks())
 		{
 		{
@@ -352,7 +386,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 		
 		
 		L2Character attackTarget = getAttackTarget();
 		L2Character attackTarget = getAttackTarget();
 		// Check if target is dead or if timeout is expired to stop this attack
 		// 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
 			// Stop hating this target after the attack timeout or if target is dead
 			if (attackTarget != null)
 			if (attackTarget != null)
@@ -380,42 +414,58 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 	{
 	{
 		L2Character target = getAttackTarget();
 		L2Character target = getAttackTarget();
 		// Call all L2Object of its Faction inside the Faction Range
 		// 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;
 			return;
+		}
 		
 		
 		if (target.isInvul())
 		if (target.isInvul())
+		{
 			return; // speeding it up for siege guards
 			return; // speeding it up for siege guards
+		}
 		
 		
 		String faction_id = ((L2Npc) _actor).getFactionId();
 		String faction_id = ((L2Npc) _actor).getFactionId();
 		
 		
 		// Go through all L2Character that belong to its faction
 		// 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))
 		for (L2Character cha : _actor.getKnownList().getKnownCharactersInRadius(1000))
 		{
 		{
 			if (cha == null)
 			if (cha == null)
+			{
 				continue;
 				continue;
+			}
 			
 			
 			if (!(cha instanceof L2Npc))
 			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
 					// 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)
 						for (L2Skill sk : _selfAnalysis.healSkills)
 						{
 						{
 							if (_actor.getCurrentMp() < sk.getMpConsume())
 							if (_actor.getCurrentMp() < sk.getMpConsume())
+							{
 								continue;
 								continue;
+							}
 							if (_actor.isSkillDisabled(sk))
 							if (_actor.isSkillDisabled(sk))
+							{
 								continue;
 								continue;
+							}
 							if (!Util.checkIfInRange(sk.getCastRange(), _actor, cha, true))
 							if (!Util.checkIfInRange(sk.getCastRange(), _actor, cha, true))
+							{
 								continue;
 								continue;
+							}
 							
 							
 							int chance = 5;
 							int chance = 5;
-							if (chance >= Rnd.get(100)) // chance
+							if (chance >= Rnd.get(100))
+							{
 								continue;
 								continue;
+							}
 							if (!GeoData.getInstance().canSeeTarget(_actor, cha))
 							if (!GeoData.getInstance().canSeeTarget(_actor, cha))
+							{
 								break;
 								break;
+							}
 							
 							
 							L2Object OldTarget = _actor.getTarget();
 							L2Object OldTarget = _actor.getTarget();
 							_actor.setTarget(cha);
 							_actor.setTarget(cha);
@@ -432,38 +482,49 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 			L2Npc npc = (L2Npc) cha;
 			L2Npc npc = (L2Npc) cha;
 			
 			
 			if (!faction_id.equals(npc.getFactionId()))
 			if (!faction_id.equals(npc.getFactionId()))
+			{
 				continue;
 				continue;
+			}
 			
 			
 			if (npc.getAI() != null) // TODO: possibly check not needed
 			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
 					// Notify the L2Object AI with EVT_AGGRESSION
 					npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, getAttackTarget(), 1);
 					npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, getAttackTarget(), 1);
 					return;
 					return;
 				}
 				}
 				// heal friends
 				// 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)
 					for (L2Skill sk : _selfAnalysis.healSkills)
 					{
 					{
 						if (_actor.getCurrentMp() < sk.getMpConsume())
 						if (_actor.getCurrentMp() < sk.getMpConsume())
+						{
 							continue;
 							continue;
+						}
 						if (_actor.isSkillDisabled(sk))
 						if (_actor.isSkillDisabled(sk))
+						{
 							continue;
 							continue;
+						}
 						if (!Util.checkIfInRange(sk.getCastRange(), _actor, npc, true))
 						if (!Util.checkIfInRange(sk.getCastRange(), _actor, npc, true))
+						{
 							continue;
 							continue;
+						}
 						
 						
 						int chance = 4;
 						int chance = 4;
-						if (chance >= Rnd.get(100)) // chance
+						if (chance >= Rnd.get(100))
+						{
 							continue;
 							continue;
+						}
 						if (!GeoData.getInstance().canSeeTarget(_actor, npc))
 						if (!GeoData.getInstance().canSeeTarget(_actor, npc))
+						{
 							break;
 							break;
+						}
 						
 						
 						L2Object OldTarget = _actor.getTarget();
 						L2Object OldTarget = _actor.getTarget();
 						_actor.setTarget(npc);
 						_actor.setTarget(npc);
@@ -485,9 +546,13 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 		int range = 0;
 		int range = 0;
 		L2DefenderInstance sGuard;
 		L2DefenderInstance sGuard;
 		if (_actor instanceof L2FortCommanderInstance)
 		if (_actor instanceof L2FortCommanderInstance)
+		{
 			sGuard = (L2FortCommanderInstance) _actor;
 			sGuard = (L2FortCommanderInstance) _actor;
+		}
 		else
 		else
+		{
 			sGuard = (L2DefenderInstance) _actor;
 			sGuard = (L2DefenderInstance) _actor;
+		}
 		L2Character attackTarget = getAttackTarget();
 		L2Character attackTarget = getAttackTarget();
 		
 		
 		try
 		try
@@ -497,18 +562,20 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 			dist_2 = _actor.getPlanDistanceSq(attackTarget.getX(), attackTarget.getY());
 			dist_2 = _actor.getPlanDistanceSq(attackTarget.getX(), attackTarget.getY());
 			range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + attackTarget.getTemplate().getCollisionRadius();
 			range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + attackTarget.getTemplate().getCollisionRadius();
 			if (attackTarget.isMoving())
 			if (attackTarget.isMoving())
+			{
 				range += 50;
 				range += 50;
+			}
 		}
 		}
 		catch (NullPointerException e)
 		catch (NullPointerException e)
 		{
 		{
-			//_log.warning("AttackableAI: Attack target is NULL.");
+			// _log.warning("AttackableAI: Attack target is NULL.");
 			_actor.setTarget(null);
 			_actor.setTarget(null);
 			setIntention(AI_INTENTION_IDLE, null, null);
 			setIntention(AI_INTENTION_IDLE, null, null);
 			return;
 			return;
 		}
 		}
 		
 		
 		// never attack defenders
 		// 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
 			// Cancel the target
 			sGuard.stopHating(attackTarget);
 			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
 		// 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
 			// check for long ranged skills and heal/buff skills
 			for (L2Skill sk : skills)
 			for (L2Skill sk : skills)
 			{
 			{
 				int castRange = sk.getCastRange();
 				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();
 					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;
 						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;
 							useSkillSelf = false;
 							break;
 							break;
@@ -550,7 +617,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 						if (sk.getSkillType() == L2SkillType.BUFF)
 						if (sk.getSkillType() == L2SkillType.BUFF)
 						{
 						{
 							L2Effect[] effects = _actor.getAllEffects();
 							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];
 								L2Effect effect = effects[i];
 								if (effect.getSkill() == sk)
 								if (effect.getSkill() == sk)
@@ -561,7 +628,9 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 							}
 							}
 						}
 						}
 						if (useSkillSelf)
 						if (useSkillSelf)
+						{
 							_actor.setTarget(_actor);
 							_actor.setTarget(_actor);
+						}
 					}
 					}
 					
 					
 					clientStopMoving(null);
 					clientStopMoving(null);
@@ -588,8 +657,8 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 				double homeY = attackTarget.getY() - sGuard.getSpawn().getLocy();
 				double homeY = attackTarget.getY() - sGuard.getSpawn().getLocy();
 				
 				
 				// Check if the L2SiegeGuardInstance isn't too far from it's home location
 				// 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
 					// Cancel the target
 					_actor.getKnownList().removeKnownObject(attackTarget);
 					_actor.getKnownList().removeKnownObject(attackTarget);
@@ -597,20 +666,28 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 					setIntention(AI_INTENTION_IDLE, null, null);
 					setIntention(AI_INTENTION_IDLE, null, null);
 				}
 				}
 				else
 				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,
 					// Temporary hack for preventing guards jumping off towers,
 					// before replacing this with effective geodata checks and AI modification
 					// 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)
 						if (_selfAnalysis.isMage)
+						{
 							range = _selfAnalysis.maxCastRange - 50;
 							range = _selfAnalysis.maxCastRange - 50;
+						}
 						if (_actor.getWalkSpeed() <= 0)
 						if (_actor.getWalkSpeed() <= 0)
+						{
 							return;
 							return;
+						}
 						if (attackTarget.isMoving())
 						if (attackTarget.isMoving())
+						{
 							moveToPawn(attackTarget, range - 70);
 							moveToPawn(attackTarget, range - 70);
+						}
 						else
 						else
+						{
 							moveToPawn(attackTarget, range);
 							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 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,
 			// Temporary hack for preventing guards jumping off towers,
 			// before replacing this with effective geodata checks and AI modification
 			// before replacing this with effective geodata checks and AI modification
 			double dz = _actor.getZ() - attackTarget.getZ();
 			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)
 				if (_selfAnalysis.isMage)
+				{
 					range = _selfAnalysis.maxCastRange - 50;
 					range = _selfAnalysis.maxCastRange - 50;
+				}
 				if (_actor.getWalkSpeed() <= 0)
 				if (_actor.getWalkSpeed() <= 0)
+				{
 					return;
 					return;
+				}
 				if (attackTarget.isMoving())
 				if (attackTarget.isMoving())
+				{
 					moveToPawn(attackTarget, range - 70);
 					moveToPawn(attackTarget, range - 70);
+				}
 				else
 				else
+				{
 					moveToPawn(attackTarget, range);
 					moveToPawn(attackTarget, range);
+				}
 			}
 			}
 			return;
 			return;
 		}
 		}
 		// Else, if this is close enough to attack
 		// 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
 			// Force mobs to attack anybody if confused
 			L2Character hated = null;
 			L2Character hated = null;
 			if (_actor.isConfused())
 			if (_actor.isConfused())
+			{
 				hated = attackTarget;
 				hated = attackTarget;
+			}
 			else
 			else
+			{
 				hated = ((L2Attackable) _actor).getMostHated();
 				hated = ((L2Attackable) _actor).getMostHated();
+			}
 			
 			
 			if (hated == null)
 			if (hated == null)
 			{
 			{
@@ -653,24 +742,26 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 				return;
 				return;
 			}
 			}
 			if (hated != attackTarget)
 			if (hated != attackTarget)
+			{
 				attackTarget = hated;
 				attackTarget = hated;
+			}
 			
 			
 			_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks();
 			_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks();
 			
 			
 			// check for close combat skills && heal/buff skills
 			// 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)
 				for (L2Skill sk : skills)
 				{
 				{
 					int castRange = sk.getCastRange();
 					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();
 						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;
 							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;
 								useSkillSelf = false;
 								break;
 								break;
@@ -678,7 +769,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 							if (sk.getSkillType() == L2SkillType.BUFF)
 							if (sk.getSkillType() == L2SkillType.BUFF)
 							{
 							{
 								L2Effect[] effects = _actor.getAllEffects();
 								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];
 									L2Effect effect = effects[i];
 									if (effect.getSkill() == sk)
 									if (effect.getSkill() == sk)
@@ -689,7 +780,9 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 								}
 								}
 							}
 							}
 							if (useSkillSelf)
 							if (useSkillSelf)
+							{
 								_actor.setTarget(_actor);
 								_actor.setTarget(_actor);
+							}
 						}
 						}
 						
 						
 						clientStopMoving(null);
 						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
 	@Override
 	protected void onEvtThink()
 	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
 		// Check if the actor can't use skills and if a thinking action isn't already in progress
 		if (_thinking || _actor.isCastingNow() || _actor.isAllSkillsDisabled())
 		if (_thinking || _actor.isCastingNow() || _actor.isAllSkillsDisabled())
+		{
 			return;
 			return;
+		}
 		
 		
 		// Start thinking action
 		// Start thinking action
 		_thinking = true;
 		_thinking = true;
@@ -724,9 +819,13 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 		{
 		{
 			// Manage AI thinks of a L2Attackable
 			// Manage AI thinks of a L2Attackable
 			if (getIntention() == AI_INTENTION_ACTIVE)
 			if (getIntention() == AI_INTENTION_ACTIVE)
+			{
 				thinkActive();
 				thinkActive();
+			}
 			else if (getIntention() == AI_INTENTION_ATTACK)
 			else if (getIntention() == AI_INTENTION_ATTACK)
+			{
 				thinkAttack();
 				thinkAttack();
+			}
 		}
 		}
 		finally
 		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>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 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
 	 * @param attacker The L2Character that attacks the actor
-	 *
 	 */
 	 */
 	@Override
 	@Override
 	protected void onEvtAttacked(L2Character attacker)
 	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
 		// Set the _globalAggro to 0 to permit attack even just after spawn
 		if (_globalAggro < 0)
 		if (_globalAggro < 0)
+		{
 			_globalAggro = 0;
 			_globalAggro = 0;
+		}
 		
 		
 		// Add the attacker to the _aggroList of the actor
 		// Add the attacker to the _aggroList of the actor
 		((L2Attackable) _actor).addDamageHate(attacker, 0, 1);
 		((L2Attackable) _actor).addDamageHate(attacker, 0, 1);
 		
 		
 		// Set the L2Character movement type to run and send Server->Client packet ChangeMoveType to all others L2PcInstance
 		// Set the L2Character movement type to run and send Server->Client packet ChangeMoveType to all others L2PcInstance
 		if (!_actor.isRunning())
 		if (!_actor.isRunning())
+		{
 			_actor.setRunning();
 			_actor.setRunning();
+		}
 		
 		
 		// Set the Intention to AI_INTENTION_ATTACK
 		// Set the Intention to AI_INTENTION_ATTACK
 		if (getIntention() != 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
 	 * @param aggro The value of hate to add to the actor against the target
-	 *
 	 */
 	 */
 	@Override
 	@Override
 	protected void onEvtAggression(L2Character target, int aggro)
 	protected void onEvtAggression(L2Character target, int aggro)
 	{
 	{
 		if (_actor == null)
 		if (_actor == null)
+		{
 			return;
 			return;
+		}
 		L2Attackable me = (L2Attackable) _actor;
 		L2Attackable me = (L2Attackable) _actor;
 		
 		
 		if (target != null)
 		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
 				// Set the L2Character movement type to run and send Server->Client packet ChangeMoveType to all others L2PcInstance
 				if (!_actor.isRunning())
 				if (!_actor.isRunning())
+				{
 					_actor.setRunning();
 					_actor.setRunning();
+				}
 				
 				
 				L2DefenderInstance sGuard;
 				L2DefenderInstance sGuard;
 				if (_actor instanceof L2FortCommanderInstance)
 				if (_actor instanceof L2FortCommanderInstance)
+				{
 					sGuard = (L2FortCommanderInstance) _actor;
 					sGuard = (L2FortCommanderInstance) _actor;
+				}
 				else
 				else
+				{
 					sGuard = (L2DefenderInstance) _actor;
 					sGuard = (L2DefenderInstance) _actor;
+				}
 				double homeX = target.getX() - sGuard.getSpawn().getLocx();
 				double homeX = target.getX() - sGuard.getSpawn().getLocx();
 				double homeY = target.getY() - sGuard.getSpawn().getLocy();
 				double homeY = target.getY() - sGuard.getSpawn().getLocy();
 				
 				
 				// Check if the L2SiegeGuardInstance is not too far from its home location
 				// 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);
 					setIntention(CtrlIntention.AI_INTENTION_ATTACK, target, null);
+				}
 			}
 			}
 		}
 		}
 		else
 		else
 		{
 		{
 			// currently only for setting lower general aggro
 			// currently only for setting lower general aggro
 			if (aggro >= 0)
 			if (aggro >= 0)
+			{
 				return;
 				return;
+			}
 			
 			
 			L2Character mostHated = me.getMostHated();
 			L2Character mostHated = me.getMostHated();
 			if (mostHated == null)
 			if (mostHated == null)
@@ -842,7 +955,9 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 			}
 			}
 			
 			
 			for (L2Character aggroed : me.getAggroList().keySet())
 			for (L2Character aggroed : me.getAggroList().keySet())
+			{
 				me.addDamageHate(aggroed, 0, aggro);
 				me.addDamageHate(aggroed, 0, aggro);
+			}
 			
 			
 			aggro = me.getHating(mostHated);
 			aggro = me.getHating(mostHated);
 			if (aggro <= 0)
 			if (aggro <= 0)
@@ -865,5 +980,4 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
 		_accessor.detachAI();
 		_accessor.detachAI();
 		super.stopAITask();
 		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;
 	private int _currentPos;
 	
 	
 	/**
 	/**
-	 * Constructor of L2CharacterAI.<BR><BR>
-	 *
+	 * Constructor of L2CharacterAI.
 	 * @param accessor The AI accessor of the L2Character
 	 * @param accessor The AI accessor of the L2Character
 	 */
 	 */
 	public L2NpcWalkerAI(L2Character.AIAccessor accessor)
 	public L2NpcWalkerAI(L2Character.AIAccessor accessor)
@@ -58,16 +57,22 @@ public class L2NpcWalkerAI extends L2CharacterAI implements Runnable
 		super(accessor);
 		super(accessor);
 		
 		
 		if (!Config.ALLOW_NPC_WALKERS)
 		if (!Config.ALLOW_NPC_WALKERS)
+		{
 			return;
 			return;
+		}
 		
 		
 		_route = NpcWalkerRoutesData.getInstance().getRouteForNpc(getActor().getNpcId());
 		_route = NpcWalkerRoutesData.getInstance().getRouteForNpc(getActor().getNpcId());
 		
 		
 		// Here we need 1 second initial delay cause getActor().hasAI() will return null...
 		// 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
 		// Constructor of L2NpcWalkerAI is called faster then ai object is attached in L2NpcWalkerInstance
 		if (_route != null)
 		if (_route != null)
+		{
 			ThreadPoolManager.getInstance().scheduleAiAtFixedRate(this, 1000, 1000);
 			ThreadPoolManager.getInstance().scheduleAiAtFixedRate(this, 1000, 1000);
+		}
 		else
 		else
-			_log.warning(getClass().getSimpleName()+": Missing route data! Npc: "+_actor);
+		{
+			_log.warning(getClass().getSimpleName() + ": Missing route data! Npc: " + _actor);
+		}
 	}
 	}
 	
 	
 	@Override
 	@Override
@@ -80,7 +85,9 @@ public class L2NpcWalkerAI extends L2CharacterAI implements Runnable
 	protected void onEvtThink()
 	protected void onEvtThink()
 	{
 	{
 		if (!Config.ALLOW_NPC_WALKERS)
 		if (!Config.ALLOW_NPC_WALKERS)
+		{
 			return;
 			return;
+		}
 		
 		
 		if (isWalkingToNextPoint())
 		if (isWalkingToNextPoint())
 		{
 		{
@@ -89,7 +96,9 @@ public class L2NpcWalkerAI extends L2CharacterAI implements Runnable
 		}
 		}
 		
 		
 		if (_nextMoveTime < System.currentTimeMillis())
 		if (_nextMoveTime < System.currentTimeMillis())
+		{
 			walkToLocation();
 			walkToLocation();
+		}
 	}
 	}
 	
 	
 	/**
 	/**
@@ -120,20 +129,26 @@ public class L2NpcWalkerAI extends L2CharacterAI implements Runnable
 			NpcStringId npcString = _route.get(_currentPos).getNpcString();
 			NpcStringId npcString = _route.get(_currentPos).getNpcString();
 			String chat = null;
 			String chat = null;
 			if (npcString == null)
 			if (npcString == null)
+			{
 				chat = _route.get(_currentPos).getChatText();
 				chat = _route.get(_currentPos).getChatText();
+			}
 			
 			
-			if ((npcString != null) || (chat != null && !chat.isEmpty()))
+			if ((npcString != null) || ((chat != null) && !chat.isEmpty()))
+			{
 				getActor().broadcastChat(chat, npcString);
 				getActor().broadcastChat(chat, npcString);
+			}
 			
 			
-			//time in millis
+			// time in millis
 			long delay = _route.get(_currentPos).getDelay() * 1000;
 			long delay = _route.get(_currentPos).getDelay() * 1000;
 			
 			
-			//sleeps between each move
+			// sleeps between each move
 			if (delay < 0)
 			if (delay < 0)
 			{
 			{
 				delay = DEFAULT_MOVE_DELAY;
 				delay = DEFAULT_MOVE_DELAY;
 				if (Config.DEVELOPER)
 				if (Config.DEVELOPER)
+				{
 					_log.warning(getClass().getSimpleName() + ": Wrong Delay Set in Npc Walker Functions = " + delay + " secs, using default delay: " + DEFAULT_MOVE_DELAY + " secs instead.");
 					_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;
 			_nextMoveTime = System.currentTimeMillis() + delay;
@@ -144,27 +159,34 @@ public class L2NpcWalkerAI extends L2CharacterAI implements Runnable
 	private void walkToLocation()
 	private void walkToLocation()
 	{
 	{
 		if (_currentPos < (_route.size() - 1))
 		if (_currentPos < (_route.size() - 1))
+		{
 			_currentPos++;
 			_currentPos++;
+		}
 		else
 		else
+		{
 			_currentPos = 0;
 			_currentPos = 0;
+		}
 		
 		
 		boolean moveType = _route.get(_currentPos).getRunning();
 		boolean moveType = _route.get(_currentPos).getRunning();
 		
 		
 		/**
 		/**
-		 * false - walking
-		 * true - Running
+		 * false - walking true - Running
 		 */
 		 */
 		if (moveType)
 		if (moveType)
+		{
 			getActor().setRunning();
 			getActor().setRunning();
+		}
 		else
 		else
+		{
 			getActor().setWalking();
 			getActor().setWalking();
+		}
 		
 		
-		//now we define destination
+		// now we define destination
 		int destinationX = _route.get(_currentPos).getMoveX();
 		int destinationX = _route.get(_currentPos).getMoveX();
 		int destinationY = _route.get(_currentPos).getMoveY();
 		int destinationY = _route.get(_currentPos).getMoveY();
 		int destinationZ = _route.get(_currentPos).getMoveZ();
 		int destinationZ = _route.get(_currentPos).getMoveZ();
 		
 		
-		//notify AI of MOVE_TO
+		// notify AI of MOVE_TO
 		setWalkingToNextPoint(true);
 		setWalkingToNextPoint(true);
 		
 		
 		setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(destinationX, destinationY, destinationZ, 0));
 		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;
 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
 public abstract class L2PlayableAI extends L2CharacterAI
 {
 {
-	
 	/**
 	/**
 	 * @param accessor
 	 * @param accessor
 	 */
 	 */
@@ -49,10 +42,7 @@ public abstract class L2PlayableAI extends L2CharacterAI
 	{
 	{
 		if (target instanceof L2Playable)
 		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
 				// If attacker have karma and have level >= 10 than his target and target have
 				// Newbie Protection Buff,
 				// Newbie Protection Buff,
@@ -61,10 +51,7 @@ public abstract class L2PlayableAI extends L2CharacterAI
 				return;
 				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
 				// If target have karma and have level >= 10 than his target and actor have
 				// Newbie Protection Buff,
 				// Newbie Protection Buff,
@@ -73,16 +60,14 @@ public abstract class L2PlayableAI extends L2CharacterAI
 				return;
 				return;
 			}
 			}
 			
 			
-			if (target.getActingPlayer().isCursedWeaponEquipped()
-					&& _actor.getActingPlayer().getLevel() <= 20)
+			if (target.getActingPlayer().isCursedWeaponEquipped() && (_actor.getActingPlayer().getLevel() <= 20))
 			{
 			{
 				_actor.getActingPlayer().sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
 				_actor.getActingPlayer().sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
 				clientActionFailed();
 				clientActionFailed();
 				return;
 				return;
 			}
 			}
 			
 			
-			if (_actor.getActingPlayer().isCursedWeaponEquipped()
-					&& target.getActingPlayer().getLevel() <= 20)
+			if (_actor.getActingPlayer().isCursedWeaponEquipped() && (target.getActingPlayer().getLevel() <= 20))
 			{
 			{
 				_actor.getActingPlayer().sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
 				_actor.getActingPlayer().sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
 				clientActionFailed();
 				clientActionFailed();
@@ -96,12 +81,9 @@ public abstract class L2PlayableAI extends L2CharacterAI
 	@Override
 	@Override
 	protected void onIntentionCast(L2Skill skill, L2Object target)
 	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
 				// If attacker have karma and have level >= 10 than his target and target have
 				// Newbie Protection Buff,
 				// Newbie Protection Buff,
@@ -111,10 +93,7 @@ public abstract class L2PlayableAI extends L2CharacterAI
 				return;
 				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
 				// If target have karma and have level >= 10 than his target and actor have
 				// Newbie Protection Buff,
 				// Newbie Protection Buff,
@@ -124,8 +103,7 @@ public abstract class L2PlayableAI extends L2CharacterAI
 				return;
 				return;
 			}
 			}
 			
 			
-			if (target.getActingPlayer().isCursedWeaponEquipped()
-					&& _actor.getActingPlayer().getLevel() <= 20)
+			if (target.getActingPlayer().isCursedWeaponEquipped() && (_actor.getActingPlayer().getLevel() <= 20))
 			{
 			{
 				_actor.getActingPlayer().sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
 				_actor.getActingPlayer().sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
 				clientActionFailed();
 				clientActionFailed();
@@ -133,8 +111,7 @@ public abstract class L2PlayableAI extends L2CharacterAI
 				return;
 				return;
 			}
 			}
 			
 			
-			if (_actor.getActingPlayer().isCursedWeaponEquipped()
-					&& target.getActingPlayer().getLevel() <= 20)
+			if (_actor.getActingPlayer().isCursedWeaponEquipped() && (target.getActingPlayer().getLevel() <= 20))
 			{
 			{
 				_actor.getActingPlayer().sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
 				_actor.getActingPlayer().sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
 				clientActionFailed();
 				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
 public class L2PlayerAI extends L2PlayableAI
 {
 {
-	
 	private boolean _thinking; // to prevent recursive thinking
 	private boolean _thinking; // to prevent recursive thinking
 	
 	
 	IntentionCommand _nextIntention = null;
 	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 intention The new Intention to set to the AI
 	 * @param arg0 The first parameter of the Intention
 	 * @param arg0 The first parameter of the Intention
 	 * @param arg1 The second parameter of the Intention
 	 * @param arg1 The second parameter of the Intention
-	 *
 	 */
 	 */
 	@Override
 	@Override
 	protected synchronized void changeIntention(CtrlIntention intention, Object arg0, Object arg1)
 	protected synchronized void changeIntention(CtrlIntention intention, Object arg0, Object arg1)
-	{	
+	{
 		// do nothing unless CAST intention
 		// do nothing unless CAST intention
 		// however, forget interrupted actions when starting to use an offensive skill
 		// 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;
 			_nextIntention = null;
 			super.changeIntention(intention, arg0, arg1);
 			super.changeIntention(intention, arg0, arg1);
@@ -75,7 +72,7 @@ public class L2PlayerAI extends L2PlayableAI
 		}
 		}
 		
 		
 		// do nothing if next intention is same as current one.
 		// 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);
 			super.changeIntention(intention, arg0, arg1);
 			return;
 			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
 	@Override
 	protected void onEvtReadyToAct()
 	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>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
 	@Override
 	protected void onEvtCancel()
 	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
 	@Override
 	protected void onEvtFinishCasting()
 	protected void onEvtFinishCasting()
@@ -142,7 +137,9 @@ public class L2PlayerAI extends L2PlayableAI
 					setIntention(nextIntention._crtlIntention, nextIntention._arg0, nextIntention._arg1);
 					setIntention(nextIntention._crtlIntention, nextIntention._arg0, nextIntention._arg1);
 				}
 				}
 				else
 				else
+				{
 					setIntention(AI_INTENTION_IDLE);
 					setIntention(AI_INTENTION_IDLE);
+				}
 			}
 			}
 			else
 			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
 	@Override
 	protected void onIntentionMoveTo(L2CharPosition pos)
 	protected void onIntentionMoveTo(L2CharPosition pos)
@@ -225,7 +222,9 @@ public class L2PlayerAI extends L2PlayableAI
 	{
 	{
 		L2Character target = getAttackTarget();
 		L2Character target = getAttackTarget();
 		if (target == null)
 		if (target == null)
+		{
 			return;
 			return;
+		}
 		if (checkTargetLostOrDead(target))
 		if (checkTargetLostOrDead(target))
 		{
 		{
 			// Notify the target
 			// Notify the target
@@ -233,7 +232,9 @@ public class L2PlayerAI extends L2PlayableAI
 			return;
 			return;
 		}
 		}
 		if (maybeMoveToPawn(target, _actor.getPhysicalAttackRange()))
 		if (maybeMoveToPawn(target, _actor.getPhysicalAttackRange()))
+		{
 			return;
 			return;
+		}
 		
 		
 		_accessor.doAttack(target);
 		_accessor.doAttack(target);
 	}
 	}
@@ -241,7 +242,7 @@ public class L2PlayerAI extends L2PlayableAI
 	private void thinkCast()
 	private void thinkCast()
 	{
 	{
 		L2Character target = getCastTarget();
 		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)))
 			if (maybeMoveToPosition(((L2PcInstance) _actor).getCurrentSkillWorldPosition(), _actor.getMagicalAttackRange(_skill)))
 			{
 			{
@@ -253,26 +254,28 @@ public class L2PlayerAI extends L2PlayableAI
 		{
 		{
 			if (checkTargetLost(target))
 			if (checkTargetLost(target))
 			{
 			{
-				if (_skill.isOffensive() && getAttackTarget() != null)
+				if (_skill.isOffensive() && (getAttackTarget() != null))
 				{
 				{
-					//Notify the target
+					// Notify the target
 					setCastTarget(null);
 					setCastTarget(null);
 				}
 				}
 				_actor.setIsCastingNow(false);
 				_actor.setIsCastingNow(false);
 				return;
 				return;
 			}
 			}
-			if (target != null && maybeMoveToPawn(target, _actor.getMagicalAttackRange(_skill)))
+			if ((target != null) && maybeMoveToPawn(target, _actor.getMagicalAttackRange(_skill)))
 			{
 			{
 				_actor.setIsCastingNow(false);
 				_actor.setIsCastingNow(false);
 				return;
 				return;
 			}
 			}
 		}
 		}
 		
 		
-		if (_skill.getHitTime() > 50 && !_skill.isSimultaneousCast())
+		if ((_skill.getHitTime() > 50) && !_skill.isSimultaneousCast())
+		{
 			clientStopMoving(null);
 			clientStopMoving(null);
+		}
 		
 		
 		L2Object oldTarget = _actor.getTarget();
 		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
 			// Replace the current target by the cast target
 			_actor.setTarget(getCastTarget());
 			_actor.setTarget(getCastTarget());
@@ -282,18 +285,26 @@ public class L2PlayerAI extends L2PlayableAI
 			_actor.setTarget(oldTarget);
 			_actor.setTarget(oldTarget);
 		}
 		}
 		else
 		else
+		{
 			_accessor.doCast(_skill);
 			_accessor.doCast(_skill);
+		}
 	}
 	}
 	
 	
 	private void thinkPickUp()
 	private void thinkPickUp()
 	{
 	{
 		if (_actor.isAllSkillsDisabled() || _actor.isCastingNow())
 		if (_actor.isAllSkillsDisabled() || _actor.isCastingNow())
+		{
 			return;
 			return;
+		}
 		L2Object target = getTarget();
 		L2Object target = getTarget();
 		if (checkTargetLost(target))
 		if (checkTargetLost(target))
+		{
 			return;
 			return;
+		}
 		if (maybeMoveToPawn(target, 36))
 		if (maybeMoveToPawn(target, 36))
+		{
 			return;
 			return;
+		}
 		setIntention(AI_INTENTION_IDLE);
 		setIntention(AI_INTENTION_IDLE);
 		((L2PcInstance.AIAccessor) _accessor).doPickupItem(target);
 		((L2PcInstance.AIAccessor) _accessor).doPickupItem(target);
 	}
 	}
@@ -301,34 +312,52 @@ public class L2PlayerAI extends L2PlayableAI
 	private void thinkInteract()
 	private void thinkInteract()
 	{
 	{
 		if (_actor.isAllSkillsDisabled() || _actor.isCastingNow())
 		if (_actor.isAllSkillsDisabled() || _actor.isCastingNow())
+		{
 			return;
 			return;
+		}
 		L2Object target = getTarget();
 		L2Object target = getTarget();
 		if (checkTargetLost(target))
 		if (checkTargetLost(target))
+		{
 			return;
 			return;
+		}
 		if (maybeMoveToPawn(target, 36))
 		if (maybeMoveToPawn(target, 36))
+		{
 			return;
 			return;
+		}
 		if (!(target instanceof L2StaticObjectInstance))
 		if (!(target instanceof L2StaticObjectInstance))
+		{
 			((L2PcInstance.AIAccessor) _accessor).doInteract((L2Character) target);
 			((L2PcInstance.AIAccessor) _accessor).doInteract((L2Character) target);
+		}
 		setIntention(AI_INTENTION_IDLE);
 		setIntention(AI_INTENTION_IDLE);
 	}
 	}
 	
 	
 	@Override
 	@Override
 	protected void onEvtThink()
 	protected void onEvtThink()
 	{
 	{
-		if (_thinking && getIntention() != AI_INTENTION_CAST) // casting must always continue
+		if (_thinking && (getIntention() != AI_INTENTION_CAST))
+		{
 			return;
 			return;
+		}
 		
 		
 		_thinking = true;
 		_thinking = true;
 		try
 		try
 		{
 		{
 			if (getIntention() == AI_INTENTION_ATTACK)
 			if (getIntention() == AI_INTENTION_ATTACK)
+			{
 				thinkAttack();
 				thinkAttack();
+			}
 			else if (getIntention() == AI_INTENTION_CAST)
 			else if (getIntention() == AI_INTENTION_CAST)
+			{
 				thinkCast();
 				thinkCast();
+			}
 			else if (getIntention() == AI_INTENTION_PICK_UP)
 			else if (getIntention() == AI_INTENTION_PICK_UP)
+			{
 				thinkPickUp();
 				thinkPickUp();
+			}
 			else if (getIntention() == AI_INTENTION_INTERACT)
 			else if (getIntention() == AI_INTENTION_INTERACT)
+			{
 				thinkInteract();
 				thinkInteract();
+			}
 		}
 		}
 		finally
 		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
 	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;
 	private Future<?> _aiTask;
 	
 	
 	/** For attack AI, analysis of mob and its targets */
 	/** 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 */
 	/** The delay after which the attacked is stopped */
 	private int _attackTimeout;
 	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 */
 	/** The flag used to indicate that a thinking action is in progress */
 	private boolean _thinking; // to prevent recursive thinking
 	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
 	 * @param accessor The AI accessor of the L2Character
-	 *
 	 */
 	 */
 	public L2SiegeGuardAI(L2Character.AIAccessor accessor)
 	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 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 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 target is in the actor Aggro range and is at the same height</li>
 	 * <li>The L2PcInstance target has karma (=PK)</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 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 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 target is in the actor Aggro range and is at the same height</li>
 	 * <li>A siege is in progress</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 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 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 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 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 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 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
 	 * @param target The targeted L2Object
 	 * @return True if the target is autoattackable (depends on the actor type).
 	 * @return True if the target is autoattackable (depends on the actor type).
 	 */
 	 */
 	protected boolean autoAttackCondition(L2Character target)
 	protected boolean autoAttackCondition(L2Character target)
 	{
 	{
 		// Check if the target isn't another guard, folk or a door
 		// 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;
 			return false;
+		}
 		
 		
 		// Check if the target isn't invulnerable
 		// Check if the target isn't invulnerable
 		if (target.isInvul())
 		if (target.isInvul())
 		{
 		{
 			// However EffectInvincible requires to check GMs specially
 			// However EffectInvincible requires to check GMs specially
-			if (target instanceof L2PcInstance && ((L2PcInstance) target).isGM())
+			if ((target instanceof L2PcInstance) && ((L2PcInstance) target).isGM())
+			{
 				return false;
 				return false;
-			if (target instanceof L2Summon && ((L2Summon) target).getOwner().isGM())
+			}
+			if ((target instanceof L2Summon) && ((L2Summon) target).getOwner().isGM())
+			{
 				return false;
 				return false;
+			}
 		}
 		}
 		
 		
 		// Get the owner if the target is a summon
 		// 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();
 			L2PcInstance owner = ((L2Summon) target).getOwner();
 			if (_actor.isInsideRadius(owner, 1000, true, false))
 			if (_actor.isInsideRadius(owner, 1000, true, false))
+			{
 				target = owner;
 				target = owner;
+			}
 		}
 		}
 		
 		
 		// Check if the target is a L2PcInstance
 		// 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)
 			// Check if the target isn't in silent move mode AND too far (>100)
 			if (((L2Playable) target).isSilentMoving() && !_actor.isInsideRadius(target, 250, false, false))
 			if (((L2Playable) target).isSilentMoving() && !_actor.isInsideRadius(target, 250, false, false))
+			{
 				return false;
 				return false;
+			}
 		}
 		}
 		// Los Check Here
 		// Los Check Here
 		return (_actor.isAutoAttackable(target) && GeoData.getInstance().canSeeTarget(_actor, target));
 		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 intention The new Intention to set to the AI
 	 * @param arg0 The first parameter of the Intention
 	 * @param arg0 The first parameter of the Intention
 	 * @param arg1 The second parameter of the Intention
 	 * @param arg1 The second parameter of the Intention
-	 *
 	 */
 	 */
 	@Override
 	@Override
 	synchronized void changeIntention(CtrlIntention intention, Object arg0, Object arg1)
 	synchronized void changeIntention(CtrlIntention intention, Object arg0, Object arg1)
 	{
 	{
 		if (Config.DEBUG)
 		if (Config.DEBUG)
+		{
 			_log.info(getClass().getSimpleName() + ": changeIntention(" + intention + ", " + arg0 + ", " + arg1 + ")");
 			_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
 			// Check if actor is not dead
 			if (!_actor.isAlikeDead())
 			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 its _knownPlayer isn't empty set the Intention to AI_INTENTION_ACTIVE
 				if (!npc.getKnownList().getKnownPlayers().isEmpty())
 				if (!npc.getKnownList().getKnownPlayers().isEmpty())
+				{
 					intention = AI_INTENTION_ACTIVE;
 					intention = AI_INTENTION_ACTIVE;
+				}
 				else
 				else
+				{
 					intention = AI_INTENTION_IDLE;
 					intention = AI_INTENTION_IDLE;
+				}
 			}
 			}
 			
 			
 			if (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
 	 * @param target The L2Character to attack
-	 *
 	 */
 	 */
 	@Override
 	@Override
 	protected void onIntentionAttack(L2Character target)
 	protected void onIntentionAttack(L2Character target)
@@ -228,18 +240,18 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 		_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks();
 		_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks();
 		
 		
 		// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
 		// 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);
 		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>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 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()
 	private void thinkActive()
 	{
 	{
@@ -249,9 +261,13 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 		if (_globalAggro != 0)
 		if (_globalAggro != 0)
 		{
 		{
 			if (_globalAggro < 0)
 			if (_globalAggro < 0)
+			{
 				_globalAggro++;
 				_globalAggro++;
+			}
 			else
 			else
+			{
 				_globalAggro--;
 				_globalAggro--;
+			}
 		}
 		}
 		
 		
 		// Add all autoAttackable L2Character in L2Attackable Aggro Range to its _aggroList with 0 damage and 1 hate
 		// 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))
 			for (L2Character target : npc.getKnownList().getKnownCharactersInRadius(_attackRange))
 			{
 			{
 				if (target == null)
 				if (target == null)
+				{
 					continue;
 					continue;
+				}
 				if (autoAttackCondition(target)) // check aggression
 				if (autoAttackCondition(target)) // check aggression
 				{
 				{
 					// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
 					// 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
 					// Add the attacker to the L2Attackable _aggroList with 0 damage and 1 hate
 					if (hating == 0)
 					if (hating == 0)
+					{
 						npc.addDamageHate(target, 0, 1);
 						npc.addDamageHate(target, 0, 1);
+					}
 				}
 				}
 			}
 			}
 			
 			
 			// Chose a target from its aggroList
 			// Chose a target from its aggroList
 			L2Character hated;
 			L2Character hated;
 			if (_actor.isConfused())
 			if (_actor.isConfused())
+			{
 				hated = getAttackTarget(); // Force mobs to attack anybody if confused
 				hated = getAttackTarget(); // Force mobs to attack anybody if confused
+			}
 			else
 			else
+			{
 				hated = npc.getMostHated();
 				hated = npc.getMostHated();
-			//_mostHatedAnalysis.Update(hated);
+				// _mostHatedAnalysis.Update(hated);
+			}
 			
 			
 			// Order to the L2Attackable to attack the target
 			// Order to the L2Attackable to attack the target
 			if (hated != null)
 			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
 				// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
 				int aggro = npc.getHating(hated);
 				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
 					// Set the L2Character movement type to run and send Server->Client packet ChangeMoveType to all others L2PcInstance
 					if (!_actor.isRunning())
 					if (!_actor.isRunning())
+					{
 						_actor.setRunning();
 						_actor.setRunning();
+					}
 					
 					
 					// Set the AI Intention to AI_INTENTION_ATTACK
 					// Set the AI Intention to AI_INTENTION_ATTACK
 					setIntention(CtrlIntention.AI_INTENTION_ATTACK, hated, null);
 					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>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>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>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)
 	 * TODO: Manage casting rules to healer mobs (like Ant Nurses)
-	 *
 	 */
 	 */
 	private void thinkAttack()
 	private void thinkAttack()
 	{
 	{
 		if (Config.DEBUG)
 		if (Config.DEBUG)
+		{
 			_log.info(getClass().getSimpleName() + ": thinkAttack(); timeout=" + (_attackTimeout - GameTimeController.getGameTicks()));
 			_log.info(getClass().getSimpleName() + ": thinkAttack(); timeout=" + (_attackTimeout - GameTimeController.getGameTicks()));
+		}
 		
 		
 		if (_attackTimeout < GameTimeController.getGameTicks())
 		if (_attackTimeout < GameTimeController.getGameTicks())
 		{
 		{
@@ -337,7 +364,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 		
 		
 		L2Character attackTarget = getAttackTarget();
 		L2Character attackTarget = getAttackTarget();
 		// Check if target is dead or if timeout is expired to stop this attack
 		// 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
 			// Stop hating this target after the attack timeout or if target is dead
 			if (attackTarget != null)
 			if (attackTarget != null)
@@ -365,42 +392,58 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 	{
 	{
 		L2Character target = getAttackTarget();
 		L2Character target = getAttackTarget();
 		// Call all L2Object of its Faction inside the Faction Range
 		// 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;
 			return;
+		}
 		
 		
 		if (target.isInvul())
 		if (target.isInvul())
+		{
 			return; // speeding it up for siege guards
 			return; // speeding it up for siege guards
+		}
 		
 		
 		String faction_id = ((L2Npc) _actor).getFactionId();
 		String faction_id = ((L2Npc) _actor).getFactionId();
 		
 		
 		// Go through all L2Character that belong to its faction
 		// 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))
 		for (L2Character cha : _actor.getKnownList().getKnownCharactersInRadius(1000))
 		{
 		{
 			if (cha == null)
 			if (cha == null)
+			{
 				continue;
 				continue;
+			}
 			
 			
 			if (!(cha instanceof L2Npc))
 			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
 					// 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)
 						for (L2Skill sk : _selfAnalysis.healSkills)
 						{
 						{
 							if (_actor.getCurrentMp() < sk.getMpConsume())
 							if (_actor.getCurrentMp() < sk.getMpConsume())
+							{
 								continue;
 								continue;
+							}
 							if (_actor.isSkillDisabled(sk))
 							if (_actor.isSkillDisabled(sk))
+							{
 								continue;
 								continue;
+							}
 							if (!Util.checkIfInRange(sk.getCastRange(), _actor, cha, true))
 							if (!Util.checkIfInRange(sk.getCastRange(), _actor, cha, true))
+							{
 								continue;
 								continue;
+							}
 							
 							
 							int chance = 5;
 							int chance = 5;
-							if (chance >= Rnd.get(100)) // chance
+							if (chance >= Rnd.get(100))
+							{
 								continue;
 								continue;
+							}
 							if (!GeoData.getInstance().canSeeTarget(_actor, cha))
 							if (!GeoData.getInstance().canSeeTarget(_actor, cha))
+							{
 								break;
 								break;
+							}
 							
 							
 							L2Object OldTarget = _actor.getTarget();
 							L2Object OldTarget = _actor.getTarget();
 							_actor.setTarget(cha);
 							_actor.setTarget(cha);
@@ -417,38 +460,49 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 			L2Npc npc = (L2Npc) cha;
 			L2Npc npc = (L2Npc) cha;
 			
 			
 			if (!faction_id.equals(npc.getFactionId()))
 			if (!faction_id.equals(npc.getFactionId()))
+			{
 				continue;
 				continue;
+			}
 			
 			
 			if (npc.getAI() != null) // TODO: possibly check not needed
 			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
 					// Notify the L2Object AI with EVT_AGGRESSION
 					npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, getAttackTarget(), 1);
 					npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, getAttackTarget(), 1);
 					return;
 					return;
 				}
 				}
 				// heal friends
 				// 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)
 					for (L2Skill sk : _selfAnalysis.healSkills)
 					{
 					{
 						if (_actor.getCurrentMp() < sk.getMpConsume())
 						if (_actor.getCurrentMp() < sk.getMpConsume())
+						{
 							continue;
 							continue;
+						}
 						if (_actor.isSkillDisabled(sk))
 						if (_actor.isSkillDisabled(sk))
+						{
 							continue;
 							continue;
+						}
 						if (!Util.checkIfInRange(sk.getCastRange(), _actor, npc, true))
 						if (!Util.checkIfInRange(sk.getCastRange(), _actor, npc, true))
+						{
 							continue;
 							continue;
+						}
 						
 						
 						int chance = 4;
 						int chance = 4;
-						if (chance >= Rnd.get(100)) // chance
+						if (chance >= Rnd.get(100))
+						{
 							continue;
 							continue;
+						}
 						if (!GeoData.getInstance().canSeeTarget(_actor, npc))
 						if (!GeoData.getInstance().canSeeTarget(_actor, npc))
+						{
 							break;
 							break;
+						}
 						
 						
 						L2Object OldTarget = _actor.getTarget();
 						L2Object OldTarget = _actor.getTarget();
 						_actor.setTarget(npc);
 						_actor.setTarget(npc);
@@ -478,7 +532,9 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 			dist_2 = _actor.getPlanDistanceSq(attackTarget.getX(), attackTarget.getY());
 			dist_2 = _actor.getPlanDistanceSq(attackTarget.getX(), attackTarget.getY());
 			range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + attackTarget.getTemplate().getCollisionRadius();
 			range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + attackTarget.getTemplate().getCollisionRadius();
 			if (attackTarget.isMoving())
 			if (attackTarget.isMoving())
+			{
 				range += 50;
 				range += 50;
+			}
 		}
 		}
 		catch (NullPointerException e)
 		catch (NullPointerException e)
 		{
 		{
@@ -488,10 +544,10 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 		}
 		}
 		
 		
 		// never attack defenders
 		// 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
 				// Cancel the target
 				sGuard.stopHating(attackTarget);
 				sGuard.stopHating(attackTarget);
 				_actor.setTarget(null);
 				_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
 		// 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
 			// check for long ranged skills and heal/buff skills
 			for (L2Skill sk : skills)
 			for (L2Skill sk : skills)
 			{
 			{
 				int castRange = sk.getCastRange();
 				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();
 					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;
 						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;
 							useSkillSelf = false;
 							break;
 							break;
@@ -533,7 +589,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 						if (sk.getSkillType() == L2SkillType.BUFF)
 						if (sk.getSkillType() == L2SkillType.BUFF)
 						{
 						{
 							L2Effect[] effects = _actor.getAllEffects();
 							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];
 								L2Effect effect = effects[i];
 								if (effect.getSkill() == sk)
 								if (effect.getSkill() == sk)
@@ -544,7 +600,9 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 							}
 							}
 						}
 						}
 						if (useSkillSelf)
 						if (useSkillSelf)
+						{
 							_actor.setTarget(_actor);
 							_actor.setTarget(_actor);
+						}
 					}
 					}
 					
 					
 					clientStopMoving(null);
 					clientStopMoving(null);
@@ -571,8 +629,8 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 				double homeY = attackTarget.getY() - sGuard.getSpawn().getLocy();
 				double homeY = attackTarget.getY() - sGuard.getSpawn().getLocy();
 				
 				
 				// Check if the L2SiegeGuardInstance isn't too far from it's home location
 				// 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
 					// Cancel the target
 					_actor.getKnownList().removeKnownObject(attackTarget);
 					_actor.getKnownList().removeKnownObject(attackTarget);
@@ -580,20 +638,28 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 					setIntention(AI_INTENTION_IDLE, null, null);
 					setIntention(AI_INTENTION_IDLE, null, null);
 				}
 				}
 				else
 				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,
 					// Temporary hack for preventing guards jumping off towers,
 					// before replacing this with effective geodata checks and AI modification
 					// 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)
 						if (_selfAnalysis.isHealer)
+						{
 							return;
 							return;
+						}
 						if (_selfAnalysis.isMage)
 						if (_selfAnalysis.isMage)
+						{
 							range = _selfAnalysis.maxCastRange - 50;
 							range = _selfAnalysis.maxCastRange - 50;
+						}
 						if (attackTarget.isMoving())
 						if (attackTarget.isMoving())
+						{
 							moveToPawn(attackTarget, range - 70);
 							moveToPawn(attackTarget, range - 70);
+						}
 						else
 						else
+						{
 							moveToPawn(attackTarget, range);
 							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 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,
 			// Temporary hack for preventing guards jumping off towers,
 			// before replacing this with effective geodata checks and AI modification
 			// before replacing this with effective geodata checks and AI modification
 			double dz = _actor.getZ() - attackTarget.getZ();
 			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)
 				if (_selfAnalysis.isMage)
+				{
 					range = _selfAnalysis.maxCastRange - 50;
 					range = _selfAnalysis.maxCastRange - 50;
+				}
 				if (attackTarget.isMoving())
 				if (attackTarget.isMoving())
+				{
 					moveToPawn(attackTarget, range - 70);
 					moveToPawn(attackTarget, range - 70);
+				}
 				else
 				else
+				{
 					moveToPawn(attackTarget, range);
 					moveToPawn(attackTarget, range);
+				}
 			}
 			}
 			return;
 			return;
 		}
 		}
 		// Else, if this is close enough to attack
 		// 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
 			// Force mobs to attack anybody if confused
 			L2Character hated = null;
 			L2Character hated = null;
 			if (_actor.isConfused())
 			if (_actor.isConfused())
+			{
 				hated = attackTarget;
 				hated = attackTarget;
+			}
 			else
 			else
+			{
 				hated = ((L2Attackable) _actor).getMostHated();
 				hated = ((L2Attackable) _actor).getMostHated();
+			}
 			
 			
 			if (hated == null)
 			if (hated == null)
 			{
 			{
@@ -634,24 +710,26 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 				return;
 				return;
 			}
 			}
 			if (hated != attackTarget)
 			if (hated != attackTarget)
+			{
 				attackTarget = hated;
 				attackTarget = hated;
+			}
 			
 			
 			_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks();
 			_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks();
 			
 			
 			// check for close combat skills && heal/buff skills
 			// 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)
 				for (L2Skill sk : skills)
 				{
 				{
 					int castRange = sk.getCastRange();
 					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();
 						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;
 							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;
 								useSkillSelf = false;
 								break;
 								break;
@@ -659,7 +737,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 							if (sk.getSkillType() == L2SkillType.BUFF)
 							if (sk.getSkillType() == L2SkillType.BUFF)
 							{
 							{
 								L2Effect[] effects = _actor.getAllEffects();
 								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];
 									L2Effect effect = effects[i];
 									if (effect.getSkill() == sk)
 									if (effect.getSkill() == sk)
@@ -670,7 +748,9 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 								}
 								}
 							}
 							}
 							if (useSkillSelf)
 							if (useSkillSelf)
+							{
 								_actor.setTarget(_actor);
 								_actor.setTarget(_actor);
+							}
 						}
 						}
 						
 						
 						clientStopMoving(null);
 						clientStopMoving(null);
@@ -682,22 +762,26 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 			}
 			}
 			// Finally, do the physical attack itself
 			// Finally, do the physical attack itself
 			if (!_selfAnalysis.isHealer)
 			if (!_selfAnalysis.isHealer)
+			{
 				_accessor.doAttack(attackTarget);
 				_accessor.doAttack(attackTarget);
+			}
 		}
 		}
 	}
 	}
 	
 	
 	/**
 	/**
-	 * Manage AI thinking actions of a L2Attackable.<BR><BR>
+	 * Manage AI thinking actions of a L2Attackable.
 	 */
 	 */
 	@Override
 	@Override
 	protected void onEvtThink()
 	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
 		// Check if the thinking action is already in progress
 		if (_thinking || _actor.isCastingNow() || _actor.isAllSkillsDisabled())
 		if (_thinking || _actor.isCastingNow() || _actor.isAllSkillsDisabled())
+		{
 			return;
 			return;
+		}
 		
 		
 		// Start thinking action
 		// Start thinking action
 		_thinking = true;
 		_thinking = true;
@@ -706,9 +790,13 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 		{
 		{
 			// Manage AI thinks of a L2Attackable
 			// Manage AI thinks of a L2Attackable
 			if (getIntention() == AI_INTENTION_ACTIVE)
 			if (getIntention() == AI_INTENTION_ACTIVE)
+			{
 				thinkActive();
 				thinkActive();
+			}
 			else if (getIntention() == AI_INTENTION_ATTACK)
 			else if (getIntention() == AI_INTENTION_ATTACK)
+			{
 				thinkAttack();
 				thinkAttack();
+			}
 		}
 		}
 		finally
 		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>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 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
 	 * @param attacker The L2Character that attacks the actor
-	 *
 	 */
 	 */
 	@Override
 	@Override
 	protected void onEvtAttacked(L2Character attacker)
 	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
 		// Set the _globalAggro to 0 to permit attack even just after spawn
 		if (_globalAggro < 0)
 		if (_globalAggro < 0)
+		{
 			_globalAggro = 0;
 			_globalAggro = 0;
+		}
 		
 		
 		// Add the attacker to the _aggroList of the actor
 		// Add the attacker to the _aggroList of the actor
 		((L2Attackable) _actor).addDamageHate(attacker, 0, 1);
 		((L2Attackable) _actor).addDamageHate(attacker, 0, 1);
 		
 		
 		// Set the L2Character movement type to run and send Server->Client packet ChangeMoveType to all others L2PcInstance
 		// Set the L2Character movement type to run and send Server->Client packet ChangeMoveType to all others L2PcInstance
 		if (!_actor.isRunning())
 		if (!_actor.isRunning())
+		{
 			_actor.setRunning();
 			_actor.setRunning();
+		}
 		
 		
 		// Set the Intention to AI_INTENTION_ATTACK
 		// Set the Intention to AI_INTENTION_ATTACK
 		if (getIntention() != 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
 	 * @param aggro The value of hate to add to the actor against the target
-	 *
 	 */
 	 */
 	@Override
 	@Override
 	protected void onEvtAggression(L2Character target, int aggro)
 	protected void onEvtAggression(L2Character target, int aggro)
 	{
 	{
 		if (_actor == null)
 		if (_actor == null)
+		{
 			return;
 			return;
+		}
 		L2Attackable me = (L2Attackable) _actor;
 		L2Attackable me = (L2Attackable) _actor;
 		
 		
 		if (target != null)
 		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
 				// Set the L2Character movement type to run and send Server->Client packet ChangeMoveType to all others L2PcInstance
 				if (!_actor.isRunning())
 				if (!_actor.isRunning())
+				{
 					_actor.setRunning();
 					_actor.setRunning();
+				}
 				
 				
 				L2DefenderInstance sGuard = (L2DefenderInstance) _actor;
 				L2DefenderInstance sGuard = (L2DefenderInstance) _actor;
 				double homeX = target.getX() - sGuard.getSpawn().getLocx();
 				double homeX = target.getX() - sGuard.getSpawn().getLocx();
 				double homeY = target.getY() - sGuard.getSpawn().getLocy();
 				double homeY = target.getY() - sGuard.getSpawn().getLocy();
 				
 				
 				// Check if the L2SiegeGuardInstance is not too far from its home location
 				// 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);
 					setIntention(CtrlIntention.AI_INTENTION_ATTACK, target, null);
+				}
 			}
 			}
 		}
 		}
 		else
 		else
 		{
 		{
 			// currently only for setting lower general aggro
 			// currently only for setting lower general aggro
 			if (aggro >= 0)
 			if (aggro >= 0)
+			{
 				return;
 				return;
+			}
 			
 			
 			L2Character mostHated = me.getMostHated();
 			L2Character mostHated = me.getMostHated();
 			if (mostHated == null)
 			if (mostHated == null)
@@ -820,7 +918,9 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 			}
 			}
 			
 			
 			for (L2Character aggroed : me.getAggroList().keySet())
 			for (L2Character aggroed : me.getAggroList().keySet())
+			{
 				me.addDamageHate(aggroed, 0, aggro);
 				me.addDamageHate(aggroed, 0, aggro);
+			}
 			
 			
 			aggro = me.getHating(mostHated);
 			aggro = me.getHating(mostHated);
 			if (aggro <= 0)
 			if (aggro <= 0)
@@ -843,5 +943,4 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
 		_accessor.detachAI();
 		_accessor.detachAI();
 		super.stopAITask();
 		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
  * @author BiggBoss
- *
  */
  */
 public final class L2SpecialSiegeGuardAI extends L2SiegeGuardAI
 public final class L2SpecialSiegeGuardAI extends L2SiegeGuardAI
 {
 {
-	private ArrayList<Integer> _allied;
+	private final ArrayList<Integer> _allied;
 	
 	
 	/**
 	/**
 	 * @param accessor
 	 * @param accessor
@@ -44,8 +43,10 @@ public final class L2SpecialSiegeGuardAI extends L2SiegeGuardAI
 	@Override
 	@Override
 	protected boolean autoAttackCondition(L2Character target)
 	protected boolean autoAttackCondition(L2Character target)
 	{
 	{
-		if(_allied.contains(target.getObjectId()))
+		if (_allied.contains(target.getObjectId()))
+		{
 			return false;
 			return false;
+		}
 		
 		
 		return super.autoAttackCondition(target);
 		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;
 		L2Summon summon = (L2Summon) _actor;
 		if (_startFollow)
 		if (_startFollow)
+		{
 			setIntention(AI_INTENTION_FOLLOW, summon.getOwner());
 			setIntention(AI_INTENTION_FOLLOW, summon.getOwner());
+		}
 		else
 		else
+		{
 			super.onIntentionActive();
 			super.onIntentionActive();
+		}
 	}
 	}
 	
 	
 	@Override
 	@Override
@@ -88,7 +92,9 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
 			return;
 			return;
 		}
 		}
 		if (maybeMoveToPawn(getAttackTarget(), _actor.getPhysicalAttackRange()))
 		if (maybeMoveToPawn(getAttackTarget(), _actor.getPhysicalAttackRange()))
+		{
 			return;
 			return;
+		}
 		clientStopMoving(null);
 		clientStopMoving(null);
 		_accessor.doAttack(getAttackTarget());
 		_accessor.doAttack(getAttackTarget());
 	}
 	}
@@ -103,7 +109,9 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
 		}
 		}
 		boolean val = _startFollow;
 		boolean val = _startFollow;
 		if (maybeMoveToPawn(getCastTarget(), _actor.getMagicalAttackRange(_skill)))
 		if (maybeMoveToPawn(getCastTarget(), _actor.getMagicalAttackRange(_skill)))
+		{
 			return;
 			return;
+		}
 		clientStopMoving(null);
 		clientStopMoving(null);
 		summon.setFollowStatus(false);
 		summon.setFollowStatus(false);
 		setIntention(AI_INTENTION_IDLE);
 		setIntention(AI_INTENTION_IDLE);
@@ -114,9 +122,13 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
 	private void thinkPickUp()
 	private void thinkPickUp()
 	{
 	{
 		if (checkTargetLost(getTarget()))
 		if (checkTargetLost(getTarget()))
+		{
 			return;
 			return;
+		}
 		if (maybeMoveToPawn(getTarget(), 36))
 		if (maybeMoveToPawn(getTarget(), 36))
+		{
 			return;
 			return;
+		}
 		setIntention(AI_INTENTION_IDLE);
 		setIntention(AI_INTENTION_IDLE);
 		((L2Summon.AIAccessor) _accessor).doPickupItem(getTarget());
 		((L2Summon.AIAccessor) _accessor).doPickupItem(getTarget());
 	}
 	}
@@ -124,9 +136,13 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
 	private void thinkInteract()
 	private void thinkInteract()
 	{
 	{
 		if (checkTargetLost(getTarget()))
 		if (checkTargetLost(getTarget()))
+		{
 			return;
 			return;
+		}
 		if (maybeMoveToPawn(getTarget(), 36))
 		if (maybeMoveToPawn(getTarget(), 36))
+		{
 			return;
 			return;
+		}
 		setIntention(AI_INTENTION_IDLE);
 		setIntention(AI_INTENTION_IDLE);
 	}
 	}
 	
 	
@@ -134,7 +150,9 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
 	protected void onEvtThink()
 	protected void onEvtThink()
 	{
 	{
 		if (_thinking || _actor.isCastingNow() || _actor.isAllSkillsDisabled())
 		if (_thinking || _actor.isCastingNow() || _actor.isAllSkillsDisabled())
+		{
 			return;
 			return;
+		}
 		_thinking = true;
 		_thinking = true;
 		try
 		try
 		{
 		{
@@ -164,7 +182,9 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
 	protected void onEvtFinishCasting()
 	protected void onEvtFinishCasting()
 	{
 	{
 		if (_lastAttack == null)
 		if (_lastAttack == null)
+		{
 			((L2Summon) _actor).setFollowStatus(_startFollow);
 			((L2Summon) _actor).setFollowStatus(_startFollow);
+		}
 		else
 		else
 		{
 		{
 			setIntention(CtrlIntention.AI_INTENTION_ATTACK, _lastAttack);
 			setIntention(CtrlIntention.AI_INTENTION_ATTACK, _lastAttack);
@@ -191,10 +211,10 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
 	private void avoidAttack(L2Character attacker)
 	private void avoidAttack(L2Character attacker)
 	{
 	{
 		// trying to avoid if summon near owner
 		// 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;
 			_startAvoid = true;
+		}
 	}
 	}
 	
 	
 	@Override
 	@Override
@@ -204,19 +224,18 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
 		{
 		{
 			_startAvoid = false;
 			_startAvoid = false;
 			
 			
-			if (!_clientMoving
-					&& !_actor.isDead()
-					&& !_actor.isMovementDisabled())
+			if (!_clientMoving && !_actor.isDead() && !_actor.isMovementDisabled())
 			{
 			{
 				final int ownerX = ((L2Summon) _actor).getOwner().getX();
 				final int ownerX = ((L2Summon) _actor).getOwner().getX();
 				final int ownerY = ((L2Summon) _actor).getOwner().getY();
 				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 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());
 					moveTo(targetX, targetY, _actor.getZ());
+				}
 			}
 			}
 		}
 		}
 	}
 	}
@@ -244,16 +263,22 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
 	protected void onIntentionCast(L2Skill skill, L2Object target)
 	protected void onIntentionCast(L2Skill skill, L2Object target)
 	{
 	{
 		if (getIntention() == AI_INTENTION_ATTACK)
 		if (getIntention() == AI_INTENTION_ATTACK)
+		{
 			_lastAttack = getAttackTarget();
 			_lastAttack = getAttackTarget();
+		}
 		else
 		else
+		{
 			_lastAttack = null;
 			_lastAttack = null;
+		}
 		super.onIntentionCast(skill, target);
 		super.onIntentionCast(skill, target);
 	}
 	}
 	
 	
 	private void startAvoidTask()
 	private void startAvoidTask()
 	{
 	{
 		if (_avoidTask == null)
 		if (_avoidTask == null)
+		{
 			_avoidTask = ThreadPoolManager.getInstance().scheduleAiAtFixedRate(this, 100, 100);
 			_avoidTask = ThreadPoolManager.getInstance().scheduleAiAtFixedRate(this, 100, 100);
+		}
 	}
 	}
 	
 	
 	private void stopAvoidTask()
 	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
 	 * Simple AI for vehicles
-	 * @param accessor 
+	 * @param accessor
 	 */
 	 */
 	public L2VehicleAI(L2Vehicle.AIAccessor 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
  * @author Layane
- * @param <K> 
- * @param <V> 
+ * @param <K>
+ * @param <V>
  */
  */
-@SuppressWarnings({ "rawtypes" })
+@SuppressWarnings("rawtypes")
 public class FastMRUCache<K, V> extends FastCollection implements Reusable
 public class FastMRUCache<K, V> extends FastCollection implements Reusable
 {
 {
-	/**
-	 * Comment for <code>serialVersionUID</code>
-	 */
 	private static final long serialVersionUID = 1L;
 	private static final long serialVersionUID = 1L;
 	private static final int DEFAULT_CAPACITY = 50;
 	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 FastMap<K, V> _map;
-	private FastList<K> _mruList = new FastList<>();
+	private final FastList<K> _mruList = new FastList<>();
 	private int _cacheSize;
 	private int _cacheSize;
 	private int _forgetTime;
 	private int _forgetTime;
 	
 	
@@ -63,7 +60,8 @@ public class FastMRUCache<K, V> extends FastCollection implements Reusable
 	/**
 	/**
 	 * Holds the set factory.
 	 * Holds the set factory.
 	 */
 	 */
-	private static final ObjectFactory FACTORY = new ObjectFactory() {
+	private static final ObjectFactory FACTORY = new ObjectFactory()
+	{
 		
 		
 		@Override
 		@Override
 		public Object create()
 		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;
 import com.l2jserver.util.L2FastMap;
 
 
 /**
 /**
- *
  * @author -Nemesiss-
  * @author -Nemesiss-
  */
  */
 public class WarehouseCacheManager
 public class WarehouseCacheManager
@@ -53,7 +52,7 @@ public class WarehouseCacheManager
 			long cTime = System.currentTimeMillis();
 			long cTime = System.currentTimeMillis();
 			for (L2PcInstance pc : _cachedWh.keySet())
 			for (L2PcInstance pc : _cachedWh.keySet())
 			{
 			{
-				if (cTime - _cachedWh.get(pc) > _cacheTime)
+				if ((cTime - _cachedWh.get(pc)) > _cacheTime)
 				{
 				{
 					pc.clearWarehouse();
 					pc.clearWarehouse();
 					_cachedWh.remove(pc);
 					_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
 public class Forum
 {
 {
-	//type
+	// type
 	public static final int ROOT = 0;
 	public static final int ROOT = 0;
 	public static final int NORMAL = 1;
 	public static final int NORMAL = 1;
 	public static final int CLAN = 2;
 	public static final int CLAN = 2;
 	public static final int MEMO = 3;
 	public static final int MEMO = 3;
 	public static final int MAIL = 4;
 	public static final int MAIL = 4;
-	//perm
+	// perm
 	public static final int INVISIBLE = 0;
 	public static final int INVISIBLE = 0;
 	public static final int ALL = 1;
 	public static final int ALL = 1;
 	public static final int CLANMEMBERONLY = 2;
 	public static final int CLANMEMBERONLY = 2;
 	public static final int OWNERONLY = 3;
 	public static final int OWNERONLY = 3;
 	
 	
 	private static Logger _log = Logger.getLogger(Forum.class.getName());
 	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 String _forumName;
-	//private int _ForumParent;
 	private int _forumType;
 	private int _forumType;
 	private int _forumPost;
 	private int _forumPost;
 	private int _forumPerm;
 	private int _forumPerm;
-	private Forum _fParent;
+	private final Forum _fParent;
 	private int _ownerID;
 	private int _ownerID;
 	private boolean _loaded = false;
 	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 Forumid
 	 * @param FParent
 	 * @param FParent
 	 */
 	 */
@@ -70,9 +66,6 @@ public class Forum
 		_fParent = FParent;
 		_fParent = FParent;
 		_children = new FastList<>();
 		_children = new FastList<>();
 		_topic = new FastMap<>();
 		_topic = new FastMap<>();
-		
-		/*load();
-		getChildren();	*/
 	}
 	}
 	
 	
 	/**
 	/**
@@ -80,13 +73,12 @@ public class Forum
 	 * @param parent
 	 * @param parent
 	 * @param type
 	 * @param type
 	 * @param perm
 	 * @param perm
-	 * @param OwnerID 
+	 * @param OwnerID
 	 */
 	 */
 	public Forum(String name, Forum parent, int type, int perm, int OwnerID)
 	public Forum(String name, Forum parent, int type, int perm, int OwnerID)
 	{
 	{
 		_forumName = name;
 		_forumName = name;
 		_forumId = ForumsBBSManager.getInstance().getANewID();
 		_forumId = ForumsBBSManager.getInstance().getANewID();
-		//_ForumParent = parent.getID();
 		_forumType = type;
 		_forumType = type;
 		_forumPost = 0;
 		_forumPost = 0;
 		_forumPerm = perm;
 		_forumPerm = perm;
@@ -110,7 +102,6 @@ public class Forum
 				if (rs.next())
 				if (rs.next())
 				{
 				{
 					_forumName = rs.getString("forum_name");
 					_forumName = rs.getString("forum_name");
-					//_ForumParent = result.getInt("forum_parent");
 					_forumPost = rs.getInt("forum_post");
 					_forumPost = rs.getInt("forum_post");
 					_forumType = rs.getInt("forum_type");
 					_forumType = rs.getInt("forum_type");
 					_forumPerm = rs.getInt("forum_perm");
 					_forumPerm = rs.getInt("forum_perm");
@@ -252,9 +243,6 @@ public class Forum
 		}
 		}
 	}
 	}
 	
 	
-	/**
-	 *
-	 */
 	public void vload()
 	public void vload()
 	{
 	{
 		if (!_loaded)
 		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;
 		public String postTxt;
 	}
 	}
 	
 	
-	private List<CPost> _post;
-	//public enum ConstructorType {REPLY, CREATE };
+	private final List<CPost> _post;
 	
 	
 	/**
 	/**
 	 * @param _PostOwner
 	 * @param _PostOwner
@@ -55,7 +54,7 @@ public class Post
 	 * @param _PostForumID
 	 * @param _PostForumID
 	 * @param txt
 	 * @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<>();
 		_post = new FastList<>();
 		CPost cp = new CPost();
 		CPost cp = new CPost();
@@ -100,9 +99,9 @@ public class Post
 	public CPost getCPost(int id)
 	public CPost getCPost(int id)
 	{
 	{
 		int i = 0;
 		int i = 0;
-		for(CPost cp : _post)
+		for (CPost cp : _post)
 		{
 		{
-			if(i++ == id)
+			if (i++ == id)
 			{
 			{
 				return cp;
 				return cp;
 			}
 			}
@@ -138,7 +137,7 @@ public class Post
 			ps.setInt(2, t.getID());
 			ps.setInt(2, t.getID());
 			try (ResultSet rs = ps.executeQuery())
 			try (ResultSet rs = ps.executeQuery())
 			{
 			{
-				while(rs.next())
+				while (rs.next())
 				{
 				{
 					CPost cp = new CPost();
 					CPost cp = new CPost();
 					cp.postId = rs.getInt("post_id");
 					cp.postId = rs.getInt("post_id");
@@ -154,7 +153,7 @@ public class Post
 		}
 		}
 		catch (Exception e)
 		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.L2DatabaseFactory;
 import com.l2jserver.gameserver.communitybbs.Manager.TopicBBSManager;
 import com.l2jserver.gameserver.communitybbs.Manager.TopicBBSManager;
 
 
-
 public class Topic
 public class Topic
 {
 {
 	private static final Logger _log = Logger.getLogger(Topic.class.getName());
 	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 MORMAL = 0;
 	public static final int MEMO = 1;
 	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
 	 * @param ct
@@ -123,7 +122,7 @@ public class Topic
 	}
 	}
 	
 	
 	/**
 	/**
-	 * @param f 
+	 * @param f
 	 */
 	 */
 	public void deleteme(Forum 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();
 		L2PcInstance activeChar = client.getActiveChar();
 		if (activeChar == null)
 		if (activeChar == null)
+		{
 			return;
 			return;
+		}
 		
 		
 		switch (Config.COMMUNITY_TYPE)
 		switch (Config.COMMUNITY_TYPE)
 		{
 		{
 			default:
 			default:
-			case 0: //disabled
+			case 0: // disabled
 				activeChar.sendPacket(SystemMessageId.CB_OFFLINE);
 				activeChar.sendPacket(SystemMessageId.CB_OFFLINE);
 				break;
 				break;
 			case 1: // old
 			case 1: // old
@@ -78,8 +80,7 @@ public class CommunityBoard
 				}
 				}
 				else
 				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(sb);
 					activeChar.sendPacket(new ShowBoard(null, "102"));
 					activeChar.sendPacket(new ShowBoard(null, "102"));
 					activeChar.sendPacket(new ShowBoard(null, "103"));
 					activeChar.sendPacket(new ShowBoard(null, "103"));
@@ -101,7 +102,9 @@ public class CommunityBoard
 	{
 	{
 		L2PcInstance activeChar = client.getActiveChar();
 		L2PcInstance activeChar = client.getActiveChar();
 		if (activeChar == null)
 		if (activeChar == null)
+		{
 			return;
 			return;
+		}
 		
 		
 		switch (Config.COMMUNITY_TYPE)
 		switch (Config.COMMUNITY_TYPE)
 		{
 		{
@@ -124,8 +127,7 @@ public class CommunityBoard
 				}
 				}
 				else
 				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(sb);
 					activeChar.sendPacket(new ShowBoard(null, "102"));
 					activeChar.sendPacket(new ShowBoard(null, "102"));
 					activeChar.sendPacket(new ShowBoard(null, "103"));
 					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"))
 		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
 		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(sb);
 			activeChar.sendPacket(new ShowBoard(null, "102"));
 			activeChar.sendPacket(new ShowBoard(null, "102"));
 			activeChar.sendPacket(new ShowBoard(null, "103"));
 			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)
 	protected void separateAndSend(String html, L2PcInstance acha)
 	{
 	{
 		if (html == null)
 		if (html == null)
+		{
 			return;
 			return;
+		}
 		if (html.length() < 4090)
 		if (html.length() < 4090)
 		{
 		{
 			acha.sendPacket(new ShowBoard(html, "101"));
 			acha.sendPacket(new ShowBoard(html, "101"));
@@ -56,7 +58,7 @@ public abstract class BaseBBSManager
 	
 	
 	/**
 	/**
 	 * @param html
 	 * @param html
-	 * @param acha 
+	 * @param acha
 	 */
 	 */
 	protected void send1001(String html, L2PcInstance 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)
 	protected void send1002(L2PcInstance acha)
 	{
 	{
@@ -78,7 +80,7 @@ public abstract class BaseBBSManager
 	 * @param activeChar
 	 * @param activeChar
 	 * @param string
 	 * @param string
 	 * @param string2
 	 * @param string2
-	 * @param string3 
+	 * @param string3
 	 */
 	 */
 	protected void send1002(L2PcInstance activeChar, String string, String string2, String 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 (command.equals("_bbsclan"))
 		{
 		{
-			if (activeChar.getClan() == null || activeChar.getClan().getLevel() < 2)
+			if ((activeChar.getClan() == null) || (activeChar.getClan().getLevel() < 2))
+			{
 				clanlist(activeChar, 1);
 				clanlist(activeChar, 1);
+			}
 			else
 			else
+			{
 				clanhome(activeChar);
 				clanhome(activeChar);
+			}
 		}
 		}
 		else if (command.startsWith("_bbsclan_clanlist"))
 		else if (command.startsWith("_bbsclan_clanlist"))
 		{
 		{
@@ -78,13 +82,17 @@ public class ClanBBSManager extends BaseBBSManager
 		else if (command.startsWith("_bbsclan_clannotice_enable"))
 		else if (command.startsWith("_bbsclan_clannotice_enable"))
 		{
 		{
 			if (activeChar.getClan() != null)
 			if (activeChar.getClan() != null)
+			{
 				activeChar.getClan().setNoticeEnabled(true);
 				activeChar.getClan().setNoticeEnabled(true);
+			}
 			clanNotice(activeChar, activeChar.getClanId());
 			clanNotice(activeChar, activeChar.getClanId());
 		}
 		}
 		else if (command.startsWith("_bbsclan_clannotice_disable"))
 		else if (command.startsWith("_bbsclan_clannotice_disable"))
 		{
 		{
 			if (activeChar.getClan() != null)
 			if (activeChar.getClan() != null)
+			{
 				activeChar.getClan().setNoticeEnabled(false);
 				activeChar.getClan().setNoticeEnabled(false);
+			}
 			clanNotice(activeChar, activeChar.getClanId());
 			clanNotice(activeChar, activeChar.getClanId());
 		}
 		}
 		else
 		else
@@ -105,63 +113,38 @@ public class ClanBBSManager extends BaseBBSManager
 			}
 			}
 			else
 			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())
 				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())
 					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>");
 						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
 					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, "<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);
 					send1001(html.toString(), activeChar);
 					send1002(activeChar, activeChar.getClan().getNotice(), " ", "0");
 					send1002(activeChar, activeChar.getClan().getNotice(), " ", "0");
 				}
 				}
 				else
 				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())
 					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);
 					separateAndSend(html.toString(), activeChar);
 				}
 				}
 			}
 			}
 		}
 		}
 	}
 	}
-
+	
 	/**
 	/**
 	 * @param activeChar
 	 * @param activeChar
 	 * @param index
 	 * @param index
@@ -173,50 +156,24 @@ public class ClanBBSManager extends BaseBBSManager
 			index = 1;
 			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;
 		int i = 0;
 		for (L2Clan cl : ClanTable.getInstance().getClans())
 		for (L2Clan cl : ClanTable.getInstance().getClans())
 		{
 		{
-			if (i > (index + 1) * 7)
+			if (i > ((index + 1) * 7))
 			{
 			{
 				break;
 				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)
 		if (index == 1)
 		{
 		{
@@ -230,7 +187,7 @@ public class ClanBBSManager extends BaseBBSManager
 		i = 0;
 		i = 0;
 		int nbp;
 		int nbp;
 		nbp = ClanTable.getInstance().getClans().length / 8;
 		nbp = ClanTable.getInstance().getClans().length / 8;
-		if (nbp * 8 != ClanTable.getInstance().getClans().length)
+		if ((nbp * 8) != ClanTable.getInstance().getClans().length)
 		{
 		{
 			nbp++;
 			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>");
 			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);
 		separateAndSend(html.toString(), activeChar);
 	}
 	}
 	
 	
@@ -295,61 +246,15 @@ public class ClanBBSManager extends BaseBBSManager
 			}
 			}
 			else
 			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);
 				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
 public class ForumsBBSManager extends BaseBBSManager
 {
 {
 	private static Logger _log = Logger.getLogger(ForumsBBSManager.class.getName());
 	private static Logger _log = Logger.getLogger(ForumsBBSManager.class.getName());
-	private List<Forum> _table;
+	private final List<Forum> _table;
 	private int _lastid = 1;
 	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.
 	 * Instantiates a new forums bbs manager.
 	 */
 	 */
@@ -71,7 +62,9 @@ public class ForumsBBSManager extends BaseBBSManager
 	public void initRoot()
 	public void initRoot()
 	{
 	{
 		for (Forum f : _table)
 		for (Forum f : _table)
+		{
 			f.vload();
 			f.vload();
+		}
 		_log.info("Loaded " + _table.size() + " forums. Last forum id used: " + _lastid);
 		_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)
 	public void addForum(Forum ff)
 	{
 	{
 		if (ff == null)
 		if (ff == null)
+		{
 			return;
 			return;
+		}
 		
 		
 		_table.add(ff);
 		_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
 	private static class SingletonHolder
 	{
 	{
 		protected static final ForumsBBSManager _instance = new ForumsBBSManager();
 		protected static final ForumsBBSManager _instance = new ForumsBBSManager();

File diff suppressed because it is too large
+ 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;
 package com.l2jserver.gameserver.communitybbs.Manager;
 
 
-import gnu.trove.iterator.TIntObjectIterator;
-
 import java.util.Collections;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.Comparator;
 import java.util.StringTokenizer;
 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.gameserver.network.serverpackets.SystemMessage;
 import com.l2jserver.util.StringUtil;
 import com.l2jserver.util.StringUtil;
 
 
+import gnu.trove.iterator.TIntObjectIterator;
+
 public class RegionBBSManager extends BaseBBSManager
 public class RegionBBSManager extends BaseBBSManager
 {
 {
 	private static Logger _logChat = Logger.getLogger("chat");
 	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
 		@Override
 		public int compare(L2PcInstance p1, L2PcInstance p2)
 		public int compare(L2PcInstance p1, L2PcInstance p2)
@@ -94,8 +94,7 @@ public class RegionBBSManager extends BaseBBSManager
 			}
 			}
 			else
 			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(sb);
 				activeChar.sendPacket(new ShowBoard(null, "102"));
 				activeChar.sendPacket(new ShowBoard(null, "102"));
 				activeChar.sendPacket(new ShowBoard(null, "103"));
 				activeChar.sendPacket(new ShowBoard(null, "103"));
@@ -110,8 +109,7 @@ public class RegionBBSManager extends BaseBBSManager
 	 */
 	 */
 	private void showOldCommunityPI(L2PcInstance activeChar, String name)
 	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);
 		L2PcInstance player = L2World.getInstance().getPlayer(name);
 		
 		
 		if (player != null)
 		if (player != null)
@@ -123,17 +121,21 @@ public class RegionBBSManager extends BaseBBSManager
 			}
 			}
 			String levelApprox = "low";
 			String levelApprox = "low";
 			if (player.getLevel() >= 60)
 			if (player.getLevel() >= 60)
+			{
 				levelApprox = "very high";
 				levelApprox = "very high";
+			}
 			else if (player.getLevel() >= 40)
 			else if (player.getLevel() >= 40)
+			{
 				levelApprox = "high";
 				levelApprox = "high";
+			}
 			else if (player.getLevel() >= 20)
 			else if (player.getLevel() >= 20)
+			{
 				levelApprox = "medium";
 				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 nextLevelExp = 0;
 				long nextLevelExpNeeded = 0;
 				long nextLevelExpNeeded = 0;
@@ -143,9 +145,7 @@ public class RegionBBSManager extends BaseBBSManager
 					nextLevelExpNeeded = nextLevelExp - player.getExp();
 					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;
 			int uptime = (int) player.getUptime() / 1000;
@@ -153,16 +153,14 @@ public class RegionBBSManager extends BaseBBSManager
 			int m = (uptime - (h * 3600)) / 60;
 			int m = (uptime - (h * 3600)) / 60;
 			int s = ((uptime - (h * 3600)) - (m * 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)
 			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);
 			separateAndSend(htmlCode.toString(), activeChar);
 		}
 		}
 		else
 		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)
 	public void parsewrite(String ar1, String ar2, String ar3, String ar4, String ar5, L2PcInstance activeChar)
 	{
 	{
 		if (activeChar == null)
 		if (activeChar == null)
+		{
 			return;
 			return;
+		}
 		
 		
 		if (ar1.equals("PM"))
 		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
 			try
 			{
 			{
@@ -201,8 +200,7 @@ public class RegionBBSManager extends BaseBBSManager
 				L2PcInstance receiver = L2World.getInstance().getPlayer(ar2);
 				L2PcInstance receiver = L2World.getInstance().getPlayer(ar2);
 				if (receiver == null)
 				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);
 					separateAndSend(htmlCode.toString(), activeChar);
 					return;
 					return;
 				}
 				}
@@ -231,16 +229,19 @@ public class RegionBBSManager extends BaseBBSManager
 				{
 				{
 					LogRecord record = new LogRecord(Level.INFO, ar3);
 					LogRecord record = new LogRecord(Level.INFO, ar3);
 					record.setLoggerName("chat");
 					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);
 					_logChat.log(record);
 				}
 				}
 				CreatureSay cs = new CreatureSay(activeChar.getObjectId(), Say2.TELL, activeChar.getName(), ar3);
 				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);
 					receiver.sendPacket(cs);
 					activeChar.sendPacket(new CreatureSay(activeChar.getObjectId(), Say2.TELL, "->" + receiver.getName(), ar3));
 					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);
 					separateAndSend(htmlCode.toString(), activeChar);
 				}
 				}
 				else
 				else
@@ -264,6 +265,7 @@ public class RegionBBSManager extends BaseBBSManager
 		}
 		}
 		
 		
 	}
 	}
+	
 	private int _onlineCount = 0;
 	private int _onlineCount = 0;
 	private int _onlineCountGm = 0;
 	private int _onlineCountGm = 0;
 	private static FastMap<Integer, FastList<L2PcInstance>> _onlinePlayers = new FastMap<Integer, FastList<L2PcInstance>>().shared();
 	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());
 				sortedPlayers.add(it.value());
 			}
 			}
 		}
 		}
-		Collections.sort(sortedPlayers, playerNameComparator);
+		Collections.sort(sortedPlayers, PLAYER_NAME_COMPARATOR);
 		
 		
 		_onlinePlayers.clear();
 		_onlinePlayers.clear();
 		_onlineCount = 0;
 		_onlineCount = 0;
@@ -307,7 +309,7 @@ public class RegionBBSManager extends BaseBBSManager
 		_communityPages.clear();
 		_communityPages.clear();
 		writeCommunityPages();
 		writeCommunityPages();
 	}
 	}
-
+	
 	/**
 	/**
 	 * Adds the online player.
 	 * Adds the online player.
 	 * @param player the player
 	 * @param player the player
@@ -324,7 +326,9 @@ public class RegionBBSManager extends BaseBBSManager
 				{
 				{
 					page.add(player);
 					page.add(player);
 					if (!player.getAppearance().getInvisible())
 					if (!player.getAppearance().getInvisible())
+					{
 						_onlineCount++;
 						_onlineCount++;
+					}
 					_onlineCountGm++;
 					_onlineCountGm++;
 				}
 				}
 				added = true;
 				added = true;
@@ -345,7 +349,9 @@ public class RegionBBSManager extends BaseBBSManager
 			{
 			{
 				_onlinePlayers.put(page, temp);
 				_onlinePlayers.put(page, temp);
 				if (!player.getAppearance().getInvisible())
 				if (!player.getAppearance().getInvisible())
+				{
 					_onlineCount++;
 					_onlineCount++;
+				}
 				_onlineCountGm++;
 				_onlineCountGm++;
 			}
 			}
 		}
 		}
@@ -367,22 +373,7 @@ public class RegionBBSManager extends BaseBBSManager
 		{
 		{
 			FastMap<String, String> communityPage = new FastMap<>();
 			FastMap<String, String> communityPage = new FastMap<>();
 			htmlCode.setLength(0);
 			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;
 			int cell = 0;
 			if (Config.BBS_SHOW_PLAYERLIST)
 			if (Config.BBS_SHOW_PLAYERLIST)
@@ -412,7 +403,9 @@ public class RegionBBSManager extends BaseBBSManager
 					htmlCode.append("</a></td>");
 					htmlCode.append("</a></td>");
 					
 					
 					if (cell < Config.NAME_PER_ROW_COMMUNITYBOARD)
 					if (cell < Config.NAME_PER_ROW_COMMUNITYBOARD)
+					{
 						htmlCode.append(colSpacer);
 						htmlCode.append(colSpacer);
+					}
 					
 					
 					if (cell == Config.NAME_PER_ROW_COMMUNITYBOARD)
 					if (cell == Config.NAME_PER_ROW_COMMUNITYBOARD)
 					{
 					{
@@ -420,13 +413,12 @@ public class RegionBBSManager extends BaseBBSManager
 						htmlCode.append(trClose);
 						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(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)
 			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 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))
 				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>");
 					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());
 			communityPage.put("gm", htmlCode.toString());
 			
 			
 			htmlCode.setLength(0);
 			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)
 			if (Config.BBS_SHOW_PLAYERLIST)
 			{
 			{
@@ -482,7 +460,9 @@ public class RegionBBSManager extends BaseBBSManager
 				for (L2PcInstance player : getOnlinePlayers(page))
 				for (L2PcInstance player : getOnlinePlayers(page))
 				{
 				{
 					if ((player == null) || (player.getAppearance().getInvisible()))
 					if ((player == null) || (player.getAppearance().getInvisible()))
+					{
 						continue; // Go to next
 						continue; // Go to next
+					}
 					
 					
 					cell++;
 					cell++;
 					
 					
@@ -505,7 +485,9 @@ public class RegionBBSManager extends BaseBBSManager
 					htmlCode.append("</a></td>");
 					htmlCode.append("</a></td>");
 					
 					
 					if (cell < Config.NAME_PER_ROW_COMMUNITYBOARD)
 					if (cell < Config.NAME_PER_ROW_COMMUNITYBOARD)
+					{
 						htmlCode.append(colSpacer);
 						htmlCode.append(colSpacer);
+					}
 					
 					
 					if (cell == Config.NAME_PER_ROW_COMMUNITYBOARD)
 					if (cell == Config.NAME_PER_ROW_COMMUNITYBOARD)
 					{
 					{
@@ -513,11 +495,12 @@ public class RegionBBSManager extends BaseBBSManager
 						htmlCode.append(trClose);
 						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(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)
 			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 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))
 				if (getOnlineCount("pl") <= (page * Config.NAME_PAGE_SIZE_COMMUNITYBOARD))
 				{
 				{
@@ -564,7 +546,9 @@ public class RegionBBSManager extends BaseBBSManager
 	private int getOnlineCount(String type)
 	private int getOnlineCount(String type)
 	{
 	{
 		if (type.equalsIgnoreCase("gm"))
 		if (type.equalsIgnoreCase("gm"))
+		{
 			return _onlineCountGm;
 			return _onlineCountGm;
+		}
 		
 		
 		return _onlineCount;
 		return _onlineCount;
 	}
 	}
@@ -588,7 +572,9 @@ public class RegionBBSManager extends BaseBBSManager
 	public String getCommunityPage(int page, String type)
 	public String getCommunityPage(int page, String type)
 	{
 	{
 		if (_communityPages.get(page) != null)
 		if (_communityPages.get(page) != null)
+		{
 			return _communityPages.get(page).get(type);
 			return _communityPages.get(page).get(type);
+		}
 		
 		
 		return null;
 		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.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.network.serverpackets.ShowBoard;
 import com.l2jserver.gameserver.network.serverpackets.ShowBoard;
 
 
-
 public class TopBBSManager extends BaseBBSManager
 public class TopBBSManager extends BaseBBSManager
 {
 {
 	@Override
 	@Override
@@ -52,15 +51,13 @@ public class TopBBSManager extends BaseBBSManager
 			String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/" + idp + ".htm");
 			String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/" + idp + ".htm");
 			if (content == null)
 			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);
 			separateAndSend(content, activeChar);
 		}
 		}
 		else
 		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(sb);
 			activeChar.sendPacket(new ShowBoard(null, "102"));
 			activeChar.sendPacket(new ShowBoard(null, "102"));
 			activeChar.sendPacket(new ShowBoard(null, "103"));
 			activeChar.sendPacket(new ShowBoard(null, "103"));

File diff suppressed because it is too large
+ 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<>();
 	private final Map<Integer, SkillHolder> _allSkills = new HashMap<>();
 	
 	
 	protected AugmentationData()
 	protected AugmentationData()
-	{		
+	{
 		for (int i = 0; i < 10; i++)
 		for (int i = 0; i < 10; i++)
 		{
 		{
 			if (i < STAT_NUMBEROF_BLOCKS)
 			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);
 			_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
 	public static class AugmentationStat
 	{
 	{
 		private final Stats _stat;
 		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.
 	 * @return skill by augmentation Id or null if not valid or not found.
 	 */
 	 */
 	public L2Skill getAugSkillById(int augmentationId)
 	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 ...
  * This class ...
- *
  * @version $Revision: 1.3.2.2.2.1 $ $Date: 2005/03/27 15:29:18 $
  * @version $Revision: 1.3.2.2.2.1 $ $Date: 2005/03/27 15:29:18 $
  */
  */
 public class CharNameTable
 public class CharNameTable
@@ -45,7 +44,9 @@ public class CharNameTable
 	protected CharNameTable()
 	protected CharNameTable()
 	{
 	{
 		if (Config.CACHE_CHAR_NAMES)
 		if (Config.CACHE_CHAR_NAMES)
+		{
 			loadAll();
 			loadAll();
+		}
 	}
 	}
 	
 	
 	public static CharNameTable getInstance()
 	public static CharNameTable getInstance()
@@ -67,7 +68,9 @@ public class CharNameTable
 		if (name != null)
 		if (name != null)
 		{
 		{
 			if (!name.equals(_chars.get(objectId)))
 			if (!name.equals(_chars.get(objectId)))
+			{
 				_chars.put(objectId, name);
 				_chars.put(objectId, name);
+			}
 		}
 		}
 	}
 	}
 	
 	
@@ -79,8 +82,10 @@ public class CharNameTable
 	
 	
 	public final int getIdByName(String name)
 	public final int getIdByName(String name)
 	{
 	{
-		if (name == null || name.isEmpty())
+		if ((name == null) || name.isEmpty())
+		{
 			return -1;
 			return -1;
+		}
 		
 		
 		Iterator<Entry<Integer, String>> it = _chars.entrySet().iterator();
 		Iterator<Entry<Integer, String>> it = _chars.entrySet().iterator();
 		
 		
@@ -89,11 +94,15 @@ public class CharNameTable
 		{
 		{
 			pair = it.next();
 			pair = it.next();
 			if (pair.getValue().equalsIgnoreCase(name))
 			if (pair.getValue().equalsIgnoreCase(name))
+			{
 				return pair.getKey();
 				return pair.getKey();
+			}
 		}
 		}
 		
 		
 		if (Config.CACHE_CHAR_NAMES)
 		if (Config.CACHE_CHAR_NAMES)
+		{
 			return -1;
 			return -1;
+		}
 		
 		
 		int id = -1;
 		int id = -1;
 		int accessLevel = 0;
 		int accessLevel = 0;
@@ -129,14 +138,20 @@ public class CharNameTable
 	public final String getNameById(int id)
 	public final String getNameById(int id)
 	{
 	{
 		if (id <= 0)
 		if (id <= 0)
+		{
 			return null;
 			return null;
+		}
 		
 		
 		String name = _chars.get(id);
 		String name = _chars.get(id);
 		if (name != null)
 		if (name != null)
+		{
 			return name;
 			return name;
+		}
 		
 		
 		if (Config.CACHE_CHAR_NAMES)
 		if (Config.CACHE_CHAR_NAMES)
+		{
 			return null;
 			return null;
+		}
 		
 		
 		int accessLevel = 0;
 		int accessLevel = 0;
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
 		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);
 			_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);
 			_chars.put(id, name);
 			_accessLevels.put(id, accessLevel);
 			_accessLevels.put(id, accessLevel);
 			return name;
 			return name;
 		}
 		}
 		
 		
-		return null; //not found
+		return null; // not found
 	}
 	}
 	
 	
 	public final int getAccessLevelById(int objectId)
 	public final int getAccessLevelById(int objectId)
 	{
 	{
 		if (getNameById(objectId) != null)
 		if (getNameById(objectId) != null)
+		{
 			return _accessLevels.get(objectId);
 			return _accessLevels.get(objectId);
+		}
 		
 		
 		return 0;
 		return 0;
 	}
 	}

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

@@ -14,8 +14,6 @@
  */
  */
 package com.l2jserver.gameserver.datatables;
 package com.l2jserver.gameserver.datatables;
 
 
-import gnu.trove.map.hash.TIntIntHashMap;
-
 import java.sql.Connection;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 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.model.skills.l2skills.L2SkillSummon;
 import com.l2jserver.gameserver.network.serverpackets.PetItemList;
 import com.l2jserver.gameserver.network.serverpackets.PetItemList;
 
 
+import gnu.trove.map.hash.TIntIntHashMap;
+
 /**
 /**
  * @author Nyaran
  * @author Nyaran
  */
  */
@@ -109,8 +109,10 @@ public class CharSummonTable
 	
 	
 	public void saveSummon(L2ServitorInstance summon)
 	public void saveSummon(L2ServitorInstance summon)
 	{
 	{
-		if (summon == null || summon.getTimeRemaining() <= 0)
+		if ((summon == null) || (summon.getTimeRemaining() <= 0))
+		{
 			return;
 			return;
+		}
 		_servitors.put(summon.getOwner().getObjectId(), summon.getReferenceSkill());
 		_servitors.put(summon.getOwner().getObjectId(), summon.getReferenceSkill());
 		
 		
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
 		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);
 			_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)
 	public void restoreServitor(L2PcInstance activeChar)
@@ -140,7 +142,7 @@ public class CharSummonTable
 			ps.setInt(2, skillId);
 			ps.setInt(2, skillId);
 			try (ResultSet rs = ps.executeQuery())
 			try (ResultSet rs = ps.executeQuery())
 			{
 			{
-			
+				
 				L2NpcTemplate summonTemplate;
 				L2NpcTemplate summonTemplate;
 				L2ServitorInstance summon;
 				L2ServitorInstance summon;
 				L2SkillSummon skill;
 				L2SkillSummon skill;
@@ -188,8 +190,8 @@ public class CharSummonTable
 					
 					
 					if (summon.getLevel() >= ExperienceTable.getInstance().getMaxPetLevel())
 					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
 					else
 					{
 					{
@@ -200,11 +202,13 @@ public class CharSummonTable
 					summon.setHeading(activeChar.getHeading());
 					summon.setHeading(activeChar.getHeading());
 					summon.setRunning();
 					summon.setRunning();
 					if (!(summon instanceof L2MerchantSummonInstance))
 					if (!(summon instanceof L2MerchantSummonInstance))
+					{
 						activeChar.setPet(summon);
 						activeChar.setPet(summon);
+					}
 					
 					
 					summon.setTimeRemaining(time);
 					summon.setTimeRemaining(time);
 					
 					
-					//L2World.getInstance().storeObject(summon);
+					// L2World.getInstance().storeObject(summon);
 					summon.spawnMe(activeChar.getX() + 20, activeChar.getY() + 20, activeChar.getZ());
 					summon.spawnMe(activeChar.getX() + 20, activeChar.getY() + 20, activeChar.getZ());
 				}
 				}
 			}
 			}
@@ -237,11 +241,15 @@ public class CharSummonTable
 		L2NpcTemplate npcTemplate = NpcTable.getInstance().getTemplate(sitem.getNpcId());
 		L2NpcTemplate npcTemplate = NpcTable.getInstance().getTemplate(sitem.getNpcId());
 		
 		
 		if (npcTemplate == null)
 		if (npcTemplate == null)
+		{
 			return;
 			return;
+		}
 		
 		
 		final L2PetInstance petSummon = L2PetInstance.spawnPet(npcTemplate, activeChar, item);
 		final L2PetInstance petSummon = L2PetInstance.spawnPet(npcTemplate, activeChar, item);
 		if (petSummon == null)
 		if (petSummon == null)
+		{
 			return;
 			return;
+		}
 		
 		
 		petSummon.setShowSummonAnimation(true);
 		petSummon.setShowSummonAnimation(true);
 		petSummon.setTitle(activeChar.getName());
 		petSummon.setTitle(activeChar.getName());
@@ -257,7 +265,9 @@ public class CharSummonTable
 		petSummon.setRunning();
 		petSummon.setRunning();
 		
 		
 		if (!petSummon.isRespawned())
 		if (!petSummon.isRespawned())
+		{
 			petSummon.store();
 			petSummon.store();
+		}
 		
 		
 		activeChar.setPet(petSummon);
 		activeChar.setPet(petSummon);
 		
 		
@@ -266,9 +276,13 @@ public class CharSummonTable
 		item.setEnchantLevel(petSummon.getLevel());
 		item.setEnchantLevel(petSummon.getLevel());
 		
 		
 		if (petSummon.getCurrentFed() <= 0)
 		if (petSummon.getCurrentFed() <= 0)
+		{
 			petSummon.unSummon(activeChar);
 			petSummon.unSummon(activeChar);
+		}
 		else
 		else
+		{
 			petSummon.startFeed();
 			petSummon.startFeed();
+		}
 		
 		
 		petSummon.setFollowStatus(true);
 		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.
  * Each Special Event has a start and end date to stop to drop extra Items automatically.
  */
  */
 public class EventDroplist
 public class EventDroplist
-{	
+{
 	/**
 	/**
 	 * The table containing all DataDrop object
 	 * 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 ...
  * This class ...
- *
  * @version $Revision$ $Date$
  * @version $Revision$ $Date$
  */
  */
 public class HerbDropTable
 public class HerbDropTable
 {
 {
 	private static Logger _log = Logger.getLogger(HerbDropTable.class.getName());
 	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()
 	protected HerbDropTable()
 	{
 	{
@@ -47,9 +46,15 @@ public class HerbDropTable
 	private void restoreData()
 	private void restoreData()
 	{
 	{
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
 		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())
 			ResultSet dropData = statement.executeQuery())
 		{
 		{
 			L2DropData dropDat = null;
 			L2DropData dropDat = null;
@@ -58,7 +63,9 @@ public class HerbDropTable
 				int groupId = dropData.getInt("groupId");
 				int groupId = dropData.getInt("groupId");
 				List<L2DropCategory> category;
 				List<L2DropCategory> category;
 				if (_herbGroups.containsKey(groupId))
 				if (_herbGroups.containsKey(groupId))
+				{
 					category = _herbGroups.get(groupId);
 					category = _herbGroups.get(groupId);
+				}
 				else
 				else
 				{
 				{
 					category = new ArrayList<>();
 					category = new ArrayList<>();
@@ -76,12 +83,13 @@ public class HerbDropTable
 				
 				
 				if (ItemTable.getInstance().getTemplate(dropDat.getItemId()) == null)
 				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;
 					continue;
 				}
 				}
 				
 				
 				boolean catExists = false;
 				boolean catExists = false;
 				for (L2DropCategory cat : category)
 				for (L2DropCategory cat : category)
+				{
 					// if the category exists, add the drop to this category.
 					// if the category exists, add the drop to this category.
 					if (cat.getCategoryType() == categoryType)
 					if (cat.getCategoryType() == categoryType)
 					{
 					{
@@ -89,6 +97,7 @@ public class HerbDropTable
 						catExists = true;
 						catExists = true;
 						break;
 						break;
 					}
 					}
+				}
 				// if the category doesn't exit, create it and add the drop
 				// if the category doesn't exit, create it and add the drop
 				if (!catExists)
 				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 ...
  * This class ...
- *
  * @version $Revision: 1.9.2.6.2.9 $ $Date: 2005/04/02 15:57:34 $
  * @version $Revision: 1.9.2.6.2.9 $ $Date: 2005/04/02 15:57:34 $
  */
  */
 public class ItemTable
 public class ItemTable
@@ -69,11 +68,10 @@ public class ItemTable
 	public static final Map<String, L2WeaponType> _weaponTypes = new FastMap<>();
 	public static final Map<String, L2WeaponType> _weaponTypes = new FastMap<>();
 	public static final Map<String, L2ArmorType> _armorTypes = new FastMap<>();
 	public static final Map<String, L2ArmorType> _armorTypes = new FastMap<>();
 	
 	
-	
 	private L2Item[] _allTemplates;
 	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
 	static
 	{
 	{
@@ -156,7 +154,7 @@ public class ItemTable
 		_slots.put("babypet", L2Item.SLOT_BABYPET);
 		_slots.put("babypet", L2Item.SLOT_BABYPET);
 		_slots.put("none", L2Item.SLOT_NONE);
 		_slots.put("none", L2Item.SLOT_NONE);
 		
 		
-		//retail compatibility
+		// retail compatibility
 		_slots.put("onepiece", L2Item.SLOT_FULL_ARMOR);
 		_slots.put("onepiece", L2Item.SLOT_FULL_ARMOR);
 		_slots.put("hair2", L2Item.SLOT_HAIR2);
 		_slots.put("hair2", L2Item.SLOT_HAIR2);
 		_slots.put("dhair", L2Item.SLOT_HAIRALL);
 		_slots.put("dhair", L2Item.SLOT_HAIRALL);
@@ -200,27 +198,35 @@ public class ItemTable
 		_armors.clear();
 		_armors.clear();
 		_etcItems.clear();
 		_etcItems.clear();
 		_weapons.clear();
 		_weapons.clear();
-		for (L2Item item :  DocumentEngine.getInstance().loadItems())
+		for (L2Item item : DocumentEngine.getInstance().loadItems())
 		{
 		{
 			if (highest < item.getItemId())
 			if (highest < item.getItemId())
+			{
 				highest = item.getItemId();
 				highest = item.getItemId();
+			}
 			if (item instanceof L2EtcItem)
 			if (item instanceof L2EtcItem)
+			{
 				_etcItems.put(item.getItemId(), (L2EtcItem) item);
 				_etcItems.put(item.getItemId(), (L2EtcItem) item);
+			}
 			else if (item instanceof L2Armor)
 			else if (item instanceof L2Armor)
+			{
 				_armors.put(item.getItemId(), (L2Armor) item);
 				_armors.put(item.getItemId(), (L2Armor) item);
+			}
 			else
 			else
+			{
 				_weapons.put(item.getItemId(), (L2Weapon) item);
 				_weapons.put(item.getItemId(), (L2Weapon) item);
+			}
 		}
 		}
 		buildFastLookupTable(highest);
 		buildFastLookupTable(highest);
 		_log.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + _etcItems.size() + " Etc Items");
 		_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: " + _armors.size() + " Armor Items");
 		_log.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + _weapons.size() + " Weapon 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.
 	 * Builds a variable in which all items are putting in in function of their ID.
-	 * @param size 
+	 * @param size
 	 */
 	 */
 	private void buildFastLookupTable(int size)
 	private void buildFastLookupTable(int size)
 	{
 	{
@@ -254,20 +260,17 @@ public class ItemTable
 	 */
 	 */
 	public L2Item getTemplate(int id)
 	public L2Item getTemplate(int id)
 	{
 	{
-		if (id >= _allTemplates.length || id < 0)
+		if ((id >= _allTemplates.length) || (id < 0))
+		{
 			return null;
 			return null;
+		}
 		
 		
 		return _allTemplates[id];
 		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 process : String Identifier of process triggering this action
 	 * @param itemId : int Item Identifier of the item to be created
 	 * @param itemId : int Item Identifier of the item to be created
 	 * @param count : int Quantity of items to be created for stackable items
 	 * @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)
 	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;
 			return null;
 		}
 		}
@@ -288,18 +291,18 @@ public class ItemTable
 		if (process.equalsIgnoreCase("loot"))
 		if (process.equalsIgnoreCase("loot"))
 		{
 		{
 			ScheduledFuture<?> itemLootShedule;
 			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;
 				L2Attackable raid = (L2Attackable) reference;
 				// if in CommandChannel and was killing a World/RaidBoss
 				// 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());
 					item.setOwnerId(raid.getFirstCommandChannelAttacked().getLeaderObjectId());
 					itemLootShedule = ThreadPoolManager.getInstance().scheduleGeneral(new ResetOwner(item), Config.LOOT_RAIDS_PRIVILEGE_INTERVAL);
 					itemLootShedule = ThreadPoolManager.getInstance().scheduleGeneral(new ResetOwner(item), Config.LOOT_RAIDS_PRIVILEGE_INTERVAL);
 					item.setItemLootShedule(itemLootShedule);
 					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());
 				item.setOwnerId(actor.getObjectId());
 				itemLootShedule = ThreadPoolManager.getInstance().scheduleGeneral(new ResetOwner(item), 15000);
 				itemLootShedule = ThreadPoolManager.getInstance().scheduleGeneral(new ResetOwner(item), 15000);
@@ -308,22 +311,31 @@ public class ItemTable
 		}
 		}
 		
 		
 		if (Config.DEBUG)
 		if (Config.DEBUG)
+		{
 			_log.fine(getClass().getSimpleName() + ": Item created  oid:" + item.getObjectId() + " itemid:" + itemId);
 			_log.fine(getClass().getSimpleName() + ": Item created  oid:" + item.getObjectId() + " itemid:" + itemId);
+		}
 		
 		
 		// Add the L2ItemInstance object to _allObjects of L2world
 		// Add the L2ItemInstance object to _allObjects of L2world
 		L2World.getInstance().storeObject(item);
 		L2World.getInstance().storeObject(item);
 		
 		
 		// Set Item parameters
 		// Set Item parameters
-		if (item.isStackable() && count > 1)
+		if (item.isStackable() && (count > 1))
+		{
 			item.setCount(count);
 			item.setCount(count);
+		}
 		
 		
 		if (Config.LOG_ITEMS && !process.equals("Reset"))
 		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);
 				LogRecord record = new LogRecord(Level.INFO, "CREATE:" + process);
 				record.setLoggerName("item");
 				record.setLoggerName("item");
-				record.setParameters(new Object[] { item, actor, reference });
+				record.setParameters(new Object[]
+				{
+					item,
+					actor,
+					reference
+				});
 				_logItems.log(record);
 				_logItems.log(record);
 			}
 			}
 		}
 		}
@@ -335,14 +347,17 @@ public class ItemTable
 				String referenceName = "no-reference";
 				String referenceName = "no-reference";
 				if (reference instanceof L2Object)
 				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)
 				else if (reference instanceof String)
-					referenceName = (String)reference;
+				{
+					referenceName = (String) reference;
+				}
 				String targetName = (actor.getTarget() != null ? actor.getTarget().getName() : "no-target");
 				String targetName = (actor.getTarget() != null ? actor.getTarget().getName() : "no-target");
 				if (Config.GMAUDIT)
 				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>
 	 * <U><I>Concept :</I></U><BR>
 	 * Dummy item is created by setting the ID of the object in the world at null value
 	 * Dummy item is created by setting the ID of the object in the world at null value
 	 * @param itemId : int designating the item
 	 * @param itemId : int designating the item
@@ -365,18 +380,21 @@ public class ItemTable
 	{
 	{
 		L2Item item = getTemplate(itemId);
 		L2Item item = getTemplate(itemId);
 		if (item == null)
 		if (item == null)
+		{
 			return null;
 			return null;
+		}
 		L2ItemInstance temp = new L2ItemInstance(0, item);
 		L2ItemInstance temp = new L2ItemInstance(0, item);
 		return temp;
 		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 process a string identifier of process triggering this action.
 	 * @param item the item instance to be destroyed.
 	 * @param item the item instance to be destroyed.
 	 * @param actor the player requesting the item destroy.
 	 * @param actor the player requesting the item destroy.
@@ -397,11 +415,17 @@ public class ItemTable
 			
 			
 			if (Config.LOG_ITEMS)
 			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);
 					LogRecord record = new LogRecord(Level.INFO, "DELETE:" + process);
 					record.setLoggerName("item");
 					record.setLoggerName("item");
-					record.setParameters(new Object[] { item, "PrevCount("+old+")", actor, reference });
+					record.setParameters(new Object[]
+					{
+						item,
+						"PrevCount(" + old + ")",
+						actor,
+						reference
+					});
 					_logItems.log(record);
 					_logItems.log(record);
 				}
 				}
 			}
 			}
@@ -413,15 +437,17 @@ public class ItemTable
 					String referenceName = "no-reference";
 					String referenceName = "no-reference";
 					if (reference instanceof L2Object)
 					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)
 					else if (reference instanceof String)
-						referenceName = (String)reference;
+					{
+						referenceName = (String) reference;
+					}
 					String targetName = (actor.getTarget() != null ? actor.getTarget().getName() : "no-target");
 					String targetName = (actor.getTarget() != null ? actor.getTarget().getName() : "no-target");
 					if (Config.GMAUDIT)
 					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)
 	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();
 			ItemCreateEvent event = new ItemCreateEvent();
 			event.setItemId(itemId);
 			event.setItemId(itemId);
@@ -512,7 +538,9 @@ public class ItemTable
 				if (listener.containsItemId(itemId))
 				if (listener.containsItemId(itemId))
 				{
 				{
 					if (!listener.onCreate(event))
 					if (!listener.onCreate(event))
+					{
 						return false;
 						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;
 import com.l2jserver.gameserver.model.entity.Castle;
 
 
 /**
 /**
- * @author  KenM
+ * @author KenM
  */
  */
 public class MerchantPriceConfigTable implements InstanceListManager
 public class MerchantPriceConfigTable implements InstanceListManager
 {
 {
@@ -49,14 +49,14 @@ public class MerchantPriceConfigTable implements InstanceListManager
 	
 	
 	private static final String MPCS_FILE = "MerchantPriceConfig.xml";
 	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;
 	private MerchantPriceConfig _defaultMpc;
 	
 	
 	public MerchantPriceConfig getMerchantPriceConfig(L2MerchantInstance npc)
 	public MerchantPriceConfig getMerchantPriceConfig(L2MerchantInstance npc)
 	{
 	{
 		for (MerchantPriceConfig mpc : _mpcs.values())
 		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;
 				return mpc;
 			}
 			}
@@ -91,7 +91,7 @@ public class MerchantPriceConfigTable implements InstanceListManager
 			MerchantPriceConfig mpc;
 			MerchantPriceConfig mpc;
 			for (n = n.getFirstChild(); n != null; n = n.getNextSibling())
 			for (n = n.getFirstChild(); n != null; n = n.getNextSibling())
 			{
 			{
-				mpc = this.parseMerchantPriceConfig(n);
+				mpc = parseMerchantPriceConfig(n);
 				if (mpc != null)
 				if (mpc != null)
 				{
 				{
 					_mpcs.put(mpc.getId(), mpc);
 					_mpcs.put(mpc.getId(), mpc);
@@ -184,9 +184,7 @@ public class MerchantPriceConfigTable implements InstanceListManager
 	}
 	}
 	
 	
 	/**
 	/**
-	 * 
-	 *
-	 * @author  KenM
+	 * @author KenM
 	 */
 	 */
 	public static final class MerchantPriceConfig
 	public static final class MerchantPriceConfig
 	{
 	{
@@ -261,17 +259,17 @@ public class MerchantPriceConfigTable implements InstanceListManager
 		
 		
 		public double getCastleTaxRate()
 		public double getCastleTaxRate()
 		{
 		{
-			return this.hasCastle() ? this.getCastle().getTaxRate() : 0.0;
+			return hasCastle() ? getCastle().getTaxRate() : 0.0;
 		}
 		}
 		
 		
 		public int getTotalTax()
 		public int getTotalTax()
 		{
 		{
-			return this.hasCastle() ? (getCastle().getTaxPercent() + getBaseTax()) : getBaseTax();
+			return hasCastle() ? (getCastle().getTaxPercent() + getBaseTax()) : getBaseTax();
 		}
 		}
 		
 		
 		public double getTotalTaxRate()
 		public double getTotalTaxRate()
 		{
 		{
-			return this.getTotalTax() / 100.0;
+			return getTotalTax() / 100.0;
 		}
 		}
 		
 		
 		public void updateReferences()
 		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
 public class MultiSell
 {
 {
 	private static final Logger _log = Logger.getLogger(MultiSell.class.getName());
 	private static final Logger _log = Logger.getLogger(MultiSell.class.getName());
-
+	
 	public static final int PAGE_SIZE = 40;
 	public static final int PAGE_SIZE = 40;
 	
 	
 	public static final int PC_BANG_POINTS = -100;
 	public static final int PC_BANG_POINTS = -100;
 	public static final int CLAN_REPUTATION = -200;
 	public static final int CLAN_REPUTATION = -200;
 	public static final int FAME = -300;
 	public static final int FAME = -300;
-		
+	
 	private final Map<Integer, ListContainer> _entries = new HashMap<>();
 	private final Map<Integer, ListContainer> _entries = new HashMap<>();
 	
 	
 	protected MultiSell()
 	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)
 	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);
 		final PreparedListContainer list = new PreparedListContainer(template, inventoryOnly, player, npc);
 		
 		
 		// Pass through this only when multipliers are different from 1
 		// 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));
 					ingredient.setItemCount((long) Math.max(ingredient.getItemCount() * ingredientMultiplier, 1));
 				}
 				}
 			}
 			}
@@ -134,9 +135,10 @@ public class MultiSell
 		
 		
 		player.setMultiSell(list);
 		player.setMultiSell(list);
 	}
 	}
+	
 	public final void separateAndSend(int listId, L2PcInstance player, L2Npc npc, boolean inventoryOnly)
 	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)
 	public static final boolean checkSpecialIngredient(int id, long amount, L2PcInstance player)
@@ -212,7 +214,9 @@ public class MultiSell
 		List<File> files = new FastList<>();
 		List<File> files = new FastList<>();
 		hashFiles("data/multisell", files);
 		hashFiles("data/multisell", files);
 		if (Config.CUSTOM_MULTISELL_LOAD)
 		if (Config.CUSTOM_MULTISELL_LOAD)
+		{
 			hashFiles("data/multisell/custom", files);
 			hashFiles("data/multisell/custom", files);
+		}
 		
 		
 		for (File f : files)
 		for (File f : files)
 		{
 		{
@@ -257,9 +261,13 @@ public class MultiSell
 			{
 			{
 				attribute = n.getAttributes().getNamedItem("applyTaxes");
 				attribute = n.getAttributes().getNamedItem("applyTaxes");
 				if (attribute == null)
 				if (attribute == null)
+				{
 					list.setApplyTaxes(false);
 					list.setApplyTaxes(false);
+				}
 				else
 				else
+				{
 					list.setApplyTaxes(Boolean.parseBoolean(attribute.getNodeValue()));
 					list.setApplyTaxes(Boolean.parseBoolean(attribute.getNodeValue()));
+				}
 				
 				
 				attribute = n.getAttributes().getNamedItem("useRate");
 				attribute = n.getAttributes().getNamedItem("useRate");
 				if (attribute != null)
 				if (attribute != null)
@@ -268,12 +276,14 @@ public class MultiSell
 					{
 					{
 						
 						
 						list.setUseRate(Double.valueOf(attribute.getNodeValue()));
 						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)
 					catch (NumberFormatException e)
 					{
 					{
-
+						
 						try
 						try
 						{
 						{
 							list.setUseRate(Config.class.getField(attribute.getNodeValue()).getDouble(Config.class));
 							list.setUseRate(Config.class.getField(attribute.getNodeValue()).getDouble(Config.class));
@@ -283,9 +293,9 @@ public class MultiSell
 							_log.warning(e.getMessage() + doc.getLocalName());
 							_log.warning(e.getMessage() + doc.getLocalName());
 							list.setUseRate(1.0);
 							list.setUseRate(1.0);
 						}
 						}
-
+						
 					}
 					}
-					catch (DOMException e) 
+					catch (DOMException e)
 					{
 					{
 						_log.warning(e.getMessage() + doc.getLocalName());
 						_log.warning(e.getMessage() + doc.getLocalName());
 					}
 					}
@@ -293,9 +303,13 @@ public class MultiSell
 				
 				
 				attribute = n.getAttributes().getNamedItem("maintainEnchantment");
 				attribute = n.getAttributes().getNamedItem("maintainEnchantment");
 				if (attribute == null)
 				if (attribute == null)
+				{
 					list.setMaintainEnchantment(false);
 					list.setMaintainEnchantment(false);
+				}
 				else
 				else
+				{
 					list.setMaintainEnchantment(Boolean.parseBoolean(attribute.getNodeValue()));
 					list.setMaintainEnchantment(Boolean.parseBoolean(attribute.getNodeValue()));
+				}
 				
 				
 				for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
 				for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
 				{
 				{
@@ -332,15 +346,23 @@ public class MultiSell
 				
 				
 				attribute = n.getAttributes().getNamedItem("isTaxIngredient");
 				attribute = n.getAttributes().getNamedItem("isTaxIngredient");
 				if (attribute != null)
 				if (attribute != null)
+				{
 					isTaxIngredient = Boolean.parseBoolean(attribute.getNodeValue());
 					isTaxIngredient = Boolean.parseBoolean(attribute.getNodeValue());
+				}
 				else
 				else
+				{
 					isTaxIngredient = false;
 					isTaxIngredient = false;
+				}
 				
 				
 				attribute = n.getAttributes().getNamedItem("maintainIngredient");
 				attribute = n.getAttributes().getNamedItem("maintainIngredient");
 				if (attribute != null)
 				if (attribute != null)
+				{
 					mantainIngredient = Boolean.parseBoolean(attribute.getNodeValue());
 					mantainIngredient = Boolean.parseBoolean(attribute.getNodeValue());
+				}
 				else
 				else
+				{
 					mantainIngredient = false;
 					mantainIngredient = false;
+				}
 				
 				
 				entry.addIngredient(new Ingredient(id, count, isTaxIngredient, mantainIngredient));
 				entry.addIngredient(new Ingredient(id, count, isTaxIngredient, mantainIngredient));
 			}
 			}
@@ -367,7 +389,9 @@ public class MultiSell
 		
 		
 		File[] files = dir.listFiles(new XMLFilter());
 		File[] files = dir.listFiles(new XMLFilter());
 		for (File f : files)
 		for (File f : files)
+		{
 			hash.add(f);
 			hash.add(f);
+		}
 	}
 	}
 	
 	
 	private final void verify()
 	private final void verify()
@@ -383,12 +407,16 @@ public class MultiSell
 				for (Ingredient ing : ent.getIngredients())
 				for (Ingredient ing : ent.getIngredients())
 				{
 				{
 					if (!verifyIngredient(ing))
 					if (!verifyIngredient(ing))
+					{
 						_log.warning(getClass().getSimpleName() + ": can't find ingredient with itemId: " + ing.getItemId() + " in list: " + list.getListId());
 						_log.warning(getClass().getSimpleName() + ": can't find ingredient with itemId: " + ing.getItemId() + " in list: " + list.getListId());
+					}
 				}
 				}
 				for (Ingredient ing : ent.getProducts())
 				for (Ingredient ing : ent.getProducts())
 				{
 				{
 					if (!verifyIngredient(ing))
 					if (!verifyIngredient(ing))
+					{
 						_log.warning(getClass().getSimpleName() + ": can't find product with itemId: " + ing.getItemId() + " in list: " + list.getListId());
 						_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;
 				return true;
 			default:
 			default:
 				if (ing.getTemplate() != null)
 				if (ing.getTemplate() != null)
+				{
 					return true;
 					return true;
+				}
 		}
 		}
 		
 		
 		return false;
 		return false;

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

@@ -14,8 +14,6 @@
  */
  */
 package com.l2jserver.gameserver.datatables;
 package com.l2jserver.gameserver.datatables;
 
 
-import gnu.trove.map.hash.TIntIntHashMap;
-
 import java.sql.Connection;
 import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.SQLException;
@@ -28,6 +26,8 @@ import java.util.logging.Logger;
 import com.l2jserver.Config;
 import com.l2jserver.Config;
 import com.l2jserver.L2DatabaseFactory;
 import com.l2jserver.L2DatabaseFactory;
 
 
+import gnu.trove.map.hash.TIntIntHashMap;
+
 public class NpcBufferTable
 public class NpcBufferTable
 {
 {
 	private static Logger _log = Logger.getLogger(NpcBufferTable.class.getName());
 	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());
 	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_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 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";
 	private static final String CLEAR_OFFLINE_TABLE = "DELETE FROM character_offline_trade";
@@ -57,23 +57,25 @@ public class OfflineTradersTable
 			stm2.execute();
 			stm2.execute();
 			con.setAutoCommit(false); // avoid halfway done
 			con.setAutoCommit(false); // avoid halfway done
 			
 			
-			//TextBuilder items = TextBuilder.newInstance();
+			// TextBuilder items = TextBuilder.newInstance();
 			for (L2PcInstance pc : L2World.getInstance().getAllPlayersArray())
 			for (L2PcInstance pc : L2World.getInstance().getAllPlayersArray())
 			{
 			{
 				try
 				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.setLong(2, pc.getOfflineStartTime());
-						stm3.setInt(3, pc.getPrivateStoreType()); //store type
+						stm3.setInt(3, pc.getPrivateStoreType()); // store type
 						String title = null;
 						String title = null;
 						
 						
 						switch (pc.getPrivateStoreType())
 						switch (pc.getPrivateStoreType())
 						{
 						{
 							case L2PcInstance.STORE_PRIVATE_BUY:
 							case L2PcInstance.STORE_PRIVATE_BUY:
 								if (!Config.OFFLINE_TRADE_ENABLE)
 								if (!Config.OFFLINE_TRADE_ENABLE)
+								{
 									continue;
 									continue;
+								}
 								title = pc.getBuyList().getTitle();
 								title = pc.getBuyList().getTitle();
 								for (TradeItem i : pc.getBuyList().getItems())
 								for (TradeItem i : pc.getBuyList().getItems())
 								{
 								{
@@ -88,7 +90,9 @@ public class OfflineTradersTable
 							case L2PcInstance.STORE_PRIVATE_SELL:
 							case L2PcInstance.STORE_PRIVATE_SELL:
 							case L2PcInstance.STORE_PRIVATE_PACKAGE_SELL:
 							case L2PcInstance.STORE_PRIVATE_PACKAGE_SELL:
 								if (!Config.OFFLINE_TRADE_ENABLE)
 								if (!Config.OFFLINE_TRADE_ENABLE)
+								{
 									continue;
 									continue;
+								}
 								title = pc.getSellList().getTitle();
 								title = pc.getSellList().getTitle();
 								for (TradeItem i : pc.getSellList().getItems())
 								for (TradeItem i : pc.getSellList().getItems())
 								{
 								{
@@ -102,7 +106,9 @@ public class OfflineTradersTable
 								break;
 								break;
 							case L2PcInstance.STORE_PRIVATE_MANUFACTURE:
 							case L2PcInstance.STORE_PRIVATE_MANUFACTURE:
 								if (!Config.OFFLINE_CRAFT_ENABLE)
 								if (!Config.OFFLINE_CRAFT_ENABLE)
+								{
 									continue;
 									continue;
+								}
 								title = pc.getCreateList().getStoreName();
 								title = pc.getCreateList().getStoreName();
 								for (L2ManufactureItem i : pc.getCreateList().getList())
 								for (L2ManufactureItem i : pc.getCreateList().getList())
 								{
 								{
@@ -129,7 +135,7 @@ public class OfflineTradersTable
 		}
 		}
 		catch (Exception e)
 		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.setTimeInMillis(time);
 					cal.add(Calendar.DAY_OF_YEAR, Config.OFFLINE_MAX_DAYS);
 					cal.add(Calendar.DAY_OF_YEAR, Config.OFFLINE_MAX_DAYS);
 					if (cal.getTimeInMillis() <= System.currentTimeMillis())
 					if (cal.getTimeInMillis() <= System.currentTimeMillis())
+					{
 						continue;
 						continue;
+					}
 				}
 				}
 				
 				
 				int type = rs.getInt("type");
 				int type = rs.getInt("type");
 				if (type == L2PcInstance.STORE_PRIVATE_NONE)
 				if (type == L2PcInstance.STORE_PRIVATE_NONE)
+				{
 					continue;
 					continue;
+				}
 				
 				
 				L2PcInstance player = null;
 				L2PcInstance player = null;
 				
 				
@@ -183,7 +193,9 @@ public class OfflineTradersTable
 									while (items.next())
 									while (items.next())
 									{
 									{
 										if (player.getBuyList().addItemByItemId(items.getInt(2), items.getLong(3), items.getLong(4)) == null)
 										if (player.getBuyList().addItemByItemId(items.getInt(2), items.getLong(3), items.getLong(4)) == null)
+										{
 											throw new NullPointerException();
 											throw new NullPointerException();
+										}
 									}
 									}
 									player.getBuyList().setTitle(rs.getString("title"));
 									player.getBuyList().setTitle(rs.getString("title"));
 									break;
 									break;
@@ -192,7 +204,9 @@ public class OfflineTradersTable
 									while (items.next())
 									while (items.next())
 									{
 									{
 										if (player.getSellList().addItem(items.getInt(2), items.getLong(3), items.getLong(4)) == null)
 										if (player.getSellList().addItem(items.getInt(2), items.getLong(3), items.getLong(4)) == null)
+										{
 											throw new NullPointerException();
 											throw new NullPointerException();
+										}
 									}
 									}
 									player.getSellList().setTitle(rs.getString("title"));
 									player.getSellList().setTitle(rs.getString("title"));
 									player.getSellList().setPackaged(type == L2PcInstance.STORE_PRIVATE_PACKAGE_SELL);
 									player.getSellList().setPackaged(type == L2PcInstance.STORE_PRIVATE_PACKAGE_SELL);
@@ -211,7 +225,9 @@ public class OfflineTradersTable
 					}
 					}
 					player.sitDown();
 					player.sitDown();
 					if (Config.OFFLINE_SET_NAME_COLOR)
 					if (Config.OFFLINE_SET_NAME_COLOR)
+					{
 						player.getAppearance().setNameColor(Config.OFFLINE_NAME_COLOR);
 						player.getAppearance().setNameColor(Config.OFFLINE_NAME_COLOR);
+					}
 					player.setPrivateStoreType(type);
 					player.setPrivateStoreType(type);
 					player.setOnlineStatus(true, true);
 					player.setOnlineStatus(true, true);
 					player.restoreEffects();
 					player.restoreEffects();
@@ -220,7 +236,7 @@ public class OfflineTradersTable
 				}
 				}
 				catch (Exception e)
 				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)
 					if (player != null)
 					{
 					{
 						player.deleteMe();
 						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())
 			try (Statement stm1 = con.createStatement())
 			{
 			{
@@ -238,7 +254,7 @@ public class OfflineTradersTable
 		}
 		}
 		catch (Exception e)
 		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))
 			for (int it : PetDataTable.getPetItemsByNpc(petNpcId))
 			{
 			{
 				if (!cond.toString().isEmpty())
 				if (!cond.toString().isEmpty())
+				{
 					cond.append(", ");
 					cond.append(", ");
+				}
 				cond.append(it);
 				cond.append(it);
 			}
 			}
 			ps.setString(2, cond.toString());
 			ps.setString(2, cond.toString());
@@ -68,7 +70,9 @@ public class PetNameTable
 		boolean result = true;
 		boolean result = true;
 		
 		
 		if (!isAlphaNumeric(name))
 		if (!isAlphaNumeric(name))
+		{
 			return result;
 			return result;
+		}
 		
 		
 		Pattern pattern;
 		Pattern pattern;
 		try
 		try

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

@@ -14,9 +14,6 @@
  */
  */
 package com.l2jserver.gameserver.datatables;
 package com.l2jserver.gameserver.datatables;
 
 
-import gnu.trove.list.array.TIntArrayList;
-import gnu.trove.map.hash.TIntIntHashMap;
-
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map;
 import java.util.logging.Level;
 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.holders.SkillHolder;
 import com.l2jserver.gameserver.model.skills.L2Skill;
 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()
 	public void reload()
 	{
 	{
 		load();
 		load();
-		//Reload Skill Tree as well.
+		// Reload Skill Tree as well.
 		SkillTreesData.getInstance().load();
 		SkillTreesData.getInstance().load();
 	}
 	}
 	
 	
@@ -63,14 +63,18 @@ public class SkillTable
 			if (skillLvl > 99)
 			if (skillLvl > 99)
 			{
 			{
 				if (!_enchantable.contains(skillId))
 				if (!_enchantable.contains(skillId))
+				{
 					_enchantable.add(skillId);
 					_enchantable.add(skillId);
+				}
 				continue;
 				continue;
 			}
 			}
 			
 			
 			// only non-enchanted skills
 			// only non-enchanted skills
 			final int maxLvl = _skillMaxLevel.get(skillId);
 			final int maxLvl = _skillMaxLevel.get(skillId);
 			if (skillLvl > maxLvl)
 			if (skillLvl > maxLvl)
+			{
 				_skillMaxLevel.put(skillId, skillLvl);
 				_skillMaxLevel.put(skillId, skillLvl);
+			}
 		}
 		}
 		
 		
 		// Sorting for binarySearch
 		// Sorting for binarySearch
@@ -79,9 +83,7 @@ public class SkillTable
 	
 	
 	/**
 	/**
 	 * Provides the skill hash
 	 * Provides the skill hash
-	 * 
-	 * @param skill
-	 *            The L2Skill to be hashed
+	 * @param skill The L2Skill to be hashed
 	 * @return getSkillHashCode(skill.getId(), skill.getLevel())
 	 * @return getSkillHashCode(skill.getId(), skill.getLevel())
 	 */
 	 */
 	public static int getSkillHashCode(L2Skill skill)
 	public static int getSkillHashCode(L2Skill skill)
@@ -91,28 +93,27 @@ public class SkillTable
 	
 	
 	/**
 	/**
 	 * Centralized method for easier change of the hashing sys
 	 * 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
 	 * @return The Skill hash number
 	 */
 	 */
 	public static int getSkillHashCode(int skillId, int skillLevel)
 	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)
 	public final L2Skill getInfo(final int skillId, final int level)
 	{
 	{
 		final L2Skill result = _skills.get(getSkillHashCode(skillId, level));
 		final L2Skill result = _skills.get(getSkillHashCode(skillId, level));
 		if (result != null)
 		if (result != null)
+		{
 			return result;
 			return result;
+		}
 		
 		
 		// skill/level not found, fix for transformation scripts
 		// skill/level not found, fix for transformation scripts
 		final int maxLvl = _skillMaxLevel.get(skillId);
 		final int maxLvl = _skillMaxLevel.get(skillId);
 		// requested level too high
 		// requested level too high
-		if (maxLvl > 0 && level > maxLvl)
+		if ((maxLvl > 0) && (level > maxLvl))
 		{
 		{
 			if (Config.DEBUG)
 			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.
 	 * @return an array with siege skills. If addNoble == true, will add also Advanced headquarters.
 	 */
 	 */
 	public L2Skill[] getSiegeSkills(boolean addNoble, boolean hasCastle)
 	public L2Skill[] getSiegeSkills(boolean addNoble, boolean hasCastle)
@@ -148,7 +149,9 @@ public class SkillTable
 		temp[i++] = _skills.get(SkillTable.getSkillHashCode(247, 1));
 		temp[i++] = _skills.get(SkillTable.getSkillHashCode(247, 1));
 		
 		
 		if (addNoble)
 		if (addNoble)
+		{
 			temp[i++] = _skills.get(SkillTable.getSkillHashCode(326, 1));
 			temp[i++] = _skills.get(SkillTable.getSkillHashCode(326, 1));
+		}
 		if (hasCastle)
 		if (hasCastle)
 		{
 		{
 			temp[i++] = _skills.get(SkillTable.getSkillHashCode(844, 1));
 			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
 	 * Enum to hold some important references to frequently used (hardcoded) skills in core
-	 * 
 	 * @author DrHouse
 	 * @author DrHouse
 	 */
 	 */
 	public static enum FrequentSkill
 	public static enum FrequentSkill
@@ -180,7 +182,8 @@ public class SkillTable
 		THE_VICTOR_OF_WAR(5074, 1),
 		THE_VICTOR_OF_WAR(5074, 1),
 		THE_VANQUISHED_OF_WAR(5075, 1),
 		THE_VANQUISHED_OF_WAR(5075, 1),
 		SPECIAL_TREE_RECOVERY_BONUS(2139, 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;
 		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;
 package com.l2jserver.gameserver.datatables;
 
 
-import gnu.trove.map.hash.TIntObjectHashMap;
-
 import java.io.File;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Arrays;
 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.holders.SkillHolder;
 import com.l2jserver.gameserver.model.skills.L2Skill;
 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>
  * This class loads and manage the characters and pledges skills trees.<br>
  * Here can be found the following skill 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 ...
  * This class ...
- *
  * @author Nightmare
  * @author Nightmare
  * @version $Revision: 1.5.2.6.2.7 $ $Date: 2005/03/27 15:29:18 $
  * @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 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 _npcSpawnCount;
 	private int _customSpawnCount;
 	private int _customSpawnCount;
 	
 	
@@ -48,7 +47,9 @@ public class SpawnTable
 	{
 	{
 		_spawntable.shared();
 		_spawntable.shared();
 		if (!Config.ALT_DEV_NO_SPAWNS)
 		if (!Config.ALT_DEV_NO_SPAWNS)
+		{
 			fillSpawnTable();
 			fillSpawnTable();
+		}
 	}
 	}
 	
 	
 	public FastSet<L2Spawn> getSpawnTable()
 	public FastSet<L2Spawn> getSpawnTable()
@@ -205,7 +206,9 @@ public class SpawnTable
 		}
 		}
 		
 		
 		if (Config.DEBUG)
 		if (Config.DEBUG)
+		{
 			_log.fine(getClass().getSimpleName() + ": Spawning completed, total number of NPCs in the world: " + (_npcSpawnCount + _customSpawnCount));
 			_log.fine(getClass().getSimpleName() + ": Spawning completed, total number of NPCs in the world: " + (_npcSpawnCount + _customSpawnCount));
+		}
 		
 		
 	}
 	}
 	
 	
@@ -217,9 +220,13 @@ public class SpawnTable
 		{
 		{
 			String spawnTable;
 			String spawnTable;
 			if (spawn.isCustom() && Config.CUSTOM_SPAWNLIST_TABLE)
 			if (spawn.isCustom() && Config.CUSTOM_SPAWNLIST_TABLE)
+			{
 				spawnTable = "custom_spawnlist";
 				spawnTable = "custom_spawnlist";
+			}
 			else
 			else
+			{
 				spawnTable = "spawnlist";
 				spawnTable = "spawnlist";
+			}
 			
 			
 			try (Connection con = L2DatabaseFactory.getInstance().getConnection();
 			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(?,?,?,?,?,?,?,?)"))
 				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)
 	public void deleteSpawn(L2Spawn spawn, boolean updateDb)
 	{
 	{
 		if (!_spawntable.remove(spawn))
 		if (!_spawntable.remove(spawn))
+		{
 			return;
 			return;
+		}
 		
 		
 		if (updateDb)
 		if (updateDb)
 		{
 		{
@@ -267,14 +276,14 @@ public class SpawnTable
 		}
 		}
 	}
 	}
 	
 	
-	//just wrapper
+	// just wrapper
 	public void reloadAll()
 	public void reloadAll()
 	{
 	{
 		fillSpawnTable();
 		fillSpawnTable();
 	}
 	}
 	
 	
 	/**
 	/**
-	 * Get all the spawn of a NPC<BR><BR>
+	 * Get all the spawn of a NPC.
 	 * @param activeChar
 	 * @param activeChar
 	 * @param npcId
 	 * @param npcId
 	 * @param teleportIndex
 	 * @param teleportIndex
@@ -294,24 +303,34 @@ public class SpawnTable
 				{
 				{
 					if (teleportIndex == index)
 					if (teleportIndex == index)
 					{
 					{
-						if(showposition && _npc != null)
+						if (showposition && (_npc != null))
+						{
 							activeChar.teleToLocation(_npc.getX(), _npc.getY(), _npc.getZ(), true);
 							activeChar.teleToLocation(_npc.getX(), _npc.getY(), _npc.getZ(), true);
+						}
 						else
 						else
+						{
 							activeChar.teleToLocation(spawn.getLocx(), spawn.getLocy(), spawn.getLocz(), true);
 							activeChar.teleToLocation(spawn.getLocx(), spawn.getLocy(), spawn.getLocz(), true);
+						}
 					}
 					}
 				}
 				}
 				else
 				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
 					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)
 		if (index == 0)
+		{
 			activeChar.sendMessage(getClass().getSimpleName() + ": No current spawns found.");
 			activeChar.sendMessage(getClass().getSimpleName() + ": No current spawns found.");
+		}
 	}
 	}
 	
 	
 	public static SpawnTable getInstance()
 	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;
 package com.l2jserver.gameserver.datatables;
 
 
-import gnu.trove.map.hash.TIntObjectHashMap;
-
 import java.util.List;
 import java.util.List;
 
 
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.skills.L2Skill;
 import com.l2jserver.gameserver.model.skills.L2Skill;
 
 
+import gnu.trove.map.hash.TIntObjectHashMap;
+
 /**
 /**
  * @author Nyaran
  * @author Nyaran
  */
  */
 public class SummonEffectsTable
 public class SummonEffectsTable
 {
 {
 	/** Servitors **/
 	/** 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()
 	public TIntObjectHashMap<TIntObjectHashMap<TIntObjectHashMap<List<SummonEffect>>>> getServitorEffectsOwner()
 	{
 	{
@@ -51,7 +49,7 @@ public class SummonEffectsTable
 	}
 	}
 	
 	
 	/** Pets **/
 	/** 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()
 	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
 public class SummonSkillsTable
 {
 {
 	private static Logger _log = Logger.getLogger(SummonSkillsTable.class.getName());
 	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()
 	protected SummonSkillsTable()
 	{
 	{
@@ -97,28 +97,38 @@ public class SummonSkillsTable
 		for (L2PetSkillLearn temp : skills)
 		for (L2PetSkillLearn temp : skills)
 		{
 		{
 			if (temp.getId() != skillId)
 			if (temp.getId() != skillId)
+			{
 				continue;
 				continue;
+			}
 			if (temp.getLevel() == 0)
 			if (temp.getLevel() == 0)
 			{
 			{
 				if (cha.getLevel() < 70)
 				if (cha.getLevel() < 70)
 				{
 				{
 					lvl = (cha.getLevel() / 10);
 					lvl = (cha.getLevel() / 10);
 					if (lvl <= 0)
 					if (lvl <= 0)
+					{
 						lvl = 1;
 						lvl = 1;
+					}
 				}
 				}
 				else
 				else
+				{
 					lvl = (7 + ((cha.getLevel() - 70) / 5));
 					lvl = (7 + ((cha.getLevel() - 70) / 5));
+				}
 				
 				
 				// formula usable for skill that have 10 or more skill levels
 				// formula usable for skill that have 10 or more skill levels
 				int maxLvl = SkillTable.getInstance().getMaxLevel(temp.getId());
 				int maxLvl = SkillTable.getInstance().getMaxLevel(temp.getId());
 				if (lvl > maxLvl)
 				if (lvl > maxLvl)
+				{
 					lvl = maxLvl;
 					lvl = maxLvl;
+				}
 				break;
 				break;
 			}
 			}
 			else if (temp.getMinLevel() <= cha.getLevel())
 			else if (temp.getMinLevel() <= cha.getLevel())
 			{
 			{
 				if (temp.getLevel() > lvl)
 				if (temp.getLevel() > lvl)
+				{
 					lvl = temp.getLevel();
 					lvl = temp.getLevel();
+				}
 			}
 			}
 		}
 		}
 		return lvl;
 		return lvl;
@@ -136,7 +146,9 @@ public class SummonSkillsTable
 		for (L2PetSkillLearn temp : skills)
 		for (L2PetSkillLearn temp : skills)
 		{
 		{
 			if (skillIds.contains(temp.getId()))
 			if (skillIds.contains(temp.getId()))
+			{
 				continue;
 				continue;
+			}
 			skillIds.add(temp.getId());
 			skillIds.add(temp.getId());
 		}
 		}
 		return skillIds;
 		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 ...
  * This class ...
- *
  * @version $Revision: 1.3.2.2.2.3 $ $Date: 2005/03/27 15:29:18 $
  * @version $Revision: 1.3.2.2.2.3 $ $Date: 2005/03/27 15:29:18 $
  */
  */
 public class TeleportLocationTable
 public class TeleportLocationTable
 {
 {
 	private static Logger _log = Logger.getLogger(TeleportLocationTable.class.getName());
 	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()
 	protected TeleportLocationTable()
 	{
 	{

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

@@ -64,7 +64,15 @@ public class TerritoryTable
 	public void load()
 	public void load()
 	{
 	{
 		_territory.clear();
 		_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)
 		for (Integer[] row : point)
 		{
 		{
 			Integer terr = row[0];
 			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;
 import com.l2jserver.gameserver.model.entity.ActionKey;
 
 
 /**
 /**
- * @author  mrTJO
+ * @author mrTJO
  */
  */
 public class UITable
 public class UITable
 {
 {
 	private static final Logger _log = Logger.getLogger(UITable.class.getName());
 	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()
 	protected UITable()
 	{
 	{
@@ -59,7 +59,9 @@ public class UITable
 			while ((line = lnr.readLine()) != null)
 			while ((line = lnr.readLine()) != null)
 			{
 			{
 				if (line.trim().isEmpty() || (line.charAt(0) == '#'))
 				if (line.trim().isEmpty() || (line.charAt(0) == '#'))
+				{
 					continue;
 					continue;
+				}
 				
 				
 				StringTokenizer st = new StringTokenizer(line, ";");
 				StringTokenizer st = new StringTokenizer(line, ";");
 				
 				
@@ -90,7 +92,9 @@ public class UITable
 			while ((line = lnr.readLine()) != null)
 			while ((line = lnr.readLine()) != null)
 			{
 			{
 				if (line.trim().isEmpty() || (line.charAt(0) == '#'))
 				if (line.trim().isEmpty() || (line.charAt(0) == '#'))
+				{
 					continue;
 					continue;
+				}
 				
 				
 				StringTokenizer st = new StringTokenizer(line, ";");
 				StringTokenizer st = new StringTokenizer(line, ";");
 				
 				
@@ -117,7 +121,9 @@ public class UITable
 	private void insertCategory(int cat, int cmd)
 	private void insertCategory(int cat, int cmd)
 	{
 	{
 		if (_storedCategories.containsKey(cat))
 		if (_storedCategories.containsKey(cat))
+		{
 			_storedCategories.get(cat).add(cmd);
 			_storedCategories.get(cat).add(cmd);
+		}
 		else
 		else
 		{
 		{
 			List<Integer> tmp = new ArrayList<>();
 			List<Integer> tmp = new ArrayList<>();
@@ -130,7 +136,9 @@ public class UITable
 	{
 	{
 		ActionKey tmk = new ActionKey(cat, cmdId, key, tgKey1, tgKey2, show);
 		ActionKey tmk = new ActionKey(cat, cmdId, key, tgKey1, tgKey2, show);
 		if (_storedKeys.containsKey(cat))
 		if (_storedKeys.containsKey(cat))
+		{
 			_storedKeys.get(cat).add(tmk);
 			_storedKeys.get(cat).add(tmk);
+		}
 		else
 		else
 		{
 		{
 			List<ActionKey> tmp = new ArrayList<>();
 			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;
 		Condition condition = null;
 		n = n.getFirstChild();
 		n = n.getFirstChild();
-		if (n == null) return;
+		if (n == null)
+		{
+			return;
+		}
 		if ("cond".equalsIgnoreCase(n.getNodeName()))
 		if ("cond".equalsIgnoreCase(n.getNodeName()))
 		{
 		{
 			condition = parseCondition(n.getFirstChild(), template);
 			condition = parseCondition(n.getFirstChild(), template);
 			Node msg = n.getAttributes().getNamedItem("msg");
 			Node msg = n.getAttributes().getNamedItem("msg");
 			Node msgId = n.getAttributes().getNamedItem("msgId");
 			Node msgId = n.getAttributes().getNamedItem("msgId");
-			if (condition != null && msg != null)
+			if ((condition != null) && (msg != null))
+			{
 				condition.setMessage(msg.getNodeValue());
 				condition.setMessage(msg.getNodeValue());
-			else if (condition != null && msgId != null)
+			}
+			else if ((condition != null) && (msgId != null))
 			{
 			{
 				condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
 				condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
 				Node addName = n.getAttributes().getNamedItem("addName");
 				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();
 					condition.addName();
+				}
 			}
 			}
 			n = n.getNextSibling();
 			n = n.getNextSibling();
 		}
 		}
 		for (; n != null; 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()))
 			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);
 				attachEffect(n, template, condition);
 			}
 			}
 		}
 		}
@@ -231,9 +264,18 @@ public abstract class DocumentBase
 		int ord = Integer.decode(getValue(order, template));
 		int ord = Integer.decode(getValue(order, template));
 		Condition applayCond = parseCondition(n.getFirstChild(), template);
 		Condition applayCond = parseCondition(n.getFirstChild(), template);
 		FuncTemplate ft = new FuncTemplate(attachCond, applayCond, name, stat, ord, lambda);
 		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)
 	protected void attachLambdaFunc(Node n, Object template, LambdaCalc calc)
@@ -265,19 +307,27 @@ public abstract class DocumentBase
 		
 		
 		if (attrs.getNamedItem("abnormalTime") != null)
 		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.ENABLE_MODIFY_SKILL_DURATION)
 			{
 			{
 				if (Config.SKILL_DURATION_LIST.containsKey(((L2Skill) template).getId()))
 				if (Config.SKILL_DURATION_LIST.containsKey(((L2Skill) template).getId()))
 				{
 				{
 					if (((L2Skill) template).getLevel() < 100)
 					if (((L2Skill) template).getLevel() < 100)
+					{
 						abnormalTime = Config.SKILL_DURATION_LIST.get(((L2Skill) template).getId());
 						abnormalTime = Config.SKILL_DURATION_LIST.get(((L2Skill) template).getId());
+					}
 					else if ((((L2Skill) template).getLevel() >= 100) && (((L2Skill) template).getLevel() < 140))
 					else if ((((L2Skill) template).getLevel() >= 100) && (((L2Skill) template).getLevel() < 140))
+					{
 						abnormalTime += Config.SKILL_DURATION_LIST.get(((L2Skill) template).getId());
 						abnormalTime += Config.SKILL_DURATION_LIST.get(((L2Skill) template).getId());
+					}
 					else if (((L2Skill) template).getLevel() > 140)
 					else if (((L2Skill) template).getLevel() > 140)
+					{
 						abnormalTime = Config.SKILL_DURATION_LIST.get(((L2Skill) template).getId());
 						abnormalTime = Config.SKILL_DURATION_LIST.get(((L2Skill) template).getId());
+					}
 					if (Config.DEBUG)
 					if (Config.DEBUG)
+					{
 						_log.info("*** Skill " + ((L2Skill) template).getName() + " (" + ((L2Skill) template).getLevel() + ") changed duration to " + abnormalTime + " seconds.");
 						_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;
 		boolean self = false;
 		if (attrs.getNamedItem("self") != null)
 		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;
 				self = true;
+			}
 		}
 		}
 		boolean icon = 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;
 				icon = false;
+			}
 		}
 		}
 		Lambda lambda = getLambda(n, template);
 		Lambda lambda = getLambda(n, template);
 		Condition applayCond = parseCondition(n.getFirstChild(), template);
 		Condition applayCond = parseCondition(n.getFirstChild(), template);
@@ -331,7 +385,9 @@ public abstract class DocumentBase
 		
 		
 		double effectPower = -1;
 		double effectPower = -1;
 		if (attrs.getNamedItem("effectPower") != null)
 		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;
 		L2SkillType type = null;
 		if (attrs.getNamedItem("effectType") != null)
 		if (attrs.getNamedItem("effectType") != null)
@@ -344,77 +400,135 @@ public abstract class DocumentBase
 			}
 			}
 			catch (Exception e)
 			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");
 		final boolean isChanceSkillTrigger = name.equals("ChanceSkillTrigger");
 		int trigId = 0;
 		int trigId = 0;
 		if (attrs.getNamedItem("triggeredId") != null)
 		if (attrs.getNamedItem("triggeredId") != null)
+		{
 			trigId = Integer.parseInt(getValue(attrs.getNamedItem("triggeredId").getNodeValue(), template));
 			trigId = Integer.parseInt(getValue(attrs.getNamedItem("triggeredId").getNodeValue(), template));
+		}
 		else if (isChanceSkillTrigger)
 		else if (isChanceSkillTrigger)
+		{
 			throw new NoSuchElementException(name + " requires triggerId");
 			throw new NoSuchElementException(name + " requires triggerId");
+		}
 		
 		
 		int trigLvl = 1;
 		int trigLvl = 1;
 		if (attrs.getNamedItem("triggeredLevel") != null)
 		if (attrs.getNamedItem("triggeredLevel") != null)
+		{
 			trigLvl = Integer.parseInt(getValue(attrs.getNamedItem("triggeredLevel").getNodeValue(), template));
 			trigLvl = Integer.parseInt(getValue(attrs.getNamedItem("triggeredLevel").getNodeValue(), template));
+		}
 		
 		
 		String chanceCond = null;
 		String chanceCond = null;
 		if (attrs.getNamedItem("chanceType") != null)
 		if (attrs.getNamedItem("chanceType") != null)
+		{
 			chanceCond = getValue(attrs.getNamedItem("chanceType").getNodeValue(), template);
 			chanceCond = getValue(attrs.getNamedItem("chanceType").getNodeValue(), template);
+		}
 		else if (isChanceSkillTrigger)
 		else if (isChanceSkillTrigger)
+		{
 			throw new NoSuchElementException(name + " requires chanceType");
 			throw new NoSuchElementException(name + " requires chanceType");
+		}
 		
 		
 		int activationChance = -1;
 		int activationChance = -1;
 		if (attrs.getNamedItem("activationChance") != null)
 		if (attrs.getNamedItem("activationChance") != null)
+		{
 			activationChance = Integer.parseInt(getValue(attrs.getNamedItem("activationChance").getNodeValue(), template));
 			activationChance = Integer.parseInt(getValue(attrs.getNamedItem("activationChance").getNodeValue(), template));
+		}
 		int activationMinDamage = -1;
 		int activationMinDamage = -1;
 		if (attrs.getNamedItem("activationMinDamage") != null)
 		if (attrs.getNamedItem("activationMinDamage") != null)
+		{
 			activationMinDamage = Integer.parseInt(getValue(attrs.getNamedItem("activationMinDamage").getNodeValue(), template));
 			activationMinDamage = Integer.parseInt(getValue(attrs.getNamedItem("activationMinDamage").getNodeValue(), template));
+		}
 		String activationElements = null;
 		String activationElements = null;
 		if (attrs.getNamedItem("activationElements") != null)
 		if (attrs.getNamedItem("activationElements") != null)
+		{
 			activationElements = getValue(attrs.getNamedItem("activationElements").getNodeValue(), template);
 			activationElements = getValue(attrs.getNamedItem("activationElements").getNodeValue(), template);
+		}
 		String activationSkills = null;
 		String activationSkills = null;
 		if (attrs.getNamedItem("activationSkills") != null)
 		if (attrs.getNamedItem("activationSkills") != null)
+		{
 			activationSkills = getValue(attrs.getNamedItem("activationSkills").getNodeValue(), template);
 			activationSkills = getValue(attrs.getNamedItem("activationSkills").getNodeValue(), template);
+		}
 		boolean pvpOnly = false;
 		boolean pvpOnly = false;
 		if (attrs.getNamedItem("pvpChanceOnly") != null)
 		if (attrs.getNamedItem("pvpChanceOnly") != null)
+		{
 			pvpOnly = Boolean.parseBoolean(getValue(attrs.getNamedItem("pvpChanceOnly").getNodeValue(), template));
 			pvpOnly = Boolean.parseBoolean(getValue(attrs.getNamedItem("pvpChanceOnly").getNodeValue(), template));
+		}
 		
 		
 		ChanceCondition chance = ChanceCondition.parse(chanceCond, activationChance, activationMinDamage, activationElements, activationSkills, pvpOnly);
 		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);
 		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);
 		parseTemplate(n, lt);
 		if (template instanceof L2Item)
 		if (template instanceof L2Item)
+		{
 			((L2Item) template).attach(lt);
 			((L2Item) template).attach(lt);
+		}
 		else if (template instanceof L2Skill)
 		else if (template instanceof L2Skill)
 		{
 		{
 			if (self)
 			if (self)
+			{
 				((L2Skill) template).attachSelf(lt);
 				((L2Skill) template).attachSelf(lt);
+			}
 			else if (((L2Skill) template).isPassive())
 			else if (((L2Skill) template).isPassive())
+			{
 				((L2Skill) template).attachPassive(lt);
 				((L2Skill) template).attachPassive(lt);
+			}
 			else
 			else
+			{
 				((L2Skill) template).attach(lt);
 				((L2Skill) template).attach(lt);
+			}
 		}
 		}
 	}
 	}
 	
 	
 	protected Condition parseCondition(Node n, Object template)
 	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();
 			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;
 		return null;
 	}
 	}
 	
 	
@@ -423,10 +537,15 @@ public abstract class DocumentBase
 		ConditionLogicAnd cond = new ConditionLogicAnd();
 		ConditionLogicAnd cond = new ConditionLogicAnd();
 		for (n = n.getFirstChild(); n != null; n = n.getNextSibling())
 		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);
 			_log.severe("Empty <and> condition in " + _file);
+		}
 		return cond;
 		return cond;
 	}
 	}
 	
 	
@@ -435,10 +554,15 @@ public abstract class DocumentBase
 		ConditionLogicOr cond = new ConditionLogicOr();
 		ConditionLogicOr cond = new ConditionLogicOr();
 		for (n = n.getFirstChild(); n != null; n = n.getNextSibling())
 		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);
 			_log.severe("Empty <or> condition in " + _file);
+		}
 		return cond;
 		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));
 			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;
 		return cond;
 	}
 	}
 	
 	
@@ -862,10 +991,10 @@ public abstract class DocumentBase
 				int abnormalId = Integer.decode(getValue(a.getNodeValue(), template));
 				int abnormalId = Integer.decode(getValue(a.getNodeValue(), template));
 				cond = joinAnd(cond, new ConditionTargetAbnormal(abnormalId));
 				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
 			// used for npc race
 			else if ("race_id".equalsIgnoreCase(a.getNodeName()))
 			else if ("race_id".equalsIgnoreCase(a.getNodeName()))
@@ -942,7 +1071,9 @@ public abstract class DocumentBase
 				{
 				{
 					type = Enum.valueOf(InstanceType.class, valuesSplit[j]);
 					type = Enum.valueOf(InstanceType.class, valuesSplit[j]);
 					if (type == null)
 					if (type == null)
-						throw new IllegalArgumentException("Instance type not recognized: "+valuesSplit[j]);
+					{
+						throw new IllegalArgumentException("Instance type not recognized: " + valuesSplit[j]);
+					}
 					types[j] = type;
 					types[j] = type;
 				}
 				}
 				
 				
@@ -959,7 +1090,10 @@ public abstract class DocumentBase
 				cond = joinAnd(cond, new ConditionTargetInvSize(size));
 				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;
 		return cond;
 	}
 	}
 	
 	
@@ -986,13 +1120,19 @@ public abstract class DocumentBase
 					int old = mask;
 					int old = mask;
 					String item = st.nextToken().trim();
 					String item = st.nextToken().trim();
 					if (ItemTable._weaponTypes.containsKey(item))
 					if (ItemTable._weaponTypes.containsKey(item))
+					{
 						mask |= ItemTable._weaponTypes.get(item).mask();
 						mask |= ItemTable._weaponTypes.get(item).mask();
+					}
 					
 					
 					if (ItemTable._armorTypes.containsKey(item))
 					if (ItemTable._armorTypes.containsKey(item))
+					{
 						mask |= ItemTable._armorTypes.get(item).mask();
 						mask |= ItemTable._armorTypes.get(item).mask();
+					}
 					
 					
 					if (old == 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));
 				cond = joinAnd(cond, new ConditionUsingItemType(mask));
 			}
 			}
@@ -1007,7 +1147,10 @@ public abstract class DocumentBase
 				int id = Integer.parseInt(st.nextToken().trim());
 				int id = Integer.parseInt(st.nextToken().trim());
 				int slot = Integer.parseInt(st.nextToken().trim());
 				int slot = Integer.parseInt(st.nextToken().trim());
 				int enchant = 0;
 				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));
 				cond = joinAnd(cond, new ConditionSlotItemId(slot, id, enchant));
 			}
 			}
 			else if ("weaponChange".equalsIgnoreCase(a.getNodeName()))
 			else if ("weaponChange".equalsIgnoreCase(a.getNodeName()))
@@ -1016,7 +1159,10 @@ public abstract class DocumentBase
 				cond = joinAnd(cond, new ConditionChangeWeapon(val));
 				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;
 		return cond;
 	}
 	}
 	
 	
@@ -1043,7 +1189,10 @@ public abstract class DocumentBase
 				cond = joinAnd(cond, new ConditionGameChance(val));
 				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;
 		return cond;
 	}
 	}
 	
 	
@@ -1051,11 +1200,16 @@ public abstract class DocumentBase
 	{
 	{
 		NamedNodeMap attrs = n.getAttributes();
 		NamedNodeMap attrs = n.getAttributes();
 		String name = attrs.getNamedItem("name").getNodeValue();
 		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());
 		StringTokenizer data = new StringTokenizer(n.getFirstChild().getNodeValue());
 		List<String> array = new ArrayList<>(data.countTokens());
 		List<String> array = new ArrayList<>(data.countTokens());
 		while (data.hasMoreTokens())
 		while (data.hasMoreTokens())
+		{
 			array.add(data.nextToken());
 			array.add(data.nextToken());
+		}
 		setTable(name, array.toArray(new String[array.size()]));
 		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 name = n.getAttributes().getNamedItem("name").getNodeValue().trim();
 		String value = n.getAttributes().getNamedItem("val").getNodeValue().trim();
 		String value = n.getAttributes().getNamedItem("val").getNodeValue().trim();
 		char ch = value.isEmpty() ? ' ' : value.charAt(0);
 		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)));
 			set.set(name, String.valueOf(getValue(value, level)));
+		}
 		else
 		else
+		{
 			set.set(name, value);
 			set.set(name, value);
+		}
 	}
 	}
 	
 	
 	protected void setExtractableSkillData(StatsSet set, String value)
 	protected void setExtractableSkillData(StatsSet set, String value)
@@ -1088,13 +1246,21 @@ public abstract class DocumentBase
 			else if (val.charAt(0) == '$')
 			else if (val.charAt(0) == '$')
 			{
 			{
 				if (val.equalsIgnoreCase("$player_level"))
 				if (val.equalsIgnoreCase("$player_level"))
+				{
 					return new LambdaStats(LambdaStats.StatsType.PLAYER_LEVEL);
 					return new LambdaStats(LambdaStats.StatsType.PLAYER_LEVEL);
+				}
 				if (val.equalsIgnoreCase("$target_level"))
 				if (val.equalsIgnoreCase("$target_level"))
+				{
 					return new LambdaStats(LambdaStats.StatsType.TARGET_LEVEL);
 					return new LambdaStats(LambdaStats.StatsType.TARGET_LEVEL);
+				}
 				if (val.equalsIgnoreCase("$player_max_hp"))
 				if (val.equalsIgnoreCase("$player_max_hp"))
+				{
 					return new LambdaStats(LambdaStats.StatsType.PLAYER_MAX_HP);
 					return new LambdaStats(LambdaStats.StatsType.PLAYER_MAX_HP);
+				}
 				if (val.equalsIgnoreCase("$player_max_mp"))
 				if (val.equalsIgnoreCase("$player_max_mp"))
+				{
 					return new LambdaStats(LambdaStats.StatsType.PLAYER_MAX_MP);
 					return new LambdaStats(LambdaStats.StatsType.PLAYER_MAX_MP);
+				}
 				// try to find value out of item fields
 				// try to find value out of item fields
 				StatsSet set = getStatsSet();
 				StatsSet set = getStatsSet();
 				String field = set.getString(val.substring(1));
 				String field = set.getString(val.substring(1));
@@ -1112,14 +1278,21 @@ public abstract class DocumentBase
 		}
 		}
 		LambdaCalc calc = new LambdaCalc();
 		LambdaCalc calc = new LambdaCalc();
 		n = n.getFirstChild();
 		n = n.getFirstChild();
-		while (n != null && n.getNodeType() != Node.ELEMENT_NODE)
+		while ((n != null) && (n.getNodeType() != Node.ELEMENT_NODE))
+		{
 			n = n.getNextSibling();
 			n = n.getNextSibling();
-		if (n == null || !"val".equals(n.getNodeName()))
+		}
+		if ((n == null) || !"val".equals(n.getNodeName()))
+		{
 			throw new IllegalArgumentException("Value not specified");
 			throw new IllegalArgumentException("Value not specified");
+		}
 		
 		
 		for (n = n.getFirstChild(); n != null; n = n.getNextSibling())
 		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);
 			attachLambdaFunc(n, template, calc);
 		}
 		}
 		return calc;
 		return calc;
@@ -1130,16 +1303,28 @@ public abstract class DocumentBase
 		// is it a table?
 		// is it a table?
 		if (value.charAt(0) == '#')
 		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;
 		return value;
 	}
 	}
 	
 	
 	protected Condition joinAnd(Condition cond, Condition c)
 	protected Condition joinAnd(Condition cond, Condition c)
 	{
 	{
-		if (cond == null) return c;
+		if (cond == null)
+		{
+			return c;
+		}
 		if (cond instanceof ConditionLogicAnd)
 		if (cond instanceof ConditionLogicAnd)
 		{
 		{
 			((ConditionLogicAnd) cond).add(c);
 			((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);
 		hashFiles("data/stats/items", _itemFiles);
 		if (Config.CUSTOM_ITEMS_LOAD)
 		if (Config.CUSTOM_ITEMS_LOAD)
+		{
 			hashFiles("data/stats/items/custom", _itemFiles);
 			hashFiles("data/stats/items/custom", _itemFiles);
+		}
 		hashFiles("data/stats/skills", _skillFiles);
 		hashFiles("data/stats/skills", _skillFiles);
 		if (Config.CUSTOM_SKILLS_LOAD)
 		if (Config.CUSTOM_SKILLS_LOAD)
+		{
 			hashFiles("data/stats/skills/custom", _skillFiles);
 			hashFiles("data/stats/skills/custom", _skillFiles);
+		}
 	}
 	}
 	
 	
 	private void hashFiles(String dirname, List<File> hash)
 	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;
 		return _currentDocument;
 	}
 	}
 	
 	
-	
 	/**
 	/**
 	 * Wrapper for {@link #parseDirectory(File, boolean)}.
 	 * Wrapper for {@link #parseDirectory(File, boolean)}.
 	 * @param file the path to the directory where the XML files are.
 	 * @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 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
 	 * @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)
 	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
 public final class DocumentItem extends DocumentBase
 {
 {
 	private Item _currentItem = null;
 	private Item _currentItem = null;
-	private List<L2Item> _itemsInFile = new FastList<>();
+	private final List<L2Item> _itemsInFile = new FastList<>();
 	
 	
 	/**
 	/**
 	 * @param file
 	 * @param file
@@ -45,7 +45,6 @@ public final class DocumentItem extends DocumentBase
 	{
 	{
 		super(file);
 		super(file);
 	}
 	}
-
 	
 	
 	@Override
 	@Override
 	protected StatsSet getStatsSet()
 	protected StatsSet getStatsSet()
@@ -86,7 +85,7 @@ public final class DocumentItem extends DocumentBase
 						}
 						}
 						catch (Exception e)
 						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 ("table".equalsIgnoreCase(n.getNodeName()))
 			{
 			{
 				if (_currentItem.item != null)
 				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);
 				parseTable(n);
 			}
 			}
 			else if ("set".equalsIgnoreCase(n.getNodeName()))
 			else if ("set".equalsIgnoreCase(n.getNodeName()))
 			{
 			{
 				if (_currentItem.item != null)
 				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);
 				parseBeanSet(n, _currentItem.set, 1);
 			}
 			}
 			else if ("for".equalsIgnoreCase(n.getNodeName()))
 			else if ("for".equalsIgnoreCase(n.getNodeName()))
@@ -130,32 +133,38 @@ public final class DocumentItem extends DocumentBase
 			else if ("cond".equalsIgnoreCase(n.getNodeName()))
 			else if ("cond".equalsIgnoreCase(n.getNodeName()))
 			{
 			{
 				makeItem();
 				makeItem();
-				Condition condition = parseCondition(n.getFirstChild(), _currentItem.item );
+				Condition condition = parseCondition(n.getFirstChild(), _currentItem.item);
 				Node msg = n.getAttributes().getNamedItem("msg");
 				Node msg = n.getAttributes().getNamedItem("msg");
 				Node msgId = n.getAttributes().getNamedItem("msgId");
 				Node msgId = n.getAttributes().getNamedItem("msgId");
-				if (condition != null && msg != null)
+				if ((condition != null) && (msg != null))
+				{
 					condition.setMessage(msg.getNodeValue());
 					condition.setMessage(msg.getNodeValue());
-				else if (condition != null && msgId != null)
+				}
+				else if ((condition != null) && (msgId != null))
 				{
 				{
 					condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
 					condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
 					Node addName = n.getAttributes().getNamedItem("addName");
 					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();
 						condition.addName();
+					}
 				}
 				}
 				_currentItem.item.attach(condition);
 				_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();
 		makeItem();
 	}
 	}
 	
 	
 	private void makeItem() throws InvocationTargetException
 	private void makeItem() throws InvocationTargetException
 	{
 	{
-		if (_currentItem.item != null) 
+		if (_currentItem.item != null)
+		{
 			return; // item is already created
 			return; // item is already created
+		}
 		try
 		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);
 			_currentItem.item = (L2Item) c.newInstance(_currentItem.set);
 		}
 		}
 		catch (Exception e)
 		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 ...
  * This class ...
- *
  * @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $
  * @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $
  */
  */
 public class Item
 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 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 Skill _currentSkill;
-	private List<L2Skill> _skillsInFile  = new FastList<>();
+	private final List<L2Skill> _skillsInFile = new FastList<>();
 	
 	
 	public DocumentSkill(File file)
 	public DocumentSkill(File file)
 	{
 	{
@@ -64,7 +64,7 @@ public class DocumentSkill extends DocumentBase
 	
 	
 	private void setCurrentSkill(Skill skill)
 	private void setCurrentSkill(Skill skill)
 	{
 	{
-		_currentSkill    = skill;
+		_currentSkill = skill;
 	}
 	}
 	
 	
 	@Override
 	@Override
@@ -87,7 +87,7 @@ public class DocumentSkill extends DocumentBase
 		}
 		}
 		catch (RuntimeException e)
 		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 "";
 			return "";
 		}
 		}
 	}
 	}
@@ -97,11 +97,11 @@ public class DocumentSkill extends DocumentBase
 	{
 	{
 		try
 		try
 		{
 		{
-			return _tables.get(name)[idx-1];
+			return _tables.get(name)[idx - 1];
 		}
 		}
 		catch (RuntimeException e)
 		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 "";
 			return "";
 		}
 		}
 	}
 	}
@@ -109,11 +109,11 @@ public class DocumentSkill extends DocumentBase
 	@Override
 	@Override
 	protected void parseDocument(Document doc)
 	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()))
 			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()))
 					if ("skill".equalsIgnoreCase(d.getNodeName()))
 					{
 					{
@@ -149,272 +149,348 @@ public class DocumentSkill extends DocumentBase
 		String levels = attrs.getNamedItem("levels").getNodeValue();
 		String levels = attrs.getNamedItem("levels").getNodeValue();
 		int lastLvl = Integer.parseInt(levels);
 		int lastLvl = Integer.parseInt(levels);
 		if (attrs.getNamedItem("enchantGroup1") != null)
 		if (attrs.getNamedItem("enchantGroup1") != null)
+		{
 			enchantLevels1 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 1, Integer.parseInt(attrs.getNamedItem("enchantGroup1").getNodeValue()));
 			enchantLevels1 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 1, Integer.parseInt(attrs.getNamedItem("enchantGroup1").getNodeValue()));
+		}
 		if (attrs.getNamedItem("enchantGroup2") != null)
 		if (attrs.getNamedItem("enchantGroup2") != null)
+		{
 			enchantLevels2 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 2, Integer.parseInt(attrs.getNamedItem("enchantGroup2").getNodeValue()));
 			enchantLevels2 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 2, Integer.parseInt(attrs.getNamedItem("enchantGroup2").getNodeValue()));
+		}
 		if (attrs.getNamedItem("enchantGroup3") != null)
 		if (attrs.getNamedItem("enchantGroup3") != null)
+		{
 			enchantLevels3 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 3, Integer.parseInt(attrs.getNamedItem("enchantGroup3").getNodeValue()));
 			enchantLevels3 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 3, Integer.parseInt(attrs.getNamedItem("enchantGroup3").getNodeValue()));
+		}
 		if (attrs.getNamedItem("enchantGroup4") != null)
 		if (attrs.getNamedItem("enchantGroup4") != null)
+		{
 			enchantLevels4 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 4, Integer.parseInt(attrs.getNamedItem("enchantGroup4").getNodeValue()));
 			enchantLevels4 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 4, Integer.parseInt(attrs.getNamedItem("enchantGroup4").getNodeValue()));
+		}
 		if (attrs.getNamedItem("enchantGroup5") != null)
 		if (attrs.getNamedItem("enchantGroup5") != null)
+		{
 			enchantLevels5 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 5, Integer.parseInt(attrs.getNamedItem("enchantGroup5").getNodeValue()));
 			enchantLevels5 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 5, Integer.parseInt(attrs.getNamedItem("enchantGroup5").getNodeValue()));
+		}
 		if (attrs.getNamedItem("enchantGroup6") != null)
 		if (attrs.getNamedItem("enchantGroup6") != null)
+		{
 			enchantLevels6 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 6, Integer.parseInt(attrs.getNamedItem("enchantGroup6").getNodeValue()));
 			enchantLevels6 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 6, Integer.parseInt(attrs.getNamedItem("enchantGroup6").getNodeValue()));
+		}
 		if (attrs.getNamedItem("enchantGroup7") != null)
 		if (attrs.getNamedItem("enchantGroup7") != null)
+		{
 			enchantLevels7 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 7, Integer.parseInt(attrs.getNamedItem("enchantGroup7").getNodeValue()));
 			enchantLevels7 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 7, Integer.parseInt(attrs.getNamedItem("enchantGroup7").getNodeValue()));
+		}
 		if (attrs.getNamedItem("enchantGroup8") != null)
 		if (attrs.getNamedItem("enchantGroup8") != null)
+		{
 			enchantLevels8 = EnchantGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 8, Integer.parseInt(attrs.getNamedItem("enchantGroup8").getNodeValue()));
 			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] = new StatsSet();
 			_currentSkill.sets[i].set("skill_id", _currentSkill.id);
 			_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)
 		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();
 		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()))
 			if ("table".equalsIgnoreCase(n.getNodeName()))
+			{
 				parseTable(n);
 				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()))
 				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()))
 					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
 					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] = new StatsSet();
 			_currentSkill.enchsets1[i].set("skill_id", _currentSkill.id);
 			_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()))
 				if ("set".equalsIgnoreCase(n.getNodeName()))
+				{
 					parseBeanSet(n, _currentSkill.enchsets1[i], _currentSkill.sets.length);
 					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()))
 				if ("enchant1".equalsIgnoreCase(n.getNodeName()))
-					parseBeanSet(n, _currentSkill.enchsets1[i], i+1);
+				{
+					parseBeanSet(n, _currentSkill.enchsets1[i], i + 1);
+				}
 			}
 			}
 		}
 		}
 		
 		
 		if (_currentSkill.enchsets1.length != enchantLevels1)
 		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] = 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("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()))
 				if ("set".equalsIgnoreCase(n.getNodeName()))
+				{
 					parseBeanSet(n, _currentSkill.enchsets2[i], _currentSkill.sets.length);
 					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()))
 				if ("enchant2".equalsIgnoreCase(n.getNodeName()))
-					parseBeanSet(n, _currentSkill.enchsets2[i], i+1);
+				{
+					parseBeanSet(n, _currentSkill.enchsets2[i], i + 1);
+				}
 			}
 			}
 		}
 		}
 		
 		
 		if (_currentSkill.enchsets2.length != enchantLevels2)
 		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] = new StatsSet();
 			_currentSkill.enchsets3[i].set("skill_id", _currentSkill.id);
 			_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()))
 				if ("set".equalsIgnoreCase(n.getNodeName()))
+				{
 					parseBeanSet(n, _currentSkill.enchsets3[i], _currentSkill.sets.length);
 					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()))
 				if ("enchant3".equalsIgnoreCase(n.getNodeName()))
-					parseBeanSet(n, _currentSkill.enchsets3[i], i+1);
+				{
+					parseBeanSet(n, _currentSkill.enchsets3[i], i + 1);
+				}
 			}
 			}
 		}
 		}
 		
 		
 		if (_currentSkill.enchsets3.length != enchantLevels3)
 		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] = new StatsSet();
 			_currentSkill.enchsets4[i].set("skill_id", _currentSkill.id);
 			_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()))
 				if ("set".equalsIgnoreCase(n.getNodeName()))
+				{
 					parseBeanSet(n, _currentSkill.enchsets4[i], _currentSkill.sets.length);
 					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()))
 				if ("enchant4".equalsIgnoreCase(n.getNodeName()))
-					parseBeanSet(n, _currentSkill.enchsets4[i], i+1);
+				{
+					parseBeanSet(n, _currentSkill.enchsets4[i], i + 1);
+				}
 			}
 			}
 		}
 		}
 		
 		
 		if (_currentSkill.enchsets4.length != enchantLevels4)
 		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] = new StatsSet();
 			_currentSkill.enchsets5[i].set("skill_id", _currentSkill.id);
 			_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()))
 				if ("set".equalsIgnoreCase(n.getNodeName()))
+				{
 					parseBeanSet(n, _currentSkill.enchsets5[i], _currentSkill.sets.length);
 					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()))
 				if ("enchant5".equalsIgnoreCase(n.getNodeName()))
-					parseBeanSet(n, _currentSkill.enchsets5[i], i+1);
+				{
+					parseBeanSet(n, _currentSkill.enchsets5[i], i + 1);
+				}
 			}
 			}
 		}
 		}
 		
 		
 		if (_currentSkill.enchsets5.length != enchantLevels5)
 		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] = new StatsSet();
 			_currentSkill.enchsets6[i].set("skill_id", _currentSkill.id);
 			_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()))
 				if ("set".equalsIgnoreCase(n.getNodeName()))
+				{
 					parseBeanSet(n, _currentSkill.enchsets6[i], _currentSkill.sets.length);
 					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()))
 				if ("enchant6".equalsIgnoreCase(n.getNodeName()))
-					parseBeanSet(n, _currentSkill.enchsets6[i], i+1);
+				{
+					parseBeanSet(n, _currentSkill.enchsets6[i], i + 1);
+				}
 			}
 			}
 		}
 		}
 		
 		
 		if (_currentSkill.enchsets6.length != enchantLevels6)
 		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] = new StatsSet();
 			_currentSkill.enchsets7[i].set("skill_id", _currentSkill.id);
 			_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()))
 				if ("set".equalsIgnoreCase(n.getNodeName()))
+				{
 					parseBeanSet(n, _currentSkill.enchsets7[i], _currentSkill.sets.length);
 					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()))
 				if ("enchant7".equalsIgnoreCase(n.getNodeName()))
-					parseBeanSet(n, _currentSkill.enchsets7[i], i+1);
+				{
+					parseBeanSet(n, _currentSkill.enchsets7[i], i + 1);
+				}
 			}
 			}
 		}
 		}
 		
 		
 		if (_currentSkill.enchsets7.length != enchantLevels7)
 		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] = new StatsSet();
 			_currentSkill.enchsets8[i].set("skill_id", _currentSkill.id);
 			_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()))
 				if ("set".equalsIgnoreCase(n.getNodeName()))
+				{
 					parseBeanSet(n, _currentSkill.enchsets8[i], _currentSkill.sets.length);
 					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()))
 				if ("enchant8".equalsIgnoreCase(n.getNodeName()))
-					parseBeanSet(n, _currentSkill.enchsets8[i], i+1);
+				{
+					parseBeanSet(n, _currentSkill.enchsets8[i], i + 1);
+				}
 			}
 			}
 		}
 		}
 		
 		
 		if (_currentSkill.enchsets8.length != enchantLevels8)
 		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();
 		makeSkills();
-		for (int i=0; i < lastLvl; i++)
+		for (int i = 0; i < lastLvl; i++)
 		{
 		{
 			_currentSkill.currentLevel = 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()))
 				if ("cond".equalsIgnoreCase(n.getNodeName()))
 				{
 				{
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Node msg = n.getAttributes().getNamedItem("msg");
 					Node msg = n.getAttributes().getNamedItem("msg");
 					Node msgId = n.getAttributes().getNamedItem("msgId");
 					Node msgId = n.getAttributes().getNamedItem("msgId");
-					if (condition != null && msg != null)
+					if ((condition != null) && (msg != null))
+					{
 						condition.setMessage(msg.getNodeValue());
 						condition.setMessage(msg.getNodeValue());
-					else if (condition != null && msgId != null)
+					}
+					else if ((condition != null) && (msgId != null))
 					{
 					{
 						condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
 						condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
 						Node addName = n.getAttributes().getNamedItem("addName");
 						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();
 							condition.addName();
+						}
 					}
 					}
 					_currentSkill.currentSkills.get(i).attach(condition, false);
 					_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;
 			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()))
 				if ("enchant1cond".equalsIgnoreCase(n.getNodeName()))
 				{
 				{
 					foundCond = true;
 					foundCond = true;
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Node msg = n.getAttributes().getNamedItem("msg");
 					Node msg = n.getAttributes().getNamedItem("msg");
-					if (condition != null && msg != null)
+					if ((condition != null) && (msg != null))
+					{
 						condition.setMessage(msg.getNodeValue());
 						condition.setMessage(msg.getNodeValue());
-					_currentSkill.currentSkills.get(i).attach(condition,false);
+					}
+					_currentSkill.currentSkills.get(i).attach(condition, false);
 				}
 				}
 				else if ("enchant1for".equalsIgnoreCase(n.getNodeName()))
 				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 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()))
 					if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
 					{
 					{
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Node msg = n.getAttributes().getNamedItem("msg");
 						Node msg = n.getAttributes().getNamedItem("msg");
-						if (condition != null && msg != null)
+						if ((condition != null) && (msg != null))
+						{
 							condition.setMessage(msg.getNodeValue());
 							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()))
 					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;
 			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()))
 				if ("enchant2cond".equalsIgnoreCase(n.getNodeName()))
 				{
 				{
 					foundCond = true;
 					foundCond = true;
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Node msg = n.getAttributes().getNamedItem("msg");
 					Node msg = n.getAttributes().getNamedItem("msg");
-					if (condition != null && msg != null)
+					if ((condition != null) && (msg != null))
+					{
 						condition.setMessage(msg.getNodeValue());
 						condition.setMessage(msg.getNodeValue());
-					_currentSkill.currentSkills.get(i).attach(condition,false);
+					}
+					_currentSkill.currentSkills.get(i).attach(condition, false);
 				}
 				}
 				else if ("enchant2for".equalsIgnoreCase(n.getNodeName()))
 				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 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()))
 					if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
 					{
 					{
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Node msg = n.getAttributes().getNamedItem("msg");
 						Node msg = n.getAttributes().getNamedItem("msg");
-						if (condition != null && msg != null)
+						if ((condition != null) && (msg != null))
+						{
 							condition.setMessage(msg.getNodeValue());
 							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()))
 					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;
 			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()))
 				if ("enchant3cond".equalsIgnoreCase(n.getNodeName()))
 				{
 				{
 					foundCond = true;
 					foundCond = true;
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Node msg = n.getAttributes().getNamedItem("msg");
 					Node msg = n.getAttributes().getNamedItem("msg");
-					if (condition != null && msg != null)
+					if ((condition != null) && (msg != null))
+					{
 						condition.setMessage(msg.getNodeValue());
 						condition.setMessage(msg.getNodeValue());
-					_currentSkill.currentSkills.get(i).attach(condition,false);
+					}
+					_currentSkill.currentSkills.get(i).attach(condition, false);
 				}
 				}
 				else if ("enchant3for".equalsIgnoreCase(n.getNodeName()))
 				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 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()))
 					if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
 					{
 					{
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Node msg = n.getAttributes().getNamedItem("msg");
 						Node msg = n.getAttributes().getNamedItem("msg");
-						if (condition != null && msg != null)
+						if ((condition != null) && (msg != null))
+						{
 							condition.setMessage(msg.getNodeValue());
 							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()))
 					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;
 			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()))
 				if ("enchant4cond".equalsIgnoreCase(n.getNodeName()))
 				{
 				{
 					foundCond = true;
 					foundCond = true;
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Node msg = n.getAttributes().getNamedItem("msg");
 					Node msg = n.getAttributes().getNamedItem("msg");
-					if (condition != null && msg != null)
+					if ((condition != null) && (msg != null))
+					{
 						condition.setMessage(msg.getNodeValue());
 						condition.setMessage(msg.getNodeValue());
-					_currentSkill.currentSkills.get(i).attach(condition,false);
+					}
+					_currentSkill.currentSkills.get(i).attach(condition, false);
 				}
 				}
 				else if ("enchant4for".equalsIgnoreCase(n.getNodeName()))
 				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 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()))
 					if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
 					{
 					{
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Node msg = n.getAttributes().getNamedItem("msg");
 						Node msg = n.getAttributes().getNamedItem("msg");
-						if (condition != null && msg != null)
+						if ((condition != null) && (msg != null))
+						{
 							condition.setMessage(msg.getNodeValue());
 							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()))
 					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;
 			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()))
 				if ("enchant5cond".equalsIgnoreCase(n.getNodeName()))
 				{
 				{
 					foundCond = true;
 					foundCond = true;
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Node msg = n.getAttributes().getNamedItem("msg");
 					Node msg = n.getAttributes().getNamedItem("msg");
-					if (condition != null && msg != null)
+					if ((condition != null) && (msg != null))
+					{
 						condition.setMessage(msg.getNodeValue());
 						condition.setMessage(msg.getNodeValue());
-					_currentSkill.currentSkills.get(i).attach(condition,false);
+					}
+					_currentSkill.currentSkills.get(i).attach(condition, false);
 				}
 				}
 				else if ("enchant5for".equalsIgnoreCase(n.getNodeName()))
 				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 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()))
 					if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
 					{
 					{
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Node msg = n.getAttributes().getNamedItem("msg");
 						Node msg = n.getAttributes().getNamedItem("msg");
-						if (condition != null && msg != null)
+						if ((condition != null) && (msg != null))
+						{
 							condition.setMessage(msg.getNodeValue());
 							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()))
 					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;
 			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()))
 				if ("enchant6cond".equalsIgnoreCase(n.getNodeName()))
 				{
 				{
 					foundCond = true;
 					foundCond = true;
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Node msg = n.getAttributes().getNamedItem("msg");
 					Node msg = n.getAttributes().getNamedItem("msg");
-					if (condition != null && msg != null)
+					if ((condition != null) && (msg != null))
+					{
 						condition.setMessage(msg.getNodeValue());
 						condition.setMessage(msg.getNodeValue());
-					_currentSkill.currentSkills.get(i).attach(condition,false);
+					}
+					_currentSkill.currentSkills.get(i).attach(condition, false);
 				}
 				}
 				else if ("enchant6for".equalsIgnoreCase(n.getNodeName()))
 				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 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()))
 					if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
 					{
 					{
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Node msg = n.getAttributes().getNamedItem("msg");
 						Node msg = n.getAttributes().getNamedItem("msg");
-						if (condition != null && msg != null)
+						if ((condition != null) && (msg != null))
+						{
 							condition.setMessage(msg.getNodeValue());
 							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()))
 					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;
 			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()))
 				if ("enchant7cond".equalsIgnoreCase(n.getNodeName()))
 				{
 				{
 					foundCond = true;
 					foundCond = true;
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Node msg = n.getAttributes().getNamedItem("msg");
 					Node msg = n.getAttributes().getNamedItem("msg");
-					if (condition != null && msg != null)
+					if ((condition != null) && (msg != null))
+					{
 						condition.setMessage(msg.getNodeValue());
 						condition.setMessage(msg.getNodeValue());
-					_currentSkill.currentSkills.get(i).attach(condition,false);
+					}
+					_currentSkill.currentSkills.get(i).attach(condition, false);
 				}
 				}
 				else if ("enchant7for".equalsIgnoreCase(n.getNodeName()))
 				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 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()))
 					if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
 					{
 					{
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Node msg = n.getAttributes().getNamedItem("msg");
 						Node msg = n.getAttributes().getNamedItem("msg");
-						if (condition != null && msg != null)
+						if ((condition != null) && (msg != null))
+						{
 							condition.setMessage(msg.getNodeValue());
 							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()))
 					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;
 			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()))
 				if ("enchant8cond".equalsIgnoreCase(n.getNodeName()))
 				{
 				{
 					foundCond = true;
 					foundCond = true;
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 					Node msg = n.getAttributes().getNamedItem("msg");
 					Node msg = n.getAttributes().getNamedItem("msg");
-					if (condition != null && msg != null)
+					if ((condition != null) && (msg != null))
+					{
 						condition.setMessage(msg.getNodeValue());
 						condition.setMessage(msg.getNodeValue());
-					_currentSkill.currentSkills.get(i).attach(condition,false);
+					}
+					_currentSkill.currentSkills.get(i).attach(condition, false);
 				}
 				}
 				else if ("enchant8for".equalsIgnoreCase(n.getNodeName()))
 				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 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()))
 					if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
 					{
 					{
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
 						Node msg = n.getAttributes().getNamedItem("msg");
 						Node msg = n.getAttributes().getNamedItem("msg");
-						if (condition != null && msg != null)
+						if ((condition != null) && (msg != null))
+						{
 							condition.setMessage(msg.getNodeValue());
 							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()))
 					else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
 					{
 					{
@@ -766,9 +874,9 @@ public class DocumentSkill extends DocumentBase
 	private void makeSkills()
 	private void makeSkills()
 	{
 	{
 		int count = 0;
 		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
 			try
 			{
 			{
@@ -777,111 +885,111 @@ public class DocumentSkill extends DocumentBase
 			}
 			}
 			catch (Exception e)
 			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;
 		int _count = count;
-		for (int i=0; i < _currentSkill.enchsets1.length; i++)
+		for (int i = 0; i < _currentSkill.enchsets1.length; i++)
 		{
 		{
 			try
 			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++;
 				count++;
 			}
 			}
 			catch (Exception e)
 			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;
 		_count = count;
-		for (int i=0; i < _currentSkill.enchsets2.length; i++)
+		for (int i = 0; i < _currentSkill.enchsets2.length; i++)
 		{
 		{
 			try
 			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++;
 				count++;
 			}
 			}
 			catch (Exception e)
 			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;
 		_count = count;
-		for (int i=0; i < _currentSkill.enchsets3.length; i++)
+		for (int i = 0; i < _currentSkill.enchsets3.length; i++)
 		{
 		{
 			try
 			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++;
 				count++;
 			}
 			}
 			catch (Exception e)
 			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;
 		_count = count;
-		for (int i=0; i < _currentSkill.enchsets4.length; i++)
+		for (int i = 0; i < _currentSkill.enchsets4.length; i++)
 		{
 		{
 			try
 			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++;
 				count++;
 			}
 			}
 			catch (Exception e)
 			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;
 		_count = count;
-		for (int i=0; i < _currentSkill.enchsets5.length; i++)
+		for (int i = 0; i < _currentSkill.enchsets5.length; i++)
 		{
 		{
 			try
 			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++;
 				count++;
 			}
 			}
 			catch (Exception e)
 			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;
 		_count = count;
-		for (int i=0; i < _currentSkill.enchsets6.length; i++)
+		for (int i = 0; i < _currentSkill.enchsets6.length; i++)
 		{
 		{
 			try
 			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++;
 				count++;
 			}
 			}
 			catch (Exception e)
 			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;
 		_count = count;
-		for (int i=0; i < _currentSkill.enchsets7.length; i++)
+		for (int i = 0; i < _currentSkill.enchsets7.length; i++)
 		{
 		{
 			try
 			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++;
 				count++;
 			}
 			}
 			catch (Exception e)
 			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;
 		_count = count;
-		for (int i=0; i < _currentSkill.enchsets8.length; i++)
+		for (int i = 0; i < _currentSkill.enchsets8.length; i++)
 		{
 		{
 			try
 			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++;
 				count++;
 			}
 			}
 			catch (Exception e)
 			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 GeoEditorListener _instance;
 	private static final int PORT = 9011;
 	private static final int PORT = 9011;
 	private static Logger _log = Logger.getLogger(GeoEditorListener.class.getName());
 	private static Logger _log = Logger.getLogger(GeoEditorListener.class.getName());
-	private ServerSocket _serverSocket;
+	private final ServerSocket _serverSocket;
 	private GeoEditorThread _geoEditor;
 	private GeoEditorThread _geoEditor;
 	
 	
 	public static GeoEditorListener getInstance()
 	public static GeoEditorListener getInstance()
@@ -65,7 +65,7 @@ public class GeoEditorListener extends Thread
 	
 	
 	public String getStatus()
 	public String getStatus()
 	{
 	{
-		if (_geoEditor != null && _geoEditor.isWorking())
+		if ((_geoEditor != null) && _geoEditor.isWorking())
 		{
 		{
 			return "Geoeditor connected.";
 			return "Geoeditor connected.";
 		}
 		}
@@ -79,7 +79,7 @@ public class GeoEditorListener extends Thread
 		{
 		{
 			while (!isInterrupted())
 			while (!isInterrupted())
 			{
 			{
-				if (_geoEditor != null && _geoEditor.isWorking())
+				if ((_geoEditor != null) && _geoEditor.isWorking())
 				{
 				{
 					_log.warning("Geoeditor already connected!");
 					_log.warning("Geoeditor already connected!");
 					connection.close();
 					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
 	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 int _sendDelay = 1000; // default - once in second
 	
 	
-	private Socket _geSocket;
+	private final Socket _geSocket;
 	
 	
 	private OutputStream _out;
 	private OutputStream _out;
 	
 	
-	private FastList<L2PcInstance> _gms;
+	private final FastList<L2PcInstance> _gms;
 	
 	
 	public GeoEditorThread(Socket ge)
 	public GeoEditorThread(Socket ge)
 	{
 	{
@@ -76,15 +75,23 @@ public class GeoEditorThread extends Thread
 			while (_working)
 			while (_working)
 			{
 			{
 				if (!isConnected())
 				if (!isConnected())
+				{
 					_working = false;
 					_working = false;
+				}
 				
 				
-				if (_mode == 2 && timer > _sendDelay)
+				if ((_mode == 2) && (timer > _sendDelay))
 				{
 				{
 					for (L2PcInstance gm : _gms)
 					for (L2PcInstance gm : _gms)
+					{
 						if (!gm.getClient().getConnection().isClosed())
 						if (!gm.getClient().getConnection().isClosed())
+						{
 							sendGmPosition(gm);
 							sendGmPosition(gm);
+						}
 						else
 						else
+						{
 							_gms.remove(gm);
 							_gms.remove(gm);
+						}
+					}
 					timer = 0;
 					timer = 0;
 				}
 				}
 				
 				
@@ -92,7 +99,9 @@ public class GeoEditorThread extends Thread
 				{
 				{
 					sleep(100);
 					sleep(100);
 					if (_mode == 2)
 					if (_mode == 2)
+					{
 						timer += 100;
 						timer += 100;
+					}
 				}
 				}
 				catch (Exception e)
 				catch (Exception e)
 				{
 				{
@@ -119,7 +128,9 @@ public class GeoEditorThread extends Thread
 	public void sendGmPosition(int gx, int gy, short z)
 	public void sendGmPosition(int gx, int gy, short z)
 	{
 	{
 		if (!isConnected())
 		if (!isConnected())
+		{
 			return;
 			return;
+		}
 		try
 		try
 		{
 		{
 			synchronized (_out)
 			synchronized (_out)
@@ -158,7 +169,9 @@ public class GeoEditorThread extends Thread
 	public void sendPing()
 	public void sendPing()
 	{
 	{
 		if (!isConnected())
 		if (!isConnected())
+		{
 			return;
 			return;
+		}
 		try
 		try
 		{
 		{
 			synchronized (_out)
 			synchronized (_out)
@@ -190,15 +203,15 @@ public class GeoEditorThread extends Thread
 	private void writeD(int value) throws IOException
 	private void writeD(int value) throws IOException
 	{
 	{
 		_out.write(value & 0xff);
 		_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
 	private void writeH(int value) throws IOException
 	{
 	{
 		_out.write(value & 0xff);
 		_out.write(value & 0xff);
-		_out.write(value >> 8 & 0xff);
+		_out.write((value >> 8) & 0xff);
 	}
 	}
 	
 	
 	private void writeC(int value) throws IOException
 	private void writeC(int value) throws IOException
@@ -214,29 +227,41 @@ public class GeoEditorThread extends Thread
 	public void setTimer(int value)
 	public void setTimer(int value)
 	{
 	{
 		if (value < 500)
 		if (value < 500)
+		{
 			_sendDelay = 500; // maximum - 2 times per second!
 			_sendDelay = 500; // maximum - 2 times per second!
+		}
 		else if (value > 60000)
 		else if (value > 60000)
+		{
 			_sendDelay = 60000; // Minimum - 1 time per minute.
 			_sendDelay = 60000; // Minimum - 1 time per minute.
+		}
 		else
 		else
+		{
 			_sendDelay = value;
 			_sendDelay = value;
+		}
 	}
 	}
 	
 	
 	public void addGM(L2PcInstance gm)
 	public void addGM(L2PcInstance gm)
 	{
 	{
 		if (!_gms.contains(gm))
 		if (!_gms.contains(gm))
+		{
 			_gms.add(gm);
 			_gms.add(gm);
+		}
 	}
 	}
 	
 	
 	public void removeGM(L2PcInstance gm)
 	public void removeGM(L2PcInstance gm)
 	{
 	{
 		if (_gms.contains(gm))
 		if (_gms.contains(gm))
+		{
 			_gms.remove(gm);
 			_gms.remove(gm);
+		}
 	}
 	}
 	
 	
 	public boolean isSend(L2PcInstance gm)
 	public boolean isSend(L2PcInstance gm)
 	{
 	{
-		if (_mode == 1 && _gms.contains(gm))
+		if ((_mode == 1) && _gms.contains(gm))
+		{
 			return true;
 			return true;
+		}
 		return false;
 		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;
 		return SingletonHolder._instance;
 	}
 	}
 	
 	
-	
 	private static class SingletonHolder
 	private static class SingletonHolder
 	{
 	{
 		protected static final ItemHandler _instance = new ItemHandler();
 		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;
 package com.l2jserver.gameserver.idfactory;
 
 
-import gnu.trove.list.array.TIntArrayList;
-
 import java.sql.Connection;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.ResultSet;
@@ -27,6 +25,8 @@ import java.util.logging.Logger;
 import com.l2jserver.Config;
 import com.l2jserver.Config;
 import com.l2jserver.L2DatabaseFactory;
 import com.l2jserver.L2DatabaseFactory;
 
 
+import gnu.trove.list.array.TIntArrayList;
+
 /**
 /**
  * This class ...
  * This class ...
  * @version $Revision: 1.3.2.1.2.7 $ $Date: 2005/04/11 10:06:12 $
  * @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 static final String UPDATE_DB = "UPDATE airships SET fuel=? WHERE owner_id=?";
 	
 	
 	private L2CharTemplate _airShipTemplate = null;
 	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()
 	protected AirShipManager()
 	{
 	{
@@ -99,7 +99,7 @@ public class AirShipManager
 	
 	
 	public L2AirShipInstance getNewAirShip(int x, int y, int z, int heading)
 	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.setHeading(heading);
 		airShip.setXYZInvisible(x, y, z);
 		airShip.setXYZInvisible(x, y, z);
@@ -113,7 +113,9 @@ public class AirShipManager
 	{
 	{
 		final StatsSet info = _airShipsInfo.get(ownerId);
 		final StatsSet info = _airShipsInfo.get(ownerId);
 		if (info == null)
 		if (info == null)
+		{
 			return null;
 			return null;
+		}
 		
 		
 		final L2AirShipInstance airShip;
 		final L2AirShipInstance airShip;
 		if (_airShips.containsKey(ownerId))
 		if (_airShips.containsKey(ownerId))
@@ -145,7 +147,9 @@ public class AirShipManager
 			storeInDb(ship.getOwnerId());
 			storeInDb(ship.getOwnerId());
 			final StatsSet info = _airShipsInfo.get(ship.getOwnerId());
 			final StatsSet info = _airShipsInfo.get(ship.getOwnerId());
 			if (info != null)
 			if (info != null)
+			{
 				info.set("fuel", ship.getFuel());
 				info.set("fuel", ship.getFuel());
+			}
 		}
 		}
 	}
 	}
 	
 	
@@ -172,11 +176,11 @@ public class AirShipManager
 			}
 			}
 			catch (SQLException e)
 			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)
 			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)
 	public boolean hasAirShip(int ownerId)
 	{
 	{
 		final L2AirShipInstance ship = _airShips.get(ownerId);
 		final L2AirShipInstance ship = _airShips.get(ownerId);
-		if (ship == null || !(ship.isVisible() || ship.isTeleporting()))
+		if ((ship == null) || !(ship.isVisible() || ship.isTeleporting()))
+		{
 			return false;
 			return false;
+		}
 		
 		
 		return true;
 		return true;
 	}
 	}
@@ -193,23 +199,31 @@ public class AirShipManager
 	public void registerAirShipTeleportList(int dockId, int locationId, VehiclePathPoint[][] tp, int[] fuelConsumption)
 	public void registerAirShipTeleportList(int dockId, int locationId, VehiclePathPoint[][] tp, int[] fuelConsumption)
 	{
 	{
 		if (tp.length != fuelConsumption.length)
 		if (tp.length != fuelConsumption.length)
+		{
 			return;
 			return;
+		}
 		
 		
 		_teleports.put(dockId, new AirShipTeleportList(locationId, fuelConsumption, tp));
 		_teleports.put(dockId, new AirShipTeleportList(locationId, fuelConsumption, tp));
 	}
 	}
 	
 	
 	public void sendAirShipTeleportList(L2PcInstance player)
 	public void sendAirShipTeleportList(L2PcInstance player)
 	{
 	{
-		if (player == null || !player.isInAirShip())
+		if ((player == null) || !player.isInAirShip())
+		{
 			return;
 			return;
+		}
 		
 		
 		final L2AirShipInstance ship = player.getAirShip();
 		final L2AirShipInstance ship = player.getAirShip();
 		if (!ship.isCaptain(player) || !ship.isInDock() || ship.isMoving())
 		if (!ship.isCaptain(player) || !ship.isInDock() || ship.isMoving())
+		{
 			return;
 			return;
+		}
 		
 		
 		int dockId = ship.getDockId();
 		int dockId = ship.getDockId();
 		if (!_teleports.containsKey(dockId))
 		if (!_teleports.containsKey(dockId))
+		{
 			return;
 			return;
+		}
 		
 		
 		final AirShipTeleportList all = _teleports.get(dockId);
 		final AirShipTeleportList all = _teleports.get(dockId);
 		player.sendPacket(new ExAirShipTeleportList(all.location, all.routes, all.fuel));
 		player.sendPacket(new ExAirShipTeleportList(all.location, all.routes, all.fuel));
@@ -219,10 +233,14 @@ public class AirShipManager
 	{
 	{
 		final AirShipTeleportList all = _teleports.get(dockId);
 		final AirShipTeleportList all = _teleports.get(dockId);
 		if (all == null)
 		if (all == null)
+		{
 			return null;
 			return null;
+		}
 		
 		
-		if (index < -1 || index >= all.routes.length)
+		if ((index < -1) || (index >= all.routes.length))
+		{
 			return null;
 			return null;
+		}
 		
 		
 		return all.routes[index + 1];
 		return all.routes[index + 1];
 	}
 	}
@@ -231,10 +249,14 @@ public class AirShipManager
 	{
 	{
 		final AirShipTeleportList all = _teleports.get(dockId);
 		final AirShipTeleportList all = _teleports.get(dockId);
 		if (all == null)
 		if (all == null)
+		{
 			return 0;
 			return 0;
+		}
 		
 		
-		if (index < -1 || index >= all.fuel.length)
+		if ((index < -1) || (index >= all.fuel.length))
+		{
 			return 0;
 			return 0;
+		}
 		
 		
 		return all.fuel[index + 1];
 		return all.fuel[index + 1];
 	}
 	}
@@ -255,20 +277,22 @@ public class AirShipManager
 		}
 		}
 		catch (SQLException e)
 		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)
 		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)
 	private void storeInDb(int ownerId)
 	{
 	{
 		StatsSet info = _airShipsInfo.get(ownerId);
 		StatsSet info = _airShipsInfo.get(ownerId);
 		if (info == null)
 		if (info == null)
+		{
 			return;
 			return;
+		}
 		
 		
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
 			PreparedStatement ps = con.prepareStatement(UPDATE_DB))
 			PreparedStatement ps = con.prepareStatement(UPDATE_DB))
@@ -279,11 +303,11 @@ public class AirShipManager
 		}
 		}
 		catch (SQLException e)
 		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)
 		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)
 	public final boolean check(L2Character attacker, L2Character target)
 	{
 	{
 		if (!Config.L2JMOD_ANTIFEED_ENABLE)
 		if (!Config.L2JMOD_ANTIFEED_ENABLE)
+		{
 			return true;
 			return true;
+		}
 		
 		
 		if (target == null)
 		if (target == null)
+		{
 			return false;
 			return false;
+		}
 		
 		
 		final L2PcInstance targetPlayer = target.getActingPlayer();
 		final L2PcInstance targetPlayer = target.getActingPlayer();
 		if (targetPlayer == null)
 		if (targetPlayer == null)
+		{
 			return false;
 			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;
 			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();
 			final L2PcInstance attackerPlayer = attacker.getActingPlayer();
 			if (attackerPlayer == null)
 			if (attackerPlayer == null)
+			{
 				return false;
 				return false;
+			}
 			
 			
 			final L2GameClient targetClient = targetPlayer.getClient();
 			final L2GameClient targetClient = targetPlayer.getClient();
 			final L2GameClient attackerClient = attackerPlayer.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
 				// unable to check ip address
 				return !Config.L2JMOD_ANTIFEED_DISCONNECTED_AS_DUALBOX;
 				return !Config.L2JMOD_ANTIFEED_DISCONNECTED_AS_DUALBOX;
+			}
 			
 			
 			return !targetClient.getConnectionAddress().equals(attackerClient.getConnectionAddress());
 			return !targetClient.getConnectionAddress().equals(attackerClient.getConnectionAddress());
 		}
 		}
@@ -103,7 +115,9 @@ public class AntiFeedManager
 	public final void registerEvent(int eventId)
 	public final void registerEvent(int eventId)
 	{
 	{
 		if (!_eventIPs.containsKey(eventId))
 		if (!_eventIPs.containsKey(eventId))
+		{
 			_eventIPs.put(eventId, new FastMap<Integer, Connections>());
 			_eventIPs.put(eventId, new FastMap<Integer, Connections>());
+		}
 	}
 	}
 	
 	
 	/**
 	/**
@@ -128,12 +142,16 @@ public class AntiFeedManager
 	public final boolean tryAddClient(int eventId, L2GameClient client, int max)
 	public final boolean tryAddClient(int eventId, L2GameClient client, int max)
 	{
 	{
 		if (client == null)
 		if (client == null)
+		{
 			return false; // unable to determine IP address
 			return false; // unable to determine IP address
-			
+		}
+		
 		final Map<Integer, Connections> event = _eventIPs.get(eventId);
 		final Map<Integer, Connections> event = _eventIPs.get(eventId);
 		if (event == null)
 		if (event == null)
+		{
 			return false; // no such event registered
 			return false; // no such event registered
-			
+		}
+		
 		final Integer addrHash = Integer.valueOf(client.getConnectionAddress().hashCode());
 		final Integer addrHash = Integer.valueOf(client.getConnectionAddress().hashCode());
 		int limit = max;
 		int limit = max;
 		if (Config.L2JMOD_DUALBOX_CHECK_WHITELIST.containsKey(addrHash))
 		if (Config.L2JMOD_DUALBOX_CHECK_WHITELIST.containsKey(addrHash))
@@ -165,21 +183,29 @@ public class AntiFeedManager
 	{
 	{
 		final L2GameClient client = player.getClient();
 		final L2GameClient client = player.getClient();
 		if (client == null)
 		if (client == null)
+		{
 			return false; // unable to determine IP address
 			return false; // unable to determine IP address
-			
+		}
+		
 		final Map<Integer, Connections> event = _eventIPs.get(eventId);
 		final Map<Integer, Connections> event = _eventIPs.get(eventId);
 		if (event == null)
 		if (event == null)
+		{
 			return false; // no such event registered
 			return false; // no such event registered
-			
+		}
+		
 		final Integer addrHash = Integer.valueOf(client.getConnectionAddress().hashCode());
 		final Integer addrHash = Integer.valueOf(client.getConnectionAddress().hashCode());
 		Connections conns = event.get(addrHash);
 		Connections conns = event.get(addrHash);
 		if (conns == null)
 		if (conns == null)
+		{
 			return false; // address not registered
 			return false; // address not registered
-			
+		}
+		
 		synchronized (event)
 		synchronized (event)
 		{
 		{
 			if (conns.testAndDecrement())
 			if (conns.testAndDecrement())
+			{
 				event.remove(addrHash);
 				event.remove(addrHash);
+			}
 		}
 		}
 		
 		
 		return true;
 		return true;
@@ -192,7 +218,9 @@ public class AntiFeedManager
 	public final void onDisconnect(L2GameClient client)
 	public final void onDisconnect(L2GameClient client)
 	{
 	{
 		if (client == null)
 		if (client == null)
+		{
 			return;
 			return;
+		}
 		
 		
 		final Integer addrHash = Integer.valueOf(client.getConnectionAddress().hashCode());
 		final Integer addrHash = Integer.valueOf(client.getConnectionAddress().hashCode());
 		_eventIPs.executeForEachValue(new DisconnectProcedure(addrHash));
 		_eventIPs.executeForEachValue(new DisconnectProcedure(addrHash));
@@ -206,7 +234,9 @@ public class AntiFeedManager
 	{
 	{
 		final Map<Integer, Connections> event = _eventIPs.get(eventId);
 		final Map<Integer, Connections> event = _eventIPs.get(eventId);
 		if (event != null)
 		if (event != null)
+		{
 			event.clear();
 			event.clear();
+		}
 	}
 	}
 	
 	
 	/**
 	/**
@@ -227,7 +257,9 @@ public class AntiFeedManager
 	public final int getLimit(L2GameClient client, int max)
 	public final int getLimit(L2GameClient client, int max)
 	{
 	{
 		if (client == null)
 		if (client == null)
+		{
 			return max;
 			return max;
+		}
 		
 		
 		final Integer addrHash = Integer.valueOf(client.getConnectionAddress().hashCode());
 		final Integer addrHash = Integer.valueOf(client.getConnectionAddress().hashCode());
 		int limit = max;
 		int limit = max;
@@ -263,7 +295,9 @@ public class AntiFeedManager
 		public final synchronized boolean testAndDecrement()
 		public final synchronized boolean testAndDecrement()
 		{
 		{
 			if (_num > 0)
 			if (_num > 0)
+			{
 				_num--;
 				_num--;
+			}
 			
 			
 			return _num == 0;
 			return _num == 0;
 		}
 		}
@@ -287,7 +321,9 @@ public class AntiFeedManager
 				synchronized (event)
 				synchronized (event)
 				{
 				{
 					if (conns.testAndDecrement())
 					if (conns.testAndDecrement())
+					{
 						event.remove(_addrHash);
 						event.remove(_addrHash);
+					}
 				}
 				}
 			}
 			}
 			return true;
 			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.L2DatabaseFactory;
 import com.l2jserver.gameserver.model.entity.Auction;
 import com.l2jserver.gameserver.model.entity.Auction;
 
 
+/**
+ * Zoey76: TODO: Rewrite it and unharcode it.
+ */
 public class AuctionManager
 public class AuctionManager
 {
 {
 	protected static final Logger _log = Logger.getLogger(AuctionManager.class.getName());
 	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 =
 	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)"
 		"(61, 0, 'NPC', 'NPC Clan', 'ClanHall', 61, 0, 'Titan Hall', 1, 50000000, 0, 1164841200000)"
 	};
 	};
 	
 	
+	// @formatter:off
 	private static final int[] ItemInitDataId =
 	private static final int[] ItemInitDataId =
 	{
 	{
 		22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 36, 37, 38, 39, 40, 41, 42,
 		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
 		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()
 	public static final AuctionManager getInstance()
 	{
 	{
@@ -118,7 +123,9 @@ public class AuctionManager
 	{
 	{
 		int index = getAuctionIndex(auctionId);
 		int index = getAuctionIndex(auctionId);
 		if (index >= 0)
 		if (index >= 0)
+		{
 			return getAuctions().get(index);
 			return getAuctions().get(index);
+		}
 		return null;
 		return null;
 	}
 	}
 	
 	
@@ -128,8 +135,10 @@ public class AuctionManager
 		for (int i = 0; i < getAuctions().size(); i++)
 		for (int i = 0; i < getAuctions().size(); i++)
 		{
 		{
 			auction = getAuctions().get(i);
 			auction = getAuctions().get(i);
-			if (auction != null && auction.getId() == auctionId)
+			if ((auction != null) && (auction.getId() == auctionId))
+			{
 				return i;
 				return i;
+			}
 		}
 		}
 		return -1;
 		return -1;
 	}
 	}
@@ -140,7 +149,7 @@ public class AuctionManager
 	}
 	}
 	
 	
 	/**
 	/**
-	 * Init Clan NPC aution 
+	 * Init Clan NPC aution
 	 * @param id
 	 * @param id
 	 */
 	 */
 	public void initNPC(int id)
 	public void initNPC(int id)
@@ -149,9 +158,11 @@ public class AuctionManager
 		for (i = 0; i < ItemInitDataId.length; i++)
 		for (i = 0; i < ItemInitDataId.length; i++)
 		{
 		{
 			if (ItemInitDataId[i] == id)
 			if (ItemInitDataId[i] == id)
+			{
 				break;
 				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);
 			_log.warning(getClass().getSimpleName() + ": Clan Hall auction not found for Id :" + id);
 			return;
 			return;

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

@@ -14,8 +14,6 @@
  */
  */
 package com.l2jserver.gameserver.instancemanager;
 package com.l2jserver.gameserver.instancemanager;
 
 
-import gnu.trove.procedure.TObjectProcedure;
-
 import java.util.Map;
 import java.util.Map;
 
 
 import javolution.util.FastMap;
 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.model.actor.templates.L2CharTemplate;
 import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
 import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
 
 
+import gnu.trove.procedure.TObjectProcedure;
+
 public class BoatManager
 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 TALKING_ISLAND = 1;
 	public static final int GLUDIN_HARBOR = 2;
 	public static final int GLUDIN_HARBOR = 2;
@@ -47,13 +47,17 @@ public class BoatManager
 	protected BoatManager()
 	protected BoatManager()
 	{
 	{
 		for (int i = 0; i < _docksBusy.length; i++)
 		for (int i = 0; i < _docksBusy.length; i++)
+		{
 			_docksBusy[i] = false;
 			_docksBusy[i] = false;
+		}
 	}
 	}
 	
 	
 	public L2BoatInstance getNewBoat(int boatId, int x, int y, int z, int heading)
 	public L2BoatInstance getNewBoat(int boatId, int x, int y, int z, int heading)
 	{
 	{
 		if (!Config.ALLOW_BOAT)
 		if (!Config.ALLOW_BOAT)
+		{
 			return null;
 			return null;
+		}
 		
 		
 		StatsSet npcDat = new StatsSet();
 		StatsSet npcDat = new StatsSet();
 		npcDat.set("npcId", boatId);
 		npcDat.set("npcId", boatId);
@@ -128,7 +132,8 @@ public class BoatManager
 			_docksBusy[h] = value;
 			_docksBusy[h] = value;
 		}
 		}
 		catch (ArrayIndexOutOfBoundsException e)
 		catch (ArrayIndexOutOfBoundsException e)
-		{}
+		{
+		}
 	}
 	}
 	
 	
 	/**
 	/**
@@ -150,9 +155,9 @@ public class BoatManager
 	
 	
 	/**
 	/**
 	 * Broadcast one packet in both path points
 	 * 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)
 	public void broadcastPacket(VehiclePathPoint point1, VehiclePathPoint point2, L2GameServerPacket packet)
 	{
 	{
@@ -162,9 +167,9 @@ public class BoatManager
 	
 	
 	/**
 	/**
 	 * Broadcast several packets in both path points
 	 * 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)
 	public void broadcastPackets(VehiclePathPoint point1, VehiclePathPoint point2, L2GameServerPacket... packets)
 	{
 	{
@@ -176,7 +181,7 @@ public class BoatManager
 		VehiclePathPoint _point1, _point2;
 		VehiclePathPoint _point1, _point2;
 		L2GameServerPacket[] _packets;
 		L2GameServerPacket[] _packets;
 		
 		
-		protected ForEachPlayerBroadcastPackets(VehiclePathPoint point1, VehiclePathPoint point2, L2GameServerPacket ... packets)
+		protected ForEachPlayerBroadcastPackets(VehiclePathPoint point1, VehiclePathPoint point2, L2GameServerPacket... packets)
 		{
 		{
 			_point1 = point1;
 			_point1 = point1;
 			_point2 = point2;
 			_point2 = point2;
@@ -190,19 +195,23 @@ public class BoatManager
 			{
 			{
 				double dx = (double) player.getX() - _point1.x;
 				double dx = (double) player.getX() - _point1.x;
 				double dy = (double) player.getY() - _point1.y;
 				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)
 					for (L2GameServerPacket p : _packets)
+					{
 						player.sendPacket(p);
 						player.sendPacket(p);
+					}
 				}
 				}
 				else
 				else
 				{
 				{
 					dx = (double) player.getX() - _point2.x;
 					dx = (double) player.getX() - _point2.x;
 					dy = (double) player.getY() - _point2.y;
 					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)
 						for (L2GameServerPacket p : _packets)
+						{
 							player.sendPacket(p);
 							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 Logger _log = Logger.getLogger(CHSiegeManager.class.getName());
 	private static final String SQL_LOAD_HALLS = "SELECT * FROM siegable_clanhall";
 	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()
 	protected CHSiegeManager()
 	{
 	{
@@ -58,7 +58,7 @@ public final class CHSiegeManager
 			
 			
 			_siegableHalls.clear();
 			_siegableHalls.clear();
 			
 			
-			while(rs.next())
+			while (rs.next())
 			{
 			{
 				final int id = rs.getInt("clanHallId");
 				final int id = rs.getInt("clanHallId");
 				
 				
@@ -80,7 +80,7 @@ public final class CHSiegeManager
 			rs.close();
 			rs.close();
 			statement.close();
 			statement.close();
 		}
 		}
-		catch(Exception e)
+		catch (Exception e)
 		{
 		{
 			_log.warning("CHSiegeManager: Could not load siegable clan halls!:");
 			_log.warning("CHSiegeManager: Could not load siegable clan halls!:");
 		}
 		}
@@ -91,7 +91,6 @@ public final class CHSiegeManager
 		return _siegableHalls;
 		return _siegableHalls;
 	}
 	}
 	
 	
-	
 	public SiegableHall getSiegableHall(int clanHall)
 	public SiegableHall getSiegableHall(int clanHall)
 	{
 	{
 		return getConquerableHalls().get(clanHall);
 		return getConquerableHalls().get(clanHall);
@@ -109,8 +108,10 @@ public final class CHSiegeManager
 		for (Map.Entry<Integer, SiegableHall> ch : _siegableHalls.entrySet())
 		for (Map.Entry<Integer, SiegableHall> ch : _siegableHalls.entrySet())
 		{
 		{
 			zone = ch.getValue().getZone();
 			zone = ch.getValue().getZone();
-			if (zone != null && zone.getDistanceToZone(x, y) < maxDist)
+			if ((zone != null) && (zone.getDistanceToZone(x, y) < maxDist))
+			{
 				return ch.getValue();
 				return ch.getValue();
+			}
 		}
 		}
 		return null;
 		return null;
 	}
 	}
@@ -118,59 +119,85 @@ public final class CHSiegeManager
 	public final ClanHallSiegeEngine getSiege(L2Character character)
 	public final ClanHallSiegeEngine getSiege(L2Character character)
 	{
 	{
 		SiegableHall hall = getNearbyClanHall(character);
 		SiegableHall hall = getNearbyClanHall(character);
-		if(hall == null)
+		if (hall == null)
+		{
 			return null;
 			return null;
+		}
 		return hall.getSiege();
 		return hall.getSiege();
 	}
 	}
 	
 	
 	public final void registerClan(L2Clan clan, SiegableHall hall, L2PcInstance player)
 	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);
 			SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.DEADLINE_FOR_SIEGE_S1_PASSED);
 			sm.addString(hall.getName());
 			sm.addString(hall.getName());
 			player.sendPacket(sm);
 			player.sendPacket(sm);
 		}
 		}
-		else if(hall.isInSiege())
+		else if (hall.isInSiege())
+		{
 			player.sendPacket(SystemMessageId.NOT_SIEGE_REGISTRATION_TIME2);
 			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);
 			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);
 			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);
 			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);
 			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);
 			player.sendPacket(SystemMessageId.ATTACKER_SIDE_FULL);
+		}
 		else
 		else
+		{
 			hall.addAttacker(clan);
 			hall.addAttacker(clan);
+		}
 	}
 	}
 	
 	
 	public final void unRegisterClan(L2Clan clan, SiegableHall hall)
 	public final void unRegisterClan(L2Clan clan, SiegableHall hall)
 	{
 	{
-		if(!hall.isRegistering())
+		if (!hall.isRegistering())
+		{
 			return;
 			return;
+		}
 		hall.removeAttacker(clan);
 		hall.removeAttacker(clan);
 	}
 	}
 	
 	
 	public final boolean isClanParticipating(L2Clan 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 true;
+			}
+		}
 		return false;
 		return false;
 	}
 	}
 	
 	
 	public final void onServerShutDown()
 	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;
 				continue;
+			}
 			
 			
 			hall.getSiege().saveAttackers();
 			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 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)
 	public final int findNearestCastleIndex(L2Object obj)
 	{
 	{
 		return findNearestCastleIndex(obj, Long.MAX_VALUE);
 		return findNearestCastleIndex(obj, Long.MAX_VALUE);
 	}
 	}
+	
 	public final int findNearestCastleIndex(L2Object obj, long maxDistance)
 	public final int findNearestCastleIndex(L2Object obj, long maxDistance)
 	{
 	{
 		int index = getCastleIndex(obj);
 		int index = getCastleIndex(obj);
@@ -61,7 +74,9 @@ public class CastleManager implements InstanceListManager
 			{
 			{
 				castle = getCastles().get(i);
 				castle = getCastles().get(i);
 				if (castle == null)
 				if (castle == null)
+				{
 					continue;
 					continue;
+				}
 				distance = castle.getDistance(obj);
 				distance = castle.getDistance(obj);
 				if (maxDistance > distance)
 				if (maxDistance > distance)
 				{
 				{
@@ -78,7 +93,9 @@ public class CastleManager implements InstanceListManager
 		for (Castle temp : getCastles())
 		for (Castle temp : getCastles())
 		{
 		{
 			if (temp.getCastleId() == castleId)
 			if (temp.getCastleId() == castleId)
+			{
 				return temp;
 				return temp;
+			}
 		}
 		}
 		return null;
 		return null;
 	}
 	}
@@ -88,7 +105,9 @@ public class CastleManager implements InstanceListManager
 		for (Castle temp : getCastles())
 		for (Castle temp : getCastles())
 		{
 		{
 			if (temp.getOwnerId() == clan.getClanId())
 			if (temp.getOwnerId() == clan.getClanId())
+			{
 				return temp;
 				return temp;
+			}
 		}
 		}
 		return null;
 		return null;
 	}
 	}
@@ -98,7 +117,9 @@ public class CastleManager implements InstanceListManager
 		for (Castle temp : getCastles())
 		for (Castle temp : getCastles())
 		{
 		{
 			if (temp.getName().equalsIgnoreCase(name.trim()))
 			if (temp.getName().equalsIgnoreCase(name.trim()))
+			{
 				return temp;
 				return temp;
+			}
 		}
 		}
 		return null;
 		return null;
 	}
 	}
@@ -108,7 +129,9 @@ public class CastleManager implements InstanceListManager
 		for (Castle temp : getCastles())
 		for (Castle temp : getCastles())
 		{
 		{
 			if (temp.checkIfInZone(x, y, z))
 			if (temp.checkIfInZone(x, y, z))
+			{
 				return temp;
 				return temp;
+			}
 		}
 		}
 		return null;
 		return null;
 	}
 	}
@@ -124,8 +147,10 @@ public class CastleManager implements InstanceListManager
 		for (int i = 0; i < getCastles().size(); i++)
 		for (int i = 0; i < getCastles().size(); i++)
 		{
 		{
 			castle = getCastles().get(i);
 			castle = getCastles().get(i);
-			if (castle != null && castle.getCastleId() == castleId)
+			if ((castle != null) && (castle.getCastleId() == castleId))
+			{
 				return i;
 				return i;
+			}
 		}
 		}
 		return -1;
 		return -1;
 	}
 	}
@@ -141,8 +166,10 @@ public class CastleManager implements InstanceListManager
 		for (int i = 0; i < getCastles().size(); i++)
 		for (int i = 0; i < getCastles().size(); i++)
 		{
 		{
 			castle = getCastles().get(i);
 			castle = getCastles().get(i);
-			if (castle != null && castle.checkIfInZone(x, y, z))
+			if ((castle != null) && castle.checkIfInZone(x, y, z))
+			{
 				return i;
 				return i;
+			}
 		}
 		}
 		return -1;
 		return -1;
 	}
 	}
@@ -150,7 +177,9 @@ public class CastleManager implements InstanceListManager
 	public final List<Castle> getCastles()
 	public final List<Castle> getCastles()
 	{
 	{
 		if (_castles == null)
 		if (_castles == null)
+		{
 			_castles = new FastList<>();
 			_castles = new FastList<>();
+		}
 		return _castles;
 		return _castles;
 	}
 	}
 	
 	
@@ -170,8 +199,12 @@ public class CastleManager implements InstanceListManager
 				break;
 				break;
 		}
 		}
 		for (Castle castle : _castles)
 		for (Castle castle : _castles)
+		{
 			if (castle.getTaxPercent() > maxTax)
 			if (castle.getTaxPercent() > maxTax)
+			{
 				castle.setTaxPercent(maxTax);
 				castle.setTaxPercent(maxTax);
+			}
+		}
 	}
 	}
 	
 	
 	int _castleId = 1; // from this castle
 	int _castleId = 1; // from this castle
@@ -183,8 +216,10 @@ public class CastleManager implements InstanceListManager
 	
 	
 	public int getCircletByCastleId(int castleId)
 	public int getCircletByCastleId(int castleId)
 	{
 	{
-		if (castleId > 0 && castleId < 10)
+		if ((castleId > 0) && (castleId < 10))
+		{
 			return _castleCirclets[castleId];
 			return _castleCirclets[castleId];
+		}
 		
 		
 		return 0;
 		return 0;
 	}
 	}
@@ -193,13 +228,17 @@ public class CastleManager implements InstanceListManager
 	public void removeCirclet(L2Clan clan, int castleId)
 	public void removeCirclet(L2Clan clan, int castleId)
 	{
 	{
 		for (L2ClanMember member : clan.getMembers())
 		for (L2ClanMember member : clan.getMembers())
+		{
 			removeCirclet(member, castleId);
 			removeCirclet(member, castleId);
+		}
 	}
 	}
 	
 	
 	public void removeCirclet(L2ClanMember member, int castleId)
 	public void removeCirclet(L2ClanMember member, int castleId)
 	{
 	{
 		if (member == null)
 		if (member == null)
+		{
 			return;
 			return;
+		}
 		L2PcInstance player = member.getPlayerInstance();
 		L2PcInstance player = member.getPlayerInstance();
 		int circletId = getCircletByCastleId(castleId);
 		int circletId = getCircletByCastleId(castleId);
 		
 		
@@ -214,7 +253,9 @@ public class CastleManager implements InstanceListManager
 					if (circlet != null)
 					if (circlet != null)
 					{
 					{
 						if (circlet.isEquipped())
 						if (circlet.isEquipped())
+						{
 							player.getInventory().unEquipItemInSlot(circlet.getLocationSlot());
 							player.getInventory().unEquipItemInSlot(circlet.getLocationSlot());
+						}
 						player.destroyItemByItemId("CastleCircletRemoval", circletId, 1, player, true);
 						player.destroyItemByItemId("CastleCircletRemoval", circletId, 1, player, true);
 					}
 					}
 					return;
 					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;
 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
  * @author l3x
  */
  */
 public class CastleManorManager
 public class CastleManorManager
@@ -191,10 +190,14 @@ public class CastleManorManager
 		
 		
 		boolean isApproved;
 		boolean isApproved;
 		if (_periodApprove.getTimeInMillis() > _manorRefresh.getTimeInMillis())
 		if (_periodApprove.getTimeInMillis() > _manorRefresh.getTimeInMillis())
+		{
 			// Next approve period already scheduled
 			// Next approve period already scheduled
 			isApproved = (_manorRefresh.getTimeInMillis() > Calendar.getInstance().getTimeInMillis());
 			isApproved = (_manorRefresh.getTimeInMillis() > Calendar.getInstance().getTimeInMillis());
+		}
 		else
 		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())
 		for (Castle c : CastleManager.getInstance().getCastles())
 		{
 		{
@@ -227,9 +230,13 @@ public class CastleManorManager
 					int price = rs.getInt("seed_price");
 					int price = rs.getInt("seed_price");
 					int period = rs.getInt("period");
 					int period = rs.getInt("period");
 					if (period == PERIOD_CURRENT)
 					if (period == PERIOD_CURRENT)
+					{
 						production.add(new SeedProduction(seedId, canProduce, price, startProduce));
 						production.add(new SeedProduction(seedId, canProduce, price, startProduce));
+					}
 					else
 					else
+					{
 						productionNext.add(new SeedProduction(seedId, canProduce, price, startProduce));
 						productionNext.add(new SeedProduction(seedId, canProduce, price, startProduce));
+					}
 				}
 				}
 				rs.close();
 				rs.close();
 				
 				
@@ -250,9 +257,13 @@ public class CastleManorManager
 					int price = rs.getInt("price");
 					int price = rs.getInt("price");
 					int period = rs.getInt("period");
 					int period = rs.getInt("period");
 					if (period == PERIOD_CURRENT)
 					if (period == PERIOD_CURRENT)
+					{
 						procure.add(new CropProcure(cropId, canBuy, rewardType, startBuy, price));
 						procure.add(new CropProcure(cropId, canBuy, rewardType, startBuy, price));
+					}
 					else
 					else
+					{
 						procureNext.add(new CropProcure(cropId, canBuy, rewardType, startBuy, price));
 						procureNext.add(new CropProcure(cropId, canBuy, rewardType, startBuy, price));
+					}
 				}
 				}
 				rs.close();
 				rs.close();
 				
 				
@@ -260,7 +271,9 @@ public class CastleManorManager
 				castle.setCropProcure(procureNext, PERIOD_NEXT);
 				castle.setCropProcure(procureNext, PERIOD_NEXT);
 				
 				
 				if (!procure.isEmpty() || !procureNext.isEmpty() || !production.isEmpty() || !productionNext.isEmpty())
 				if (!procure.isEmpty() || !procureNext.isEmpty() || !production.isEmpty() || !productionNext.isEmpty())
+				{
 					_log.info(getClass().getSimpleName() + ": " + castle.getName() + ": Data loaded");
 					_log.info(getClass().getSimpleName() + ": " + castle.getName() + ": Data loaded");
+				}
 			}
 			}
 			statementProduction.close();
 			statementProduction.close();
 			statementProcure.close();
 			statementProcure.close();
@@ -299,7 +312,8 @@ public class CastleManorManager
 					setUnderMaintenance(true);
 					setUnderMaintenance(true);
 					_log.info("Manor System: Under maintenance mode started");
 					_log.info("Manor System: Under maintenance mode started");
 					
 					
-					_scheduledMaintenanceEnd = ThreadPoolManager.getInstance().scheduleGeneral(new Runnable() {
+					_scheduledMaintenanceEnd = ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
+					{
 						@Override
 						@Override
 						public void run()
 						public void run()
 						{
 						{
@@ -344,8 +358,10 @@ public class CastleManorManager
 	public long getMillisToManorRefresh()
 	public long getMillisToManorRefresh()
 	{
 	{
 		// use safe interval 120s to prevent double run
 		// use safe interval 120s to prevent double run
-		if (_manorRefresh.getTimeInMillis() - Calendar.getInstance().getTimeInMillis() < 120000)
+		if ((_manorRefresh.getTimeInMillis() - Calendar.getInstance().getTimeInMillis()) < 120000)
+		{
 			setNewManorRefresh();
 			setNewManorRefresh();
+		}
 		
 		
 		_log.info("Manor System: New Schedule for manor refresh @ " + _manorRefresh.getTime());
 		_log.info("Manor System: New Schedule for manor refresh @ " + _manorRefresh.getTime());
 		
 		
@@ -364,8 +380,10 @@ public class CastleManorManager
 	public long getMillisToNextPeriodApprove()
 	public long getMillisToNextPeriodApprove()
 	{
 	{
 		// use safe interval 120s to prevent double run
 		// use safe interval 120s to prevent double run
-		if (_periodApprove.getTimeInMillis() - Calendar.getInstance().getTimeInMillis() < 120000)
+		if ((_periodApprove.getTimeInMillis() - Calendar.getInstance().getTimeInMillis()) < 120000)
+		{
 			setNewPeriodApprove();
 			setNewPeriodApprove();
+		}
 		
 		
 		_log.info("Manor System: New Schedule for period approve @ " + _periodApprove.getTime());
 		_log.info("Manor System: New Schedule for period approve @ " + _periodApprove.getTime());
 		
 		
@@ -386,10 +404,14 @@ public class CastleManorManager
 		for (Castle c : CastleManager.getInstance().getCastles())
 		for (Castle c : CastleManager.getInstance().getCastles())
 		{
 		{
 			if (c.getOwnerId() <= 0)
 			if (c.getOwnerId() <= 0)
+			{
 				continue;
 				continue;
+			}
 			L2Clan clan = ClanTable.getInstance().getClan(c.getOwnerId());
 			L2Clan clan = ClanTable.getInstance().getClan(c.getOwnerId());
 			if (clan == null)
 			if (clan == null)
+			{
 				continue;
 				continue;
+			}
 			
 			
 			ItemContainer cwh = clan.getWarehouse();
 			ItemContainer cwh = clan.getWarehouse();
 			if (!(cwh instanceof ClanWarehouse))
 			if (!(cwh instanceof ClanWarehouse))
@@ -401,16 +423,20 @@ public class CastleManorManager
 			for (CropProcure crop : c.getCropProcure(PERIOD_CURRENT))
 			for (CropProcure crop : c.getCropProcure(PERIOD_CURRENT))
 			{
 			{
 				if (crop.getStartAmount() == 0)
 				if (crop.getStartAmount() == 0)
+				{
 					continue;
 					continue;
+				}
 				// adding bought crops to clan warehouse
 				// adding bought crops to clan warehouse
-				if (crop.getStartAmount() - crop.getAmount() > 0)
+				if ((crop.getStartAmount() - crop.getAmount()) > 0)
 				{
 				{
 					long count = crop.getStartAmount() - crop.getAmount();
 					long count = crop.getStartAmount() - crop.getAmount();
-					count = count * 90 / 100;
+					count = (count * 90) / 100;
 					if (count < 1)
 					if (count < 1)
 					{
 					{
 						if (Rnd.nextInt(99) < 90)
 						if (Rnd.nextInt(99) < 90)
+						{
 							count = 1;
 							count = 1;
+						}
 					}
 					}
 					if (count > 0)
 					if (count > 0)
 					{
 					{
@@ -460,7 +486,9 @@ public class CastleManorManager
 			L2PcInstance clanLeader = null;
 			L2PcInstance clanLeader = null;
 			clanLeader = L2World.getInstance().getPlayer(clan.getLeader().getName());
 			clanLeader = L2World.getInstance().getPlayer(clan.getLeader().getName());
 			if (clanLeader != null)
 			if (clanLeader != null)
+			{
 				clanLeader.sendPacket(SystemMessageId.THE_MANOR_INFORMATION_HAS_BEEN_UPDATED);
 				clanLeader.sendPacket(SystemMessageId.THE_MANOR_INFORMATION_HAS_BEEN_UPDATED);
+			}
 			
 			
 			c.setNextPeriodApproved(false);
 			c.setNextPeriodApproved(false);
 		}
 		}
@@ -480,10 +508,7 @@ public class CastleManorManager
 			else if (c.getTreasury() < c.getManorCost(PERIOD_NEXT))
 			else if (c.getTreasury() < c.getManorCost(PERIOD_NEXT))
 			{
 			{
 				notFunc = true;
 				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.setSeedProduction(getNewSeedsList(c.getCastleId()), PERIOD_NEXT);
 				c.setCropProcure(getNewCropsList(c.getCastleId()), PERIOD_NEXT);
 				c.setCropProcure(getNewCropsList(c.getCastleId()), PERIOD_NEXT);
 			}
 			}
@@ -501,16 +526,15 @@ public class CastleManorManager
 					if (crop.getStartAmount() > 0)
 					if (crop.getStartAmount() > 0)
 					{
 					{
 						if (cwh.getItemByItemId(ManorData.getInstance().getMatureCrop(crop.getId())) == null)
 						if (cwh.getItemByItemId(ManorData.getInstance().getMatureCrop(crop.getId())) == null)
+						{
 							slots++;
 							slots++;
+						}
 					}
 					}
 				}
 				}
 				if (!cwh.validateCapacity(slots))
 				if (!cwh.validateCapacity(slots))
 				{
 				{
 					notFunc = true;
 					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.setSeedProduction(getNewSeedsList(c.getCastleId()), PERIOD_NEXT);
 					c.setCropProcure(getNewCropsList(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());
 				L2Clan clan = ClanTable.getInstance().getClan(c.getOwnerId());
 				L2PcInstance clanLeader = null;
 				L2PcInstance clanLeader = null;
 				if (clan != null)
 				if (clan != null)
+				{
 					clanLeader = L2World.getInstance().getPlayer(clan.getLeaderId());
 					clanLeader = L2World.getInstance().getPlayer(clan.getLeaderId());
+				}
 				if (clanLeader != null)
 				if (clanLeader != null)
+				{
 					clanLeader.sendPacket(SystemMessageId.THE_AMOUNT_IS_NOT_SUFFICIENT_AND_SO_THE_MANOR_IS_NOT_IN_OPERATION);
 					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;
 import com.l2jserver.gameserver.model.zone.type.L2ClanHallZone;
 
 
 /**
 /**
- * @author  Steuf
+ * @author Steuf
  */
  */
 public final class ClanHallManager
 public final class ClanHallManager
 {
 {
 	protected static final Logger _log = Logger.getLogger(ClanHallManager.class.getName());
 	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 static Map<Integer, ClanHall> _allClanHalls = new FastMap<>();
 	private boolean _loaded = false;
 	private boolean _loaded = false;
 	
 	
-	public static ClanHallManager getInstance()
-	{
-		return SingletonHolder._instance;
-	}
-	
 	public boolean loaded()
 	public boolean loaded()
 	{
 	{
 		return _loaded;
 		return _loaded;
@@ -65,15 +60,6 @@ public final class ClanHallManager
 		load();
 		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 */
 	/** Load All Clan Hall */
 	private final void load()
 	private final void load()
 	{
 	{
@@ -87,9 +73,9 @@ public final class ClanHallManager
 				StatsSet set = new StatsSet();
 				StatsSet set = new StatsSet();
 				
 				
 				id = rs.getInt("id");
 				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("id", id);
 				set.set("name", rs.getString("name"));
 				set.set("name", rs.getString("name"));
 				set.set("ownerId", ownerId);
 				set.set("ownerId", ownerId);
@@ -111,8 +97,10 @@ public final class ClanHallManager
 				_freeClanHall.put(id, ch);
 				_freeClanHall.put(id, ch);
 				
 				
 				Auction auc = AuctionManager.getInstance().getAuction(id);
 				Auction auc = AuctionManager.getInstance().getAuction(id);
-				if (auc == null && lease > 0)
+				if ((auc == null) && (lease > 0))
+				{
 					AuctionManager.getInstance().initNPC(id);
 					AuctionManager.getInstance().initNPC(id);
+				}
 			}
 			}
 			
 			
 			rs.close();
 			rs.close();
@@ -131,7 +119,7 @@ public final class ClanHallManager
 	{
 	{
 		return _allClanHalls;
 		return _allClanHalls;
 	}
 	}
-
+	
 	/**
 	/**
 	 * @return all FreeClanHalls
 	 * @return all FreeClanHalls
 	 */
 	 */
@@ -160,20 +148,22 @@ public final class ClanHallManager
 	{
 	{
 		_allClanHalls.put(hall.getId(), hall);
 		_allClanHalls.put(hall.getId(), hall);
 	}
 	}
-
+	
 	/**
 	/**
-	 * @param chId 
+	 * @param chId
 	 * @return true is free ClanHall
 	 * @return true is free ClanHall
 	 */
 	 */
 	public final boolean isFree(int chId)
 	public final boolean isFree(int chId)
 	{
 	{
 		if (_freeClanHall.containsKey(chId))
 		if (_freeClanHall.containsKey(chId))
+		{
 			return true;
 			return true;
+		}
 		return false;
 		return false;
 	}
 	}
 	
 	
 	/**
 	/**
-	 * Free a ClanHall 
+	 * Free a ClanHall
 	 * @param chId
 	 * @param chId
 	 */
 	 */
 	public final synchronized void setFree(int chId)
 	public final synchronized void setFree(int chId)
@@ -186,7 +176,7 @@ public final class ClanHallManager
 	
 	
 	/**
 	/**
 	 * Set ClanHallOwner
 	 * Set ClanHallOwner
-	 * @param chId 
+	 * @param chId
 	 * @param clan
 	 * @param clan
 	 */
 	 */
 	public final synchronized void setOwner(int chId, L2Clan clan)
 	public final synchronized void setOwner(int chId, L2Clan clan)
@@ -197,13 +187,15 @@ public final class ClanHallManager
 			_freeClanHall.remove(chId);
 			_freeClanHall.remove(chId);
 		}
 		}
 		else
 		else
+		{
 			_clanHall.get(chId).free();
 			_clanHall.get(chId).free();
+		}
 		ClanTable.getInstance().getClan(clan.getClanId()).setHideoutId(chId);
 		ClanTable.getInstance().getClan(clan.getClanId()).setHideoutId(chId);
 		_clanHall.get(chId).setOwner(clan);
 		_clanHall.get(chId).setOwner(clan);
 	}
 	}
 	
 	
 	/**
 	/**
-	 * @param clanHallId 
+	 * @param clanHallId
 	 * @return Clan Hall by Id
 	 * @return Clan Hall by Id
 	 */
 	 */
 	public final ClanHall getClanHallById(int clanHallId)
 	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)
 	public final ClanHall getClanHall(int x, int y, int z)
 	{
 	{
 		for (ClanHall temp : getAllClanHalls().values())
 		for (ClanHall temp : getAllClanHalls().values())
 		{
 		{
 			if (temp.checkIfInZone(x, y, z))
 			if (temp.checkIfInZone(x, y, z))
+			{
 				return temp;
 				return temp;
+			}
 		}
 		}
 		return null;
 		return null;
 	}
 	}
@@ -244,14 +238,18 @@ public final class ClanHallManager
 		for (Map.Entry<Integer, AuctionableHall> ch : _clanHall.entrySet())
 		for (Map.Entry<Integer, AuctionableHall> ch : _clanHall.entrySet())
 		{
 		{
 			zone = ch.getValue().getZone();
 			zone = ch.getValue().getZone();
-			if (zone != null && zone.getDistanceToZone(x, y) < maxDist)
+			if ((zone != null) && (zone.getDistanceToZone(x, y) < maxDist))
+			{
 				return ch.getValue();
 				return ch.getValue();
+			}
 		}
 		}
 		for (Map.Entry<Integer, AuctionableHall> ch : _freeClanHall.entrySet())
 		for (Map.Entry<Integer, AuctionableHall> ch : _freeClanHall.entrySet())
 		{
 		{
 			zone = ch.getValue().getZone();
 			zone = ch.getValue().getZone();
-			if (zone != null && zone.getDistanceToZone(x, y) < maxDist)
+			if ((zone != null) && (zone.getDistanceToZone(x, y) < maxDist))
+			{
 				return ch.getValue();
 				return ch.getValue();
+			}
 		}
 		}
 		return null;
 		return null;
 	}
 	}
@@ -259,17 +257,19 @@ public final class ClanHallManager
 	public final ClanHall getNearbyAbstractHall(int x, int y, int maxDist)
 	public final ClanHall getNearbyAbstractHall(int x, int y, int maxDist)
 	{
 	{
 		L2ClanHallZone zone = null;
 		L2ClanHallZone zone = null;
-		for(Map.Entry<Integer, ClanHall> ch : _allClanHalls.entrySet())
+		for (Map.Entry<Integer, ClanHall> ch : _allClanHalls.entrySet())
 		{
 		{
 			zone = ch.getValue().getZone();
 			zone = ch.getValue().getZone();
-			if(zone != null && zone.getDistanceToZone(x, y) < maxDist)
+			if ((zone != null) && (zone.getDistanceToZone(x, y) < maxDist))
+			{
 				return ch.getValue();
 				return ch.getValue();
+			}
 		}
 		}
 		return null;
 		return null;
 	}
 	}
 	
 	
 	/**
 	/**
-	 * @param clan 
+	 * @param clan
 	 * @return Clan Hall by Owner
 	 * @return Clan Hall by Owner
 	 */
 	 */
 	public final AuctionableHall getClanHallByOwner(L2Clan clan)
 	public final AuctionableHall getClanHallByOwner(L2Clan clan)
@@ -277,7 +277,9 @@ public final class ClanHallManager
 		for (Map.Entry<Integer, AuctionableHall> ch : _clanHall.entrySet())
 		for (Map.Entry<Integer, AuctionableHall> ch : _clanHall.entrySet())
 		{
 		{
 			if (clan.getClanId() == ch.getValue().getOwnerId())
 			if (clan.getClanId() == ch.getValue().getOwnerId())
+			{
 				return ch.getValue();
 				return ch.getValue();
+			}
 		}
 		}
 		return null;
 		return null;
 	}
 	}
@@ -288,16 +290,25 @@ public final class ClanHallManager
 		for (Map.Entry<Integer, AuctionableHall> ch : _clanHall.entrySet())
 		for (Map.Entry<Integer, AuctionableHall> ch : _clanHall.entrySet())
 		{
 		{
 			if (clan.getClanId() == ch.getValue().getOwnerId())
 			if (clan.getClanId() == ch.getValue().getOwnerId())
+			{
 				return ch.getValue();
 				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 ch.getValue();
+			}
 		}
 		}
 		return null;
 		return null;
 	}
 	}
 	
 	
+	public static ClanHallManager getInstance()
+	{
+		return SingletonHolder._instance;
+	}
+	
 	private static class SingletonHolder
 	private static class SingletonHolder
 	{
 	{
 		protected static final ClanHallManager _instance = new ClanHallManager();
 		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
  * @author evill33t
- *
  */
  */
 public class CoupleManager
 public class CoupleManager
 {
 {
@@ -80,15 +79,17 @@ public class CoupleManager
 	{
 	{
 		int index = getCoupleIndex(coupleId);
 		int index = getCoupleIndex(coupleId);
 		if (index >= 0)
 		if (index >= 0)
+		{
 			return getCouples().get(index);
 			return getCouples().get(index);
+		}
 		return null;
 		return null;
 	}
 	}
 	
 	
 	public void createCouple(L2PcInstance player1, L2PcInstance player2)
 	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 _player1id = player1.getObjectId();
 				int _player2id = player2.getObjectId();
 				int _player2id = player2.getObjectId();
@@ -135,8 +136,10 @@ public class CoupleManager
 		int i = 0;
 		int i = 0;
 		for (Couple temp : getCouples())
 		for (Couple temp : getCouples())
 		{
 		{
-			if (temp != null && temp.getId() == coupleId)
+			if ((temp != null) && (temp.getId() == coupleId))
+			{
 				return i;
 				return i;
+			}
 			i++;
 			i++;
 		}
 		}
 		return -1;
 		return -1;
@@ -145,7 +148,9 @@ public class CoupleManager
 	public final FastList<Couple> getCouples()
 	public final FastList<Couple> getCouples()
 	{
 	{
 		if (_couples == null)
 		if (_couples == null)
+		{
 			_couples = new FastList<>();
 			_couples = new FastList<>();
+		}
 		return _couples;
 		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;
 import com.l2jserver.gameserver.util.Broadcast;
 
 
 /**
 /**
- * UnAfraid: TODO: Rewrite with DocumentParser 
+ * UnAfraid: TODO: Rewrite with DocumentParser
  * @author Micht
  * @author Micht
  */
  */
 public class CursedWeaponsManager
 public class CursedWeaponsManager
@@ -70,7 +70,9 @@ public class CursedWeaponsManager
 		_cursedWeapons = new HashMap<>();
 		_cursedWeapons = new HashMap<>();
 		
 		
 		if (!Config.ALLOW_CURSED_WEAPONS)
 		if (!Config.ALLOW_CURSED_WEAPONS)
+		{
 			return;
 			return;
+		}
 		
 		
 		load();
 		load();
 		restore();
 		restore();
@@ -200,12 +202,12 @@ public class CursedWeaponsManager
 	}
 	}
 	
 	
 	private final void controlPlayers()
 	private final void controlPlayers()
-	{		
+	{
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
 		{
 		{
 			// TODO: See comments below...
 			// TODO: See comments below...
 			// This entire for loop should NOT be necessary, since it is already handled by
 			// 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!
 			// 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
 			// 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...
 			// 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())
 				for (CursedWeapon cw : _cursedWeapons.values())
 				{
 				{
 					if (cw.isActivated())
 					if (cw.isActivated())
+					{
 						continue;
 						continue;
+					}
 					
 					
 					// Do an item check to be sure that the cursed weapon isn't hold by someone
 					// Do an item check to be sure that the cursed weapon isn't hold by someone
 					int itemId = cw.getItemId();
 					int itemId = cw.getItemId();
@@ -267,19 +271,22 @@ public class CursedWeaponsManager
 	
 	
 	public synchronized void checkDrop(L2Attackable attackable, L2PcInstance player)
 	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;
 			return;
+		}
 		
 		
 		for (CursedWeapon cw : _cursedWeapons.values())
 		for (CursedWeapon cw : _cursedWeapons.values())
 		{
 		{
 			if (cw.isActive())
 			if (cw.isActive())
+			{
 				continue;
 				continue;
+			}
 			
 			
 			if (cw.checkDrop(attackable, player))
 			if (cw.checkDrop(attackable, player))
+			{
 				break;
 				break;
+			}
 		}
 		}
 	}
 	}
 	
 	
@@ -289,14 +296,11 @@ public class CursedWeaponsManager
 		if (player.isCursedWeaponEquipped()) // cannot own 2 cursed swords
 		if (player.isCursedWeaponEquipped()) // cannot own 2 cursed swords
 		{
 		{
 			CursedWeapon cw2 = _cursedWeapons.get(player.getCursedWeaponEquippedId());
 			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.setNbKills(cw2.getStageKills() - 1);
 			cw2.increaseKills();
 			cw2.increaseKills();
 			
 			
@@ -305,7 +309,9 @@ public class CursedWeaponsManager
 			cw.endOfLife(); // expire the weapon and clean up.
 			cw.endOfLife(); // expire the weapon and clean up.
 		}
 		}
 		else
 		else
+		{
 			cw.activate(player, item);
 			cw.activate(player, item);
+		}
 	}
 	}
 	
 	
 	public void drop(int itemId, L2Character killer)
 	public void drop(int itemId, L2Character killer)
@@ -337,11 +343,13 @@ public class CursedWeaponsManager
 	public void checkPlayer(L2PcInstance player)
 	public void checkPlayer(L2PcInstance player)
 	{
 	{
 		if (player == null)
 		if (player == null)
+		{
 			return;
 			return;
+		}
 		
 		
 		for (CursedWeapon cw : _cursedWeapons.values())
 		for (CursedWeapon cw : _cursedWeapons.values())
 		{
 		{
-			if (cw.isActivated() && player.getObjectId() == cw.getPlayerId())
+			if (cw.isActivated() && (player.getObjectId() == cw.getPlayerId()))
 			{
 			{
 				cw.setPlayer(player);
 				cw.setPlayer(player);
 				cw.setItem(player.getInventory().getItemByItemId(cw.getItemId()));
 				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);
 				SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_MINUTE_OF_USAGE_TIME_ARE_LEFT_FOR_S1);
 				sm.addString(cw.getName());
 				sm.addString(cw.getName());
-				//sm.addItemName(cw.getItemId());
+				// sm.addItemName(cw.getItemId());
 				sm.addNumber((int) ((cw.getEndTime() - System.currentTimeMillis()) / 60000));
 				sm.addNumber((int) ((cw.getEndTime() - System.currentTimeMillis()) / 60000));
 				player.sendPacket(sm);
 				player.sendPacket(sm);
 			}
 			}
@@ -360,8 +368,12 @@ public class CursedWeaponsManager
 	public int checkOwnsWeaponId(int ownerId)
 	public int checkOwnsWeaponId(int ownerId)
 	{
 	{
 		for (CursedWeapon cw : _cursedWeapons.values())
 		for (CursedWeapon cw : _cursedWeapons.values())
-			if (cw.isActivated() && ownerId == cw.getPlayerId())
+		{
+			if (cw.isActivated() && (ownerId == cw.getPlayerId()))
+			{
 				return cw.getItemId();
 				return cw.getItemId();
+			}
+		}
 		return -1;
 		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;
 import com.l2jserver.gameserver.model.actor.instance.L2RaidBossInstance;
 
 
 /**
 /**
- * @author  godson
+ * @author godson
  */
  */
 public class DayNightSpawnManager
 public class DayNightSpawnManager
 {
 {
 	
 	
 	private static Logger _log = Logger.getLogger(DayNightSpawnManager.class.getName());
 	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()
 	public static DayNightSpawnManager getInstance()
 	{
 	{
@@ -50,7 +50,7 @@ public class DayNightSpawnManager
 	{
 	{
 		_dayCreatures = new ArrayList<>();
 		_dayCreatures = new ArrayList<>();
 		_nightCreatures = new ArrayList<>();
 		_nightCreatures = new ArrayList<>();
-		_bosses = new FastMap<>();		
+		_bosses = new FastMap<>();
 	}
 	}
 	
 	
 	public void addDayCreature(L2Spawn spawnDat)
 	public void addDayCreature(L2Spawn spawnDat)
@@ -86,18 +86,19 @@ public class DayNightSpawnManager
 	 * @param UnspawnLogInfo String for log info for unspawned L2NpcInstance
 	 * @param UnspawnLogInfo String for log info for unspawned L2NpcInstance
 	 * @param SpawnLogInfo String for log info for spawned 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
 		try
 		{
 		{
 			if (!unSpawnCreatures.isEmpty())
 			if (!unSpawnCreatures.isEmpty())
 			{
 			{
 				int i = 0;
 				int i = 0;
-				for (L2Spawn spawn: unSpawnCreatures)
+				for (L2Spawn spawn : unSpawnCreatures)
 				{
 				{
 					if (spawn == null)
 					if (spawn == null)
+					{
 						continue;
 						continue;
+					}
 					
 					
 					spawn.stopRespawn();
 					spawn.stopRespawn();
 					L2Npc last = spawn.getLastSpawn();
 					L2Npc last = spawn.getLastSpawn();
@@ -114,7 +115,9 @@ public class DayNightSpawnManager
 			for (L2Spawn spawnDat : spawnCreatures)
 			for (L2Spawn spawnDat : spawnCreatures)
 			{
 			{
 				if (spawnDat == null)
 				if (spawnDat == null)
+				{
 					continue;
 					continue;
+				}
 				spawnDat.startRespawn();
 				spawnDat.startRespawn();
 				spawnDat.doSpawn();
 				spawnDat.doSpawn();
 				i++;
 				i++;
@@ -131,7 +134,9 @@ public class DayNightSpawnManager
 	private void changeMode(int mode)
 	private void changeMode(int mode)
 	{
 	{
 		if (_nightCreatures.isEmpty() && _dayCreatures.isEmpty())
 		if (_nightCreatures.isEmpty() && _dayCreatures.isEmpty())
+		{
 			return;
 			return;
+		}
 		
 		
 		switch (mode)
 		switch (mode)
 		{
 		{
@@ -151,8 +156,8 @@ public class DayNightSpawnManager
 	
 	
 	public DayNightSpawnManager trim()
 	public DayNightSpawnManager trim()
 	{
 	{
-		((ArrayList<?>)_nightCreatures).trimToSize();
-		((ArrayList<?>)_dayCreatures).trimToSize();
+		((ArrayList<?>) _nightCreatures).trimToSize();
+		((ArrayList<?>) _dayCreatures).trimToSize();
 		return this;
 		return this;
 	}
 	}
 	
 	
@@ -161,9 +166,13 @@ public class DayNightSpawnManager
 		try
 		try
 		{
 		{
 			if (GameTimeController.getInstance().isNowNight())
 			if (GameTimeController.getInstance().isNowNight())
+			{
 				changeMode(1);
 				changeMode(1);
+			}
 			else
 			else
+			{
 				changeMode(0);
 				changeMode(0);
+			}
 		}
 		}
 		catch (Exception e)
 		catch (Exception e)
 		{
 		{
@@ -201,7 +210,9 @@ public class DayNightSpawnManager
 				}
 				}
 				
 				
 				if ((boss != null) && (boss.getNpcId() == 25328) && boss.getRaidStatus().equals(RaidBossSpawnManager.StatusEnum.ALIVE))
 				if ((boss != null) && (boss.getNpcId() == 25328) && boss.getRaidStatus().equals(RaidBossSpawnManager.StatusEnum.ALIVE))
+				{
 					handleHellmans(boss, mode);
 					handleHellmans(boss, mode);
+				}
 				return;
 				return;
 			}
 			}
 		}
 		}
@@ -229,7 +240,9 @@ public class DayNightSpawnManager
 	public L2RaidBossInstance handleBoss(L2Spawn spawnDat)
 	public L2RaidBossInstance handleBoss(L2Spawn spawnDat)
 	{
 	{
 		if (_bosses.containsKey(spawnDat))
 		if (_bosses.containsKey(spawnDat))
+		{
 			return _bosses.get(spawnDat);
 			return _bosses.get(spawnDat);
+		}
 		
 		
 		if (GameTimeController.getInstance().isNowNight())
 		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;
 package com.l2jserver.gameserver.instancemanager;
 
 
-import gnu.trove.map.hash.TByteObjectHashMap;
-
 import java.awt.Polygon;
 import java.awt.Polygon;
 import java.awt.Shape;
 import java.awt.Shape;
 import java.io.File;
 import java.io.File;
@@ -48,6 +46,8 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
 import com.l2jserver.gameserver.util.Util;
 import com.l2jserver.gameserver.util.Util;
 import com.l2jserver.util.Rnd;
 import com.l2jserver.util.Rnd;
 
 
+import gnu.trove.map.hash.TByteObjectHashMap;
+
 /**
 /**
  * Thanks to L2Fortress and balancer.ru - kombat
  * Thanks to L2Fortress and balancer.ru - kombat
  */
  */
@@ -88,7 +88,7 @@ public class DimensionalRiftManager
 				byte type = rs.getByte("type");
 				byte type = rs.getByte("type");
 				byte room_id = rs.getByte("room_id");
 				byte room_id = rs.getByte("room_id");
 				
 				
-				//coords related
+				// coords related
 				int xMin = rs.getInt("xMin");
 				int xMin = rs.getInt("xMin");
 				int xMax = rs.getInt("xMax");
 				int xMax = rs.getInt("xMax");
 				int yMin = rs.getInt("yMin");
 				int yMin = rs.getInt("yMin");
@@ -101,7 +101,9 @@ public class DimensionalRiftManager
 				boolean isBossRoom = rs.getByte("boss") > 0;
 				boolean isBossRoom = rs.getByte("boss") > 0;
 				
 				
 				if (!_rooms.containsKey(type))
 				if (!_rooms.containsKey(type))
+				{
 					_rooms.put(type, new TByteObjectHashMap<DimensionalRiftRoom>(9));
 					_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));
 				_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;
 		int roomSize = 0;
 		
 		
 		for (byte b : _rooms.keys())
 		for (byte b : _rooms.keys())
+		{
 			roomSize += _rooms.get(b).keys().length;
 			roomSize += _rooms.get(b).keys().length;
+		}
 		
 		
 		_log.info(getClass().getSimpleName() + ": Loaded " + typeSize + " room types with " + roomSize + " rooms.");
 		_log.info(getClass().getSimpleName() + ": Loaded " + typeSize + " room types with " + roomSize + " rooms.");
 	}
 	}
@@ -194,7 +198,7 @@ public class DimensionalRiftManager
 												y = riftRoom.getRandomY();
 												y = riftRoom.getRandomY();
 												z = riftRoom.getTeleportCoords()[2];
 												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 = new L2Spawn(template);
 													spawnDat.setAmount(1);
 													spawnDat.setAmount(1);
@@ -246,7 +250,9 @@ public class DimensionalRiftManager
 	public boolean checkIfInRiftZone(int x, int y, int z, boolean ignorePeaceZone)
 	public boolean checkIfInRiftZone(int x, int y, int z, boolean ignorePeaceZone)
 	{
 	{
 		if (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);
+		}
 		
 		
 		return _rooms.get((byte) 0).get((byte) 1).checkIfInZone(x, y, z) && !_rooms.get((byte) 0).get((byte) 0).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())
 		for (L2PcInstance p : player.getParty().getMembers())
+		{
 			if (!checkIfInPeaceZone(p.getX(), p.getY(), p.getZ()))
 			if (!checkIfInPeaceZone(p.getX(), p.getY(), p.getZ()))
 			{
 			{
 				canPass = false;
 				canPass = false;
 				break;
 				break;
 			}
 			}
+		}
 		
 		
 		if (!canPass)
 		if (!canPass)
 		{
 		{
@@ -369,7 +377,7 @@ public class DimensionalRiftManager
 		do
 		do
 		{
 		{
 			emptyRooms = getFreeRooms(type);
 			emptyRooms = getFreeRooms(type);
-			room = emptyRooms.get(Rnd.get(1, emptyRooms.size())-1);
+			room = emptyRooms.get(Rnd.get(1, emptyRooms.size()) - 1);
 		}
 		}
 		// find empty room
 		// find empty room
 		while (_rooms.get(type).get(room).ispartyInside());
 		while (_rooms.get(type).get(room).ispartyInside());
@@ -379,19 +387,27 @@ public class DimensionalRiftManager
 	public void killRift(DimensionalRift d)
 	public void killRift(DimensionalRift d)
 	{
 	{
 		if (d.getTeleportTimerTask() != null)
 		if (d.getTeleportTimerTask() != null)
+		{
 			d.getTeleportTimerTask().cancel();
 			d.getTeleportTimerTask().cancel();
+		}
 		d.setTeleportTimerTask(null);
 		d.setTeleportTimerTask(null);
 		
 		
 		if (d.getTeleportTimer() != null)
 		if (d.getTeleportTimer() != null)
+		{
 			d.getTeleportTimer().cancel();
 			d.getTeleportTimer().cancel();
+		}
 		d.setTeleportTimer(null);
 		d.setTeleportTimer(null);
 		
 		
 		if (d.getSpawnTimerTask() != null)
 		if (d.getSpawnTimerTask() != null)
+		{
 			d.getSpawnTimerTask().cancel();
 			d.getSpawnTimerTask().cancel();
+		}
 		d.setSpawnTimerTask(null);
 		d.setSpawnTimerTask(null);
 		
 		
 		if (d.getSpawnTimer() != null)
 		if (d.getSpawnTimer() != null)
+		{
 			d.getSpawnTimer().cancel();
 			d.getSpawnTimer().cancel();
+		}
 		d.setSpawnTimer(null);
 		d.setSpawnTimer(null);
 	}
 	}
 	
 	
@@ -412,8 +428,7 @@ public class DimensionalRiftManager
 		protected final FastList<L2Npc> _roomMobs;
 		protected final FastList<L2Npc> _roomMobs;
 		private boolean _partyInside = false;
 		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;
 			_type = type;
 			_room = room;
 			_room = room;
@@ -423,11 +438,28 @@ public class DimensionalRiftManager
 			_yMax = (yMax - 128);
 			_yMax = (yMax - 128);
 			_zMin = zMin;
 			_zMin = zMin;
 			_zMax = zMax;
 			_zMax = zMax;
-			_teleportCoords = new int[] { xT, yT, zT };
+			_teleportCoords = new int[]
+			{
+				xT,
+				yT,
+				zT
+			};
 			_isBossRoom = isBossRoom;
 			_isBossRoom = isBossRoom;
 			_roomSpawns = new FastList<>();
 			_roomSpawns = new FastList<>();
 			_roomMobs = 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()
 		public int getRandomX()
@@ -447,7 +479,7 @@ public class DimensionalRiftManager
 		
 		
 		public boolean checkIfInZone(int x, int y, int z)
 		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()
 		public boolean isBossRoom()
@@ -475,7 +507,9 @@ public class DimensionalRiftManager
 			{
 			{
 				spawn.stopRespawn();
 				spawn.stopRespawn();
 				if (spawn.getLastSpawn() != null)
 				if (spawn.getLastSpawn() != null)
+				{
 					spawn.getLastSpawn().deleteMe();
 					spawn.getLastSpawn().deleteMe();
+				}
 			}
 			}
 			return this;
 			return this;
 		}
 		}
@@ -539,7 +573,9 @@ public class DimensionalRiftManager
 		for (DimensionalRiftRoom room : _rooms.get(type).valueCollection())
 		for (DimensionalRiftRoom room : _rooms.get(type).valueCollection())
 		{
 		{
 			if (room.ispartyInside())
 			if (room.ispartyInside())
+			{
 				count++;
 				count++;
+			}
 		}
 		}
 		return (count < (_rooms.get(type).size() - 1));
 		return (count < (_rooms.get(type).size() - 1));
 	}
 	}
@@ -550,7 +586,9 @@ public class DimensionalRiftManager
 		for (DimensionalRiftRoom room : _rooms.get(type).valueCollection())
 		for (DimensionalRiftRoom room : _rooms.get(type).valueCollection())
 		{
 		{
 			if (!room.ispartyInside())
 			if (!room.ispartyInside())
+			{
 				list.add(room._room);
 				list.add(room._room);
+			}
 		}
 		}
 		return list;
 		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;
 import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
 
 
 public class DuelManager
 public class DuelManager
-{	
-	private FastList<Duel> _duels;
+{
+	private final FastList<Duel> _duels;
 	private int _currentDuelId = 0x90;
 	private int _currentDuelId = 0x90;
 	
 	
 	protected DuelManager()
 	protected DuelManager()
@@ -35,7 +35,9 @@ public class DuelManager
 	{
 	{
 		// In case someone wants to run the server forever :)
 		// In case someone wants to run the server forever :)
 		if (++_currentDuelId >= 2147483640)
 		if (++_currentDuelId >= 2147483640)
+		{
 			_currentDuelId = 1;
 			_currentDuelId = 1;
+		}
 		return _currentDuelId;
 		return _currentDuelId;
 	}
 	}
 	
 	
@@ -44,15 +46,19 @@ public class DuelManager
 		for (FastList.Node<Duel> e = _duels.head(), end = _duels.tail(); (e = e.getNext()) != end;)
 		for (FastList.Node<Duel> e = _duels.head(), end = _duels.tail(); (e = e.getNext()) != end;)
 		{
 		{
 			if (e.getValue().getId() == duelId)
 			if (e.getValue().getId() == duelId)
+			{
 				return e.getValue();
 				return e.getValue();
+			}
 		}
 		}
 		return null;
 		return null;
 	}
 	}
 	
 	
 	public void addDuel(L2PcInstance playerA, L2PcInstance playerB, int partyDuel)
 	public void addDuel(L2PcInstance playerA, L2PcInstance playerB, int partyDuel)
 	{
 	{
-		if (playerA == null || playerB == null)
+		if ((playerA == null) || (playerB == null))
+		{
 			return;
 			return;
+		}
 		
 		
 		// return if a player has PvPFlag
 		// return if a player has PvPFlag
 		String engagedInPvP = "The duel was canceled because a duelist engaged in PvP combat.";
 		String engagedInPvP = "The duel was canceled because a duelist engaged in PvP combat.";
@@ -94,7 +100,7 @@ public class DuelManager
 		}
 		}
 		else
 		else
 		{
 		{
-			if (playerA.getPvpFlag() != 0 || playerB.getPvpFlag() != 0)
+			if ((playerA.getPvpFlag() != 0) || (playerB.getPvpFlag() != 0))
 			{
 			{
 				playerA.sendMessage(engagedInPvP);
 				playerA.sendMessage(engagedInPvP);
 				playerB.sendMessage(engagedInPvP);
 				playerB.sendMessage(engagedInPvP);
@@ -113,8 +119,10 @@ public class DuelManager
 	
 	
 	public void doSurrender(L2PcInstance player)
 	public void doSurrender(L2PcInstance player)
 	{
 	{
-		if (player == null || !player.isInDuel())
+		if ((player == null) || !player.isInDuel())
+		{
 			return;
 			return;
+		}
 		Duel duel = getDuel(player.getDuelId());
 		Duel duel = getDuel(player.getDuelId());
 		duel.doSurrender(player);
 		duel.doSurrender(player);
 	}
 	}
@@ -125,11 +133,15 @@ public class DuelManager
 	 */
 	 */
 	public void onPlayerDefeat(L2PcInstance player)
 	public void onPlayerDefeat(L2PcInstance player)
 	{
 	{
-		if (player == null || !player.isInDuel())
+		if ((player == null) || !player.isInDuel())
+		{
 			return;
 			return;
+		}
 		Duel duel = getDuel(player.getDuelId());
 		Duel duel = getDuel(player.getDuelId());
 		if (duel != null)
 		if (duel != null)
+		{
 			duel.onPlayerDefeat(player);
 			duel.onPlayerDefeat(player);
+		}
 	}
 	}
 	
 	
 	/**
 	/**
@@ -139,11 +151,15 @@ public class DuelManager
 	 */
 	 */
 	public void onBuff(L2PcInstance player, L2Effect buff)
 	public void onBuff(L2PcInstance player, L2Effect buff)
 	{
 	{
-		if (player == null || !player.isInDuel() || buff == null)
+		if ((player == null) || !player.isInDuel() || (buff == null))
+		{
 			return;
 			return;
+		}
 		Duel duel = getDuel(player.getDuelId());
 		Duel duel = getDuel(player.getDuelId());
 		if (duel != null)
 		if (duel != null)
+		{
 			duel.onBuff(player, buff);
 			duel.onBuff(player, buff);
+		}
 	}
 	}
 	
 	
 	/**
 	/**
@@ -152,11 +168,15 @@ public class DuelManager
 	 */
 	 */
 	public void onRemoveFromParty(L2PcInstance player)
 	public void onRemoveFromParty(L2PcInstance player)
 	{
 	{
-		if (player == null || !player.isInDuel())
+		if ((player == null) || !player.isInDuel())
+		{
 			return;
 			return;
+		}
 		Duel duel = getDuel(player.getDuelId());
 		Duel duel = getDuel(player.getDuelId());
 		if (duel != null)
 		if (duel != null)
+		{
 			duel.onRemoveFromParty(player);
 			duel.onRemoveFromParty(player);
+		}
 	}
 	}
 	
 	
 	/**
 	/**
@@ -166,13 +186,19 @@ public class DuelManager
 	 */
 	 */
 	public void broadcastToOppositTeam(L2PcInstance player, L2GameServerPacket packet)
 	public void broadcastToOppositTeam(L2PcInstance player, L2GameServerPacket packet)
 	{
 	{
-		if (player == null || !player.isInDuel())
+		if ((player == null) || !player.isInDuel())
+		{
 			return;
 			return;
+		}
 		Duel duel = getDuel(player.getDuelId());
 		Duel duel = getDuel(player.getDuelId());
 		if (duel == null)
 		if (duel == null)
+		{
 			return;
 			return;
-		if (duel.getPlayerA() == null || duel.getPlayerB() == null)
+		}
+		if ((duel.getPlayerA() == null) || (duel.getPlayerB() == null))
+		{
 			return;
 			return;
+		}
 		
 		
 		if (duel.getPlayerA() == player)
 		if (duel.getPlayerA() == player)
 		{
 		{
@@ -184,11 +210,11 @@ public class DuelManager
 		}
 		}
 		else if (duel.isPartyDuel())
 		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);
 				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);
 				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);
 				fort = getForts().get(i);
 				if (fort == null)
 				if (fort == null)
+				{
 					continue;
 					continue;
+				}
 				distance = fort.getDistance(obj);
 				distance = fort.getDistance(obj);
 				if (maxDistance > distance)
 				if (maxDistance > distance)
 				{
 				{
@@ -73,7 +75,9 @@ public class FortManager implements InstanceListManager
 		for (Fort f : getForts())
 		for (Fort f : getForts())
 		{
 		{
 			if (f.getFortId() == fortId)
 			if (f.getFortId() == fortId)
+			{
 				return f;
 				return f;
+			}
 		}
 		}
 		return null;
 		return null;
 	}
 	}
@@ -83,7 +87,9 @@ public class FortManager implements InstanceListManager
 		for (Fort f : getForts())
 		for (Fort f : getForts())
 		{
 		{
 			if (f.getOwnerClan() == clan)
 			if (f.getOwnerClan() == clan)
+			{
 				return f;
 				return f;
+			}
 		}
 		}
 		return null;
 		return null;
 	}
 	}
@@ -93,7 +99,9 @@ public class FortManager implements InstanceListManager
 		for (Fort f : getForts())
 		for (Fort f : getForts())
 		{
 		{
 			if (f.getName().equalsIgnoreCase(name.trim()))
 			if (f.getName().equalsIgnoreCase(name.trim()))
+			{
 				return f;
 				return f;
+			}
 		}
 		}
 		return null;
 		return null;
 	}
 	}
@@ -103,7 +111,9 @@ public class FortManager implements InstanceListManager
 		for (Fort f : getForts())
 		for (Fort f : getForts())
 		{
 		{
 			if (f.checkIfInZone(x, y, z))
 			if (f.checkIfInZone(x, y, z))
+			{
 				return f;
 				return f;
+			}
 		}
 		}
 		return null;
 		return null;
 	}
 	}
@@ -119,8 +129,10 @@ public class FortManager implements InstanceListManager
 		for (int i = 0; i < getForts().size(); i++)
 		for (int i = 0; i < getForts().size(); i++)
 		{
 		{
 			fort = getForts().get(i);
 			fort = getForts().get(i);
-			if (fort != null && fort.getFortId() == fortId)
+			if ((fort != null) && (fort.getFortId() == fortId))
+			{
 				return i;
 				return i;
+			}
 		}
 		}
 		return -1;
 		return -1;
 	}
 	}
@@ -136,8 +148,10 @@ public class FortManager implements InstanceListManager
 		for (int i = 0; i < getForts().size(); i++)
 		for (int i = 0; i < getForts().size(); i++)
 		{
 		{
 			fort = getForts().get(i);
 			fort = getForts().get(i);
-			if (fort != null && fort.checkIfInZone(x, y, z))
+			if ((fort != null) && fort.checkIfInZone(x, y, z))
+			{
 				return i;
 				return i;
+			}
 		}
 		}
 		return -1;
 		return -1;
 	}
 	}
@@ -145,7 +159,9 @@ public class FortManager implements InstanceListManager
 	public final List<Fort> getForts()
 	public final List<Fort> getForts()
 	{
 	{
 		if (_forts == null)
 		if (_forts == null)
+		{
 			_forts = new FastList<>();
 			_forts = new FastList<>();
+		}
 		return _forts;
 		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 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 FastMap<Integer, FastList<L2Spawn>> _siegeGuards = new FastMap<>();
 	protected FastList<L2Spawn> _siegeGuardsSpawns;
 	protected FastList<L2Spawn> _siegeGuardsSpawns;
 	
 	
@@ -44,7 +44,7 @@ public class FortSiegeGuardManager
 	}
 	}
 	
 	
 	/**
 	/**
-	 * Spawn guards.<BR><BR>
+	 * Spawn guards.
 	 */
 	 */
 	public void spawnSiegeGuard()
 	public void spawnSiegeGuard()
 	{
 	{
@@ -57,9 +57,13 @@ public class FortSiegeGuardManager
 				{
 				{
 					spawnDat.doSpawn();
 					spawnDat.doSpawn();
 					if (spawnDat.getLastSpawn() instanceof L2FortBallistaInstance)
 					if (spawnDat.getLastSpawn() instanceof L2FortBallistaInstance)
+					{
 						spawnDat.stopRespawn();
 						spawnDat.stopRespawn();
+					}
 					else
 					else
+					{
 						spawnDat.startRespawn();
 						spawnDat.startRespawn();
+					}
 				}
 				}
 			}
 			}
 		}
 		}
@@ -70,7 +74,7 @@ public class FortSiegeGuardManager
 	}
 	}
 	
 	
 	/**
 	/**
-	 * Unspawn guards.<BR><BR>
+	 * Unspawn guards.
 	 */
 	 */
 	public void unspawnSiegeGuard()
 	public void unspawnSiegeGuard()
 	{
 	{
@@ -84,7 +88,9 @@ public class FortSiegeGuardManager
 				{
 				{
 					spawnDat.stopRespawn();
 					spawnDat.stopRespawn();
 					if (spawnDat.getLastSpawn() != null)
 					if (spawnDat.getLastSpawn() != null)
+					{
 						spawnDat.getLastSpawn().doDie(spawnDat.getLastSpawn());
 						spawnDat.getLastSpawn().doDie(spawnDat.getLastSpawn());
+					}
 				}
 				}
 			}
 			}
 		}
 		}
@@ -95,7 +101,7 @@ public class FortSiegeGuardManager
 	}
 	}
 	
 	
 	/**
 	/**
-	 * Load guards.<BR><BR>
+	 * Load guards.
 	 */
 	 */
 	void loadSiegeGuard()
 	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 activeChar The L2Character of the character can summon
-	 * @param isCheckOnly 
+	 * @param isCheckOnly
 	 * @return true if character summon
 	 * @return true if character summon
 	 */
 	 */
 	public final boolean checkIfOkToSummon(L2Character activeChar, boolean isCheckOnly)
 	public final boolean checkIfOkToSummon(L2Character activeChar, boolean isCheckOnly)
 	{
 	{
 		if (!(activeChar instanceof L2PcInstance))
 		if (!(activeChar instanceof L2PcInstance))
+		{
 			return false;
 			return false;
+		}
 		
 		
 		String text = "";
 		String text = "";
 		L2PcInstance player = (L2PcInstance) activeChar;
 		L2PcInstance player = (L2PcInstance) activeChar;
 		Fort fort = FortManager.getInstance().getFort(player);
 		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";
 			text = "You must be on fort ground to summon this";
+		}
 		else if (!fort.getSiege().getIsInProgress())
 		else if (!fort.getSiege().getIsInProgress())
+		{
 			text = "You can only summon this during a siege.";
 			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.";
 			text = "You can only summon this as a registered attacker.";
+		}
 		else
 		else
+		{
 			return true;
 			return true;
+		}
 		
 		
 		if (!isCheckOnly)
 		if (!isCheckOnly)
+		{
 			player.sendMessage(text);
 			player.sendMessage(text);
+		}
 		return false;
 		return false;
 	}
 	}
 	
 	
 	/**
 	/**
 	 * @param clan The L2Clan of the player
 	 * @param clan The L2Clan of the player
-	 * @param fortid 
+	 * @param fortid
 	 * @return true if the clan is registered or owner of a fort
 	 * @return true if the clan is registered or owner of a fort
 	 */
 	 */
 	public final boolean checkIsRegistered(L2Clan clan, int fortid)
 	public final boolean checkIsRegistered(L2Clan clan, int fortid)
 	{
 	{
 		if (clan == null)
 		if (clan == null)
+		{
 			return false;
 			return false;
+		}
 		
 		
 		boolean register = false;
 		boolean register = false;
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
@@ -177,7 +191,9 @@ public class FortSiegeManager
 			{
 			{
 				String _spawnParams = siegeSettings.getProperty(fort.getName().replace(" ", "") + "Commander" + i, "");
 				String _spawnParams = siegeSettings.getProperty(fort.getName().replace(" ", "") + "Commander" + i, "");
 				if (_spawnParams.isEmpty())
 				if (_spawnParams.isEmpty())
+				{
 					break;
 					break;
+				}
 				StringTokenizer st = new StringTokenizer(_spawnParams.trim(), ",");
 				StringTokenizer st = new StringTokenizer(_spawnParams.trim(), ",");
 				
 				
 				try
 				try
@@ -202,7 +218,9 @@ public class FortSiegeManager
 			{
 			{
 				String _spawnParams = siegeSettings.getProperty(fort.getName().replace(" ", "") + "Flag" + i, "");
 				String _spawnParams = siegeSettings.getProperty(fort.getName().replace(" ", "") + "Flag" + i, "");
 				if (_spawnParams.isEmpty())
 				if (_spawnParams.isEmpty())
+				{
 					break;
 					break;
+				}
 				StringTokenizer st = new StringTokenizer(_spawnParams.trim(), ",");
 				StringTokenizer st = new StringTokenizer(_spawnParams.trim(), ",");
 				
 				
 				try
 				try
@@ -235,7 +253,9 @@ public class FortSiegeManager
 	public final FastList<CombatFlag> getFlagList(int _fortId)
 	public final FastList<CombatFlag> getFlagList(int _fortId)
 	{
 	{
 		if (_flagList.containsKey(_fortId))
 		if (_flagList.containsKey(_fortId))
+		{
 			return _flagList.get(_fortId);
 			return _flagList.get(_fortId);
+		}
 		return null;
 		return null;
 	}
 	}
 	
 	
@@ -262,8 +282,12 @@ public class FortSiegeManager
 	public final FortSiege getSiege(int x, int y, int z)
 	public final FortSiege getSiege(int x, int y, int z)
 	{
 	{
 		for (Fort fort : FortManager.getInstance().getForts())
 		for (Fort fort : FortManager.getInstance().getForts())
+		{
 			if (fort.getSiege().checkIfInZone(x, y, z))
 			if (fort.getSiege().checkIfInZone(x, y, z))
+			{
 				return fort.getSiege();
 				return fort.getSiege();
+			}
+		}
 		return null;
 		return null;
 	}
 	}
 	
 	
@@ -285,14 +309,18 @@ public class FortSiegeManager
 	public final List<FortSiege> getSieges()
 	public final List<FortSiege> getSieges()
 	{
 	{
 		if (_sieges == null)
 		if (_sieges == null)
+		{
 			_sieges = new FastList<>();
 			_sieges = new FastList<>();
+		}
 		return _sieges;
 		return _sieges;
 	}
 	}
 	
 	
 	public final void addSiege(FortSiege fortSiege)
 	public final void addSiege(FortSiege fortSiege)
 	{
 	{
 		if (_sieges == null)
 		if (_sieges == null)
+		{
 			_sieges = new FastList<>();
 			_sieges = new FastList<>();
+		}
 		_sieges.add(fortSiege);
 		_sieges.add(fortSiege);
 	}
 	}
 	
 	
@@ -304,7 +332,9 @@ public class FortSiegeManager
 	public boolean activateCombatFlag(L2PcInstance player, L2ItemInstance item)
 	public boolean activateCombatFlag(L2PcInstance player, L2ItemInstance item)
 	{
 	{
 		if (!checkIfCanPickup(player))
 		if (!checkIfCanPickup(player))
+		{
 			return false;
 			return false;
+		}
 		
 		
 		Fort fort = FortManager.getInstance().getFort(player);
 		Fort fort = FortManager.getInstance().getFort(player);
 		
 		
@@ -335,7 +365,7 @@ public class FortSiegeManager
 		// here check if is siege is attacker
 		// here check if is siege is attacker
 		Fort fort = FortManager.getInstance().getFort(player);
 		Fort fort = FortManager.getInstance().getFort(player);
 		
 		
-		if (fort == null || fort.getFortId() <= 0)
+		if ((fort == null) || (fort.getFortId() <= 0))
 		{
 		{
 			player.sendPacket(sm);
 			player.sendPacket(sm);
 			return false;
 			return false;
@@ -365,7 +395,9 @@ public class FortSiegeManager
 			{
 			{
 				cf.dropIt();
 				cf.dropIt();
 				if (fort.getSiege().getIsInProgress())
 				if (fort.getSiege().getIsInProgress())
+				{
 					cf.spawnMe();
 					cf.spawnMe();
+				}
 			}
 			}
 		}
 		}
 	}
 	}
@@ -373,10 +405,10 @@ public class FortSiegeManager
 	public static class SiegeSpawn
 	public static class SiegeSpawn
 	{
 	{
 		Location _location;
 		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)
 		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;
 package com.l2jserver.gameserver.instancemanager;
 
 
-import gnu.trove.map.hash.TIntIntHashMap;
-import gnu.trove.map.hash.TIntObjectHashMap;
-
 import java.sql.Connection;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.ResultSet;
@@ -52,9 +49,12 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
 import com.l2jserver.gameserver.util.Util;
 import com.l2jserver.gameserver.util.Util;
 import com.l2jserver.util.Rnd;
 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
  * @author sandman
- * 
  */
  */
 public class FourSepulchersManager
 public class FourSepulchersManager
 {
 {
@@ -79,43 +79,48 @@ public class FourSepulchersManager
 	protected ScheduledFuture<?> _changeAttackTimeTask = null;
 	protected ScheduledFuture<?> _changeAttackTimeTask = null;
 	protected ScheduledFuture<?> _onPartyAnnihilatedTask = 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> _archonSpawned = new FastMap<>();
 	protected FastMap<Integer, Boolean> _hallInUse = new FastMap<>();
 	protected FastMap<Integer, Boolean> _hallInUse = new FastMap<>();
 	protected FastMap<Integer, L2PcInstance> _challengers = 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 _hallGateKeepers = new TIntIntHashMap();
 	protected TIntIntHashMap _keyBoxNpc = new TIntIntHashMap();
 	protected TIntIntHashMap _keyBoxNpc = new TIntIntHashMap();
 	protected TIntIntHashMap _victim = new TIntIntHashMap();
 	protected TIntIntHashMap _victim = new TIntIntHashMap();
@@ -147,13 +152,21 @@ public class FourSepulchersManager
 	public void init()
 	public void init()
 	{
 	{
 		if (_changeCoolDownTimeTask != null)
 		if (_changeCoolDownTimeTask != null)
+		{
 			_changeCoolDownTimeTask.cancel(true);
 			_changeCoolDownTimeTask.cancel(true);
+		}
 		if (_changeEntryTimeTask != null)
 		if (_changeEntryTimeTask != null)
+		{
 			_changeEntryTimeTask.cancel(true);
 			_changeEntryTimeTask.cancel(true);
+		}
 		if (_changeWarmUpTimeTask != null)
 		if (_changeWarmUpTimeTask != null)
+		{
 			_changeWarmUpTimeTask.cancel(true);
 			_changeWarmUpTimeTask.cancel(true);
+		}
 		if (_changeAttackTimeTask != null)
 		if (_changeAttackTimeTask != null)
+		{
 			_changeAttackTimeTask.cancel(true);
 			_changeAttackTimeTask.cancel(true);
+		}
 		
 		
 		_changeCoolDownTimeTask = null;
 		_changeCoolDownTimeTask = null;
 		_changeEntryTimeTask = null;
 		_changeEntryTimeTask = null;
@@ -186,33 +199,33 @@ public class FourSepulchersManager
 		long currentTime = Calendar.getInstance().getTimeInMillis();
 		long currentTime = Calendar.getInstance().getTimeInMillis();
 		// if current time >= time of entry beginning and if current time < time
 		// if current time >= time of entry beginning and if current time < time
 		// of entry beginning + time of entry end
 		// of entry beginning + time of entry end
-		if (currentTime >= _coolDownTimeEnd && currentTime < _entryTimeEnd) // entry
-			// time
-			// check
+		if ((currentTime >= _coolDownTimeEnd) && (currentTime < _entryTimeEnd)) // entry
+		// time
+		// check
 		{
 		{
 			clean();
 			clean();
 			_changeEntryTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeEntryTime(), 0);
 			_changeEntryTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeEntryTime(), 0);
 			_log.info(getClass().getSimpleName() + ": Beginning in Entry time");
 			_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();
 			clean();
 			_changeWarmUpTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeWarmUpTime(), 0);
 			_changeWarmUpTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeWarmUpTime(), 0);
 			_log.info(getClass().getSimpleName() + ": Beginning in WarmUp time");
 			_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();
 			clean();
 			_changeAttackTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeAttackTime(), 0);
 			_changeAttackTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeAttackTime(), 0);
 			_log.info(getClass().getSimpleName() + ": Beginning in Attack time");
 			_log.info(getClass().getSimpleName() + ": Beginning in Attack time");
 		}
 		}
 		else
 		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);
 			_changeCoolDownTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeCoolDownTime(), 0);
 			_log.info(getClass().getSimpleName() + ": Beginning in Cooldown time");
 			_log.info(getClass().getSimpleName() + ": Beginning in Cooldown time");
@@ -224,12 +237,14 @@ public class FourSepulchersManager
 	{
 	{
 		Calendar tmp = Calendar.getInstance();
 		Calendar tmp = Calendar.getInstance();
 		if (tmp.get(Calendar.MINUTE) < _newCycleMin)
 		if (tmp.get(Calendar.MINUTE) < _newCycleMin)
+		{
 			tmp.set(Calendar.HOUR, Calendar.getInstance().get(Calendar.HOUR) - 1);
 			tmp.set(Calendar.HOUR, Calendar.getInstance().get(Calendar.HOUR) - 1);
+		}
 		tmp.set(Calendar.MINUTE, _newCycleMin);
 		tmp.set(Calendar.MINUTE, _newCycleMin);
 		_coolDownTimeEnd = tmp.getTimeInMillis();
 		_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()
 	public void clean()
@@ -268,11 +283,15 @@ public class FourSepulchersManager
 		int i = 31921;
 		int i = 31921;
 		for (L2Spawn spawnDat; i <= 31924; i++)
 		for (L2Spawn spawnDat; i <= 31924; i++)
 		{
 		{
-			if (i < 31921 || i > 31924)
+			if ((i < 31921) || (i > 31924))
+			{
 				continue;
 				continue;
+			}
 			L2NpcTemplate template1 = NpcTable.getInstance().getTemplate(i);
 			L2NpcTemplate template1 = NpcTable.getInstance().getTemplate(i);
 			if (template1 == null)
 			if (template1 == null)
+			{
 				continue;
 				continue;
+			}
 			try
 			try
 			{
 			{
 				spawnDat = new L2Spawn(template1);
 				spawnDat = new L2Spawn(template1);
@@ -433,8 +452,7 @@ public class FourSepulchersManager
 				}
 				}
 				else
 				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
 				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)
 			catch (Exception e)
@@ -751,7 +768,13 @@ public class FourSepulchersManager
 	protected void initLocationShadowSpawns()
 	protected void initLocationShadowSpawns()
 	{
 	{
 		int locNo = Rnd.get(4);
 		int locNo = Rnd.get(4);
-		final int[] gateKeeper = { 31929, 31934, 31939, 31944 };
+		final int[] gateKeeper =
+		{
+			31929,
+			31934,
+			31939,
+			31944
+		};
 		
 		
 		L2Spawn spawnDat;
 		L2Spawn spawnDat;
 		L2NpcTemplate template;
 		L2NpcTemplate template;
@@ -782,8 +805,7 @@ public class FourSepulchersManager
 			}
 			}
 			else
 			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
 				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)
 			catch (Exception e)
@@ -844,19 +865,18 @@ public class FourSepulchersManager
 		int npcId = npc.getNpcId();
 		int npcId = npc.getNpcId();
 		switch (npcId)
 		switch (npcId)
 		{
 		{
-			// ID ok
+		// ID ok
 			case 31921:
 			case 31921:
 			case 31922:
 			case 31922:
 			case 31923:
 			case 31923:
 			case 31924:
 			case 31924:
 				break;
 				break;
-				// ID not ok
+			// ID not ok
 			default:
 			default:
 				if (!player.isGM())
 				if (!player.isGM())
 				{
 				{
 					_log.warning("Player " + player.getName() + "(" + player.getObjectId() + ") tried to cheat in four sepulchers.");
 					_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;
 				return;
 		}
 		}
@@ -869,7 +889,7 @@ public class FourSepulchersManager
 		
 		
 		if (Config.FS_PARTY_MEMBER_COUNT > 1)
 		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);
 				showHtmlFile(player, npcId + "-SP.htm", npc, null);
 				return;
 				return;
@@ -884,7 +904,7 @@ public class FourSepulchersManager
 			for (L2PcInstance mem : player.getParty().getMembers())
 			for (L2PcInstance mem : player.getParty().getMembers())
 			{
 			{
 				QuestState qs = mem.getQuestState(hostQuest.getName());
 				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);
 					showHtmlFile(player, npcId + "-NS.htm", npc, mem);
 					return;
 					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))
 			if (!player.getParty().isLeader(player))
 			{
 			{
@@ -912,7 +932,7 @@ public class FourSepulchersManager
 			for (L2PcInstance mem : player.getParty().getMembers())
 			for (L2PcInstance mem : player.getParty().getMembers())
 			{
 			{
 				QuestState qs = mem.getQuestState(hostQuest.getName());
 				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);
 					showHtmlFile(player, npcId + "-NS.htm", npc, mem);
 					return;
 					return;
@@ -933,7 +953,7 @@ public class FourSepulchersManager
 		else
 		else
 		{
 		{
 			QuestState qs = player.getQuestState(hostQuest.getName());
 			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);
 				showHtmlFile(player, npcId + "-NS.htm", npc, player);
 				return;
 				return;
@@ -1004,7 +1024,7 @@ public class FourSepulchersManager
 			_hallInUse.remove(npcId);
 			_hallInUse.remove(npcId);
 			_hallInUse.put(npcId, true);
 			_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<>();
 			List<L2PcInstance> members = new FastList<>();
 			for (L2PcInstance mem : player.getParty().getMembers())
 			for (L2PcInstance mem : player.getParty().getMembers())
@@ -1069,7 +1089,9 @@ public class FourSepulchersManager
 	public void spawnMysteriousBox(int npcId)
 	public void spawnMysteriousBox(int npcId)
 	{
 	{
 		if (!isAttackTime())
 		if (!isAttackTime())
+		{
 			return;
 			return;
+		}
 		
 		
 		L2Spawn spawnDat = _mysteriousBoxSpawns.get(npcId);
 		L2Spawn spawnDat = _mysteriousBoxSpawns.get(npcId);
 		if (spawnDat != null)
 		if (spawnDat != null)
@@ -1082,7 +1104,9 @@ public class FourSepulchersManager
 	public void spawnMonster(int npcId)
 	public void spawnMonster(int npcId)
 	{
 	{
 		if (!isAttackTime())
 		if (!isAttackTime())
+		{
 			return;
 			return;
+		}
 		
 		
 		FastList<L2Spawn> monsterList;
 		FastList<L2Spawn> monsterList;
 		FastList<L2SepulcherMonsterInstance> mobs = new FastList<>();
 		FastList<L2SepulcherMonsterInstance> mobs = new FastList<>();
@@ -1193,7 +1217,7 @@ public class FourSepulchersManager
 				case 31484:
 				case 31484:
 					_viscountMobs.put(npcId, mobs);
 					_viscountMobs.put(npcId, mobs);
 					break;
 					break;
-					
+				
 				case 31472:
 				case 31472:
 				case 31477:
 				case 31477:
 				case 31482:
 				case 31482:
@@ -1209,12 +1233,16 @@ public class FourSepulchersManager
 		FastList<L2SepulcherMonsterInstance> mobs = _viscountMobs.get(npcId);
 		FastList<L2SepulcherMonsterInstance> mobs = _viscountMobs.get(npcId);
 		
 		
 		if (mobs == null)
 		if (mobs == null)
+		{
 			return true;
 			return true;
+		}
 		
 		
 		for (L2SepulcherMonsterInstance mob : mobs)
 		for (L2SepulcherMonsterInstance mob : mobs)
 		{
 		{
 			if (!mob.isDead())
 			if (!mob.isDead())
+			{
 				return false;
 				return false;
+			}
 		}
 		}
 		
 		
 		return true;
 		return true;
@@ -1225,12 +1253,16 @@ public class FourSepulchersManager
 		FastList<L2SepulcherMonsterInstance> mobs = _dukeMobs.get(npcId);
 		FastList<L2SepulcherMonsterInstance> mobs = _dukeMobs.get(npcId);
 		
 		
 		if (mobs == null)
 		if (mobs == null)
+		{
 			return true;
 			return true;
+		}
 		
 		
 		for (L2SepulcherMonsterInstance mob : mobs)
 		for (L2SepulcherMonsterInstance mob : mobs)
 		{
 		{
 			if (!mob.isDead())
 			if (!mob.isDead())
+			{
 				return false;
 				return false;
+			}
 		}
 		}
 		
 		
 		return true;
 		return true;
@@ -1239,7 +1271,9 @@ public class FourSepulchersManager
 	public void spawnKeyBox(L2Npc activeChar)
 	public void spawnKeyBox(L2Npc activeChar)
 	{
 	{
 		if (!isAttackTime())
 		if (!isAttackTime())
+		{
 			return;
 			return;
+		}
 		
 		
 		L2Spawn spawnDat = _keyBoxSpawns.get(activeChar.getNpcId());
 		L2Spawn spawnDat = _keyBoxSpawns.get(activeChar.getNpcId());
 		
 		
@@ -1260,7 +1294,9 @@ public class FourSepulchersManager
 	public void spawnExecutionerOfHalisha(L2Npc activeChar)
 	public void spawnExecutionerOfHalisha(L2Npc activeChar)
 	{
 	{
 		if (!isAttackTime())
 		if (!isAttackTime())
+		{
 			return;
 			return;
+		}
 		
 		
 		L2Spawn spawnDat = _executionerSpawns.get(activeChar.getNpcId());
 		L2Spawn spawnDat = _executionerSpawns.get(activeChar.getNpcId());
 		
 		
@@ -1280,10 +1316,14 @@ public class FourSepulchersManager
 	public void spawnArchonOfHalisha(int npcId)
 	public void spawnArchonOfHalisha(int npcId)
 	{
 	{
 		if (!isAttackTime())
 		if (!isAttackTime())
+		{
 			return;
 			return;
+		}
 		
 		
 		if (_archonSpawned.get(npcId))
 		if (_archonSpawned.get(npcId))
+		{
 			return;
 			return;
+		}
 		
 		
 		FastList<L2Spawn> monsterList = _dukeFinalMobs.get(npcId);
 		FastList<L2Spawn> monsterList = _dukeFinalMobs.get(npcId);
 		
 		
@@ -1307,7 +1347,9 @@ public class FourSepulchersManager
 	public void spawnEmperorsGraveNpc(int npcId)
 	public void spawnEmperorsGraveNpc(int npcId)
 	{
 	{
 		if (!isAttackTime())
 		if (!isAttackTime())
+		{
 			return;
 			return;
+		}
 		
 		
 		FastList<L2Spawn> monsterList = _emperorsGraveNpcs.get(npcId);
 		FastList<L2Spawn> monsterList = _emperorsGraveNpcs.get(npcId);
 		
 		
@@ -1326,7 +1368,13 @@ public class FourSepulchersManager
 		int locNo = Rnd.get(4);
 		int locNo = Rnd.get(4);
 		// _log.info("FourSepulchersManager.LocationShadowSpawns: Location index
 		// _log.info("FourSepulchersManager.LocationShadowSpawns: Location index
 		// is " + locNo + ".");
 		// is " + locNo + ".");
-		final int[] gateKeeper = { 31929, 31934, 31939, 31944 };
+		final int[] gateKeeper =
+		{
+			31929,
+			31934,
+			31939,
+			31944
+		};
 		
 		
 		L2Spawn spawnDat;
 		L2Spawn spawnDat;
 		
 		
@@ -1345,7 +1393,9 @@ public class FourSepulchersManager
 	public void spawnShadow(int npcId)
 	public void spawnShadow(int npcId)
 	{
 	{
 		if (!isAttackTime())
 		if (!isAttackTime())
+		{
 			return;
 			return;
+		}
 		
 		
 		L2Spawn spawnDat = _shadowSpawns.get(npcId);
 		L2Spawn spawnDat = _shadowSpawns.get(npcId);
 		if (spawnDat != null)
 		if (spawnDat != null)
@@ -1366,12 +1416,16 @@ public class FourSepulchersManager
 		for (L2Npc mob : _allMobs)
 		for (L2Npc mob : _allMobs)
 		{
 		{
 			if (mob == null)
 			if (mob == null)
+			{
 				continue;
 				continue;
+			}
 			
 			
 			try
 			try
 			{
 			{
 				if (mob.getSpawn() != null)
 				if (mob.getSpawn() != null)
+				{
 					mob.getSpawn().stopRespawn();
 					mob.getSpawn().stopRespawn();
+				}
 				mob.deleteMe();
 				mob.deleteMe();
 			}
 			}
 			catch (Exception e)
 			catch (Exception e)
@@ -1407,7 +1461,7 @@ public class FourSepulchersManager
 	
 	
 	protected byte minuteSelect(byte min)
 	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...
 			// mad table for selecting proper minutes...
 			// may be there is a better way to do this
 			// may be there is a better way to do this
@@ -1488,14 +1542,18 @@ public class FourSepulchersManager
 		if (_inAttackTime)
 		if (_inAttackTime)
 		{
 		{
 			if (min < 5)
 			if (min < 5)
+			{
 				return; // do not shout when < 5 minutes
 				return; // do not shout when < 5 minutes
+			}
 			
 			
 			min = minuteSelect(min);
 			min = minuteSelect(min);
 			
 			
 			NpcStringId msg = NpcStringId.MINUTES_HAVE_PASSED;
 			NpcStringId msg = NpcStringId.MINUTES_HAVE_PASSED;
 			
 			
 			if (min == 90)
 			if (min == 90)
+			{
 				msg = NpcStringId.GAME_OVER_THE_TELEPORT_WILL_APPEAR_MOMENTARILY;
 				msg = NpcStringId.GAME_OVER_THE_TELEPORT_WILL_APPEAR_MOMENTARILY;
+			}
 			
 			
 			for (L2Spawn temp : _managers)
 			for (L2Spawn temp : _managers)
 			{
 			{
@@ -1513,7 +1571,9 @@ public class FourSepulchersManager
 				// anything :)
 				// anything :)
 				// if you don't need this - delete next two lines.
 				// if you don't need this - delete next two lines.
 				if (!_hallInUse.get(temp.getNpcid()).booleanValue())
 				if (!_hallInUse.get(temp.getNpcid()).booleanValue())
+				{
 					continue;
 					continue;
+				}
 				
 				
 				((L2SepulcherNpcInstance) temp.getLastSpawn()).sayInShout(msg);
 				((L2SepulcherNpcInstance) temp.getLastSpawn()).sayInShout(msg);
 			}
 			}
@@ -1550,7 +1610,7 @@ public class FourSepulchersManager
 			{
 			{
 				Calendar tmp = Calendar.getInstance();
 				Calendar tmp = Calendar.getInstance();
 				tmp.setTimeInMillis(Calendar.getInstance().getTimeInMillis() - _warmUpTimeEnd);
 				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
 					managerSay((byte) tmp.get(Calendar.MINUTE)); // byte
 					// because
 					// because
@@ -1561,13 +1621,15 @@ public class FourSepulchersManager
 					ThreadPoolManager.getInstance().scheduleGeneral(new ManagerSay(), 5 * 60000);
 					ThreadPoolManager.getInstance().scheduleGeneral(new ManagerSay(), 5 * 60000);
 				}
 				}
 				// attack time ending chat
 				// 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
 					managerSay((byte) 90); // sending a unique id :D
 				}
 				}
 			}
 			}
 			else if (_inEntryTime)
 			else if (_inEntryTime)
+			{
 				managerSay((byte) 0);
 				managerSay((byte) 0);
+			}
 		}
 		}
 	}
 	}
 	
 	
@@ -1589,10 +1651,14 @@ public class FourSepulchersManager
 			// time
 			// time
 			// and then launching change time task
 			// and then launching change time task
 			if (_firstTimeRun)
 			if (_firstTimeRun)
+			{
 				interval = _entryTimeEnd - Calendar.getInstance().getTimeInMillis();
 				interval = _entryTimeEnd - Calendar.getInstance().getTimeInMillis();
+			}
 			else
 			else
+			{
 				interval = Config.FS_TIME_ENTRY * 60000L; // else use stupid
 				interval = Config.FS_TIME_ENTRY * 60000L; // else use stupid
-			// method
+				// method
+			}
 			
 			
 			// launching saying process...
 			// launching saying process...
 			ThreadPoolManager.getInstance().scheduleGeneral(new ManagerSay(), 0);
 			ThreadPoolManager.getInstance().scheduleGeneral(new ManagerSay(), 0);
@@ -1623,9 +1689,13 @@ public class FourSepulchersManager
 			// current time
 			// current time
 			// and then launching change time task
 			// and then launching change time task
 			if (_firstTimeRun)
 			if (_firstTimeRun)
+			{
 				interval = _warmUpTimeEnd - Calendar.getInstance().getTimeInMillis();
 				interval = _warmUpTimeEnd - Calendar.getInstance().getTimeInMillis();
+			}
 			else
 			else
+			{
 				interval = Config.FS_TIME_WARMUP * 60000L;
 				interval = Config.FS_TIME_WARMUP * 60000L;
+			}
 			_changeAttackTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeAttackTime(), interval);
 			_changeAttackTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeAttackTime(), interval);
 			
 			
 			if (_changeWarmUpTimeTask != null)
 			if (_changeWarmUpTimeTask != null)
@@ -1666,27 +1736,32 @@ public class FourSepulchersManager
 				for (double min = Calendar.getInstance().get(Calendar.MINUTE); min < _newCycleMin; min++)
 				for (double min = Calendar.getInstance().get(Calendar.MINUTE); min < _newCycleMin; min++)
 				{
 				{
 					// looking for next shout time....
 					// 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.");
 						_log.info(getClass().getSimpleName() + ": " + Calendar.getInstance().getTime() + " Atk announce scheduled to " + min + " minute of this hour.");
 						Calendar inter = Calendar.getInstance();
 						Calendar inter = Calendar.getInstance();
 						inter.set(Calendar.MINUTE, (int) min);
 						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;
 						break;
 					}
 					}
 				}
 				}
 			}
 			}
 			else
 			else
+			{
 				ThreadPoolManager.getInstance().scheduleGeneral(new ManagerSay(), 5 * 60400);
 				ThreadPoolManager.getInstance().scheduleGeneral(new ManagerSay(), 5 * 60400);
+			}
 			// searching time when attack time will be ended:
 			// searching time when attack time will be ended:
 			// counting difference between time when attack time ends and
 			// counting difference between time when attack time ends and
 			// current time
 			// current time
 			// and then launching change time task
 			// and then launching change time task
 			if (_firstTimeRun)
 			if (_firstTimeRun)
+			{
 				interval = _attackTimeEnd - Calendar.getInstance().getTimeInMillis();
 				interval = _attackTimeEnd - Calendar.getInstance().getTimeInMillis();
+			}
 			else
 			else
+			{
 				interval = Config.FS_TIME_ATTACK * 60000L;
 				interval = Config.FS_TIME_ATTACK * 60000L;
+			}
 			_changeCoolDownTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeCoolDownTime(), interval);
 			_changeCoolDownTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeCoolDownTime(), interval);
 			
 			
 			if (_changeAttackTimeTask != null)
 			if (_changeAttackTimeTask != null)
@@ -1713,13 +1788,17 @@ public class FourSepulchersManager
 			Calendar time = Calendar.getInstance();
 			Calendar time = Calendar.getInstance();
 			// one hour = 55th min to 55 min of next hour, so we check for this,
 			// one hour = 55th min to 55 min of next hour, so we check for this,
 			// also check for first launch
 			// 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.HOUR, Calendar.getInstance().get(Calendar.HOUR) + 1);
+			}
 			time.set(Calendar.MINUTE, _newCycleMin);
 			time.set(Calendar.MINUTE, _newCycleMin);
 			_log.info(getClass().getSimpleName() + ": Entry time: " + time.getTime());
 			_log.info(getClass().getSimpleName() + ": Entry time: " + time.getTime());
 			if (_firstTimeRun)
 			if (_firstTimeRun)
+			{
 				_firstTimeRun = false; // cooldown phase ends event hour, so it
 				_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();
 			long interval = time.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
 			_changeEntryTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeEntryTime(), interval);
 			_changeEntryTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeEntryTime(), interval);
@@ -1742,7 +1821,9 @@ public class FourSepulchersManager
 		NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
 		NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
 		html.setFile(player.getHtmlPrefix(), "data/html/SepulcherNpc/" + file);
 		html.setFile(player.getHtmlPrefix(), "data/html/SepulcherNpc/" + file);
 		if (member != null)
 		if (member != null)
+		{
 			html.replace("%member%", member.getName());
 			html.replace("%member%", member.getName());
+		}
 		player.sendPacket(html);
 		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();
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
 			PreparedStatement statement = con.prepareStatement(SAVE_VAR))
 			PreparedStatement statement = con.prepareStatement(SAVE_VAR))
 		{
 		{
-			for(String var : _variablesMap.keySet())
+			for (String var : _variablesMap.keySet())
 			{
 			{
 				statement.setString(1, var);
 				statement.setString(1, var);
 				statement.setString(2, _variablesMap.get(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;
 package com.l2jserver.gameserver.instancemanager;
 
 
-import gnu.trove.map.hash.TIntIntHashMap;
-import gnu.trove.map.hash.TIntObjectHashMap;
-
 import java.sql.Connection;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 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.gameserver.model.zone.type.L2BossZone;
 import com.l2jserver.util.L2FastList;
 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
 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";
 	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 (?,?)";
 	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_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 = ?";
 	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());
 	protected static Logger _log = Logger.getLogger(GrandBossManager.class.getName());
@@ -113,8 +78,8 @@ public class GrandBossManager
 			ResultSet rset = statement.executeQuery();
 			ResultSet rset = statement.executeQuery();
 			while (rset.next())
 			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();
 				StatsSet info = new StatsSet();
 				int bossId = rset.getInt("boss_id");
 				int bossId = rset.getInt("boss_id");
 				info.set("loc_x", rset.getInt("loc_x"));
 				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("loc_z", rset.getInt("loc_z"));
 				info.set("heading", rset.getInt("heading"));
 				info.set("heading", rset.getInt("heading"));
 				info.set("respawn_time", rset.getLong("respawn_time"));
 				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");
 				double MP = rset.getDouble("currentMP");
 				int true_MP = (int) MP;
 				int true_MP = (int) MP;
 				info.set("currentMP", true_MP);
 				info.set("currentMP", true_MP);
 				int status = rset.getInt("status");
 				int status = rset.getInt("status");
 				_bossStatus.put(bossId, status);
 				_bossStatus.put(bossId, status);
 				_storedInfo.put(bossId, info);
 				_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)
 				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;
 				info = null;
 			}
 			}
@@ -168,7 +135,9 @@ public class GrandBossManager
 		for (L2BossZone zone : _zones)
 		for (L2BossZone zone : _zones)
 		{
 		{
 			if (zone == null)
 			if (zone == null)
+			{
 				continue;
 				continue;
+			}
 			zones.put(zone.getId(), new L2FastList<Integer>());
 			zones.put(zone.getId(), new L2FastList<Integer>());
 		}
 		}
 		
 		
@@ -201,7 +170,9 @@ public class GrandBossManager
 		for (L2BossZone zone : _zones)
 		for (L2BossZone zone : _zones)
 		{
 		{
 			if (zone == null)
 			if (zone == null)
+			{
 				continue;
 				continue;
+			}
 			zone.setAllowedPlayers(zones.get(zone.getId()));
 			zone.setAllowedPlayers(zones.get(zone.getId()));
 		}
 		}
 		
 		
@@ -223,7 +194,9 @@ public class GrandBossManager
 			for (L2BossZone temp : _zones)
 			for (L2BossZone temp : _zones)
 			{
 			{
 				if (temp.isCharacterInZone(character))
 				if (temp.isCharacterInZone(character))
+				{
 					return temp;
 					return temp;
+				}
 			}
 			}
 		}
 		}
 		return null;
 		return null;
@@ -241,7 +214,9 @@ public class GrandBossManager
 			for (L2BossZone temp : _zones)
 			for (L2BossZone temp : _zones)
 			{
 			{
 				if (temp.isInsideZone(x, y, z))
 				if (temp.isInsideZone(x, y, z))
+				{
 					return temp;
 					return temp;
+				}
 			}
 			}
 		}
 		}
 		return null;
 		return null;
@@ -251,7 +226,9 @@ public class GrandBossManager
 	{
 	{
 		L2BossZone temp = getZone(obj.getX(), obj.getY(), obj.getZ());
 		L2BossZone temp = getZone(obj.getX(), obj.getY(), obj.getZ());
 		if (temp == null)
 		if (temp == null)
+		{
 			return false;
 			return false;
+		}
 		
 		
 		return temp.getName().equalsIgnoreCase(zoneType);
 		return temp.getName().equalsIgnoreCase(zoneType);
 	}
 	}
@@ -259,10 +236,14 @@ public class GrandBossManager
 	public boolean checkIfInZone(L2PcInstance player)
 	public boolean checkIfInZone(L2PcInstance player)
 	{
 	{
 		if (player == null)
 		if (player == null)
+		{
 			return false;
 			return false;
+		}
 		L2BossZone temp = getZone(player.getX(), player.getY(), player.getZ());
 		L2BossZone temp = getZone(player.getX(), player.getY(), player.getZ());
 		if (temp == null)
 		if (temp == null)
+		{
 			return false;
 			return false;
+		}
 		
 		
 		return true;
 		return true;
 	}
 	}
@@ -275,13 +256,13 @@ public class GrandBossManager
 	public void setBossStatus(int bossId, int status)
 	public void setBossStatus(int bossId, int status)
 	{
 	{
 		_bossStatus.put(bossId, 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);
 		updateDb(bossId, true);
 	}
 	}
 	
 	
 	/**
 	/**
 	 * Adds a L2GrandBossInstance to the list of bosses.
 	 * Adds a L2GrandBossInstance to the list of bosses.
-	 * @param boss 
+	 * @param boss
 	 */
 	 */
 	public void addBoss(L2GrandBossInstance boss)
 	public void addBoss(L2GrandBossInstance boss)
 	{
 	{
@@ -319,11 +300,15 @@ public class GrandBossManager
 				for (L2BossZone zone : _zones)
 				for (L2BossZone zone : _zones)
 				{
 				{
 					if (zone == null)
 					if (zone == null)
+					{
 						continue;
 						continue;
+					}
 					Integer id = zone.getId();
 					Integer id = zone.getId();
 					L2FastList<Integer> list = zone.getAllowedPlayers();
 					L2FastList<Integer> list = zone.getAllowedPlayers();
-					if (list == null || list.isEmpty())
+					if ((list == null) || list.isEmpty())
+					{
 						continue;
 						continue;
+					}
 					for (Integer player : list)
 					for (Integer player : list)
 					{
 					{
 						insert.setInt(1, player);
 						insert.setInt(1, player);
@@ -337,7 +322,7 @@ public class GrandBossManager
 			{
 			{
 				final L2GrandBossInstance boss = _bosses.get(bossId);
 				final L2GrandBossInstance boss = _bosses.get(bossId);
 				StatsSet info = _storedInfo.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))
 					try (PreparedStatement update = con.prepareStatement(UPDATE_GRAND_BOSS_DATA2))
 					{
 					{
@@ -386,7 +371,7 @@ public class GrandBossManager
 			L2GrandBossInstance boss = _bosses.get(bossId);
 			L2GrandBossInstance boss = _bosses.get(bossId);
 			StatsSet info = _storedInfo.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))
 				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()
 	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.
  * as the clearance of the participants list or liberate the arena.
  * @author BiggBoss
  * @author BiggBoss
  */
  */
-public final class HandysBlockCheckerManager 
+public final class HandysBlockCheckerManager
 {
 {
 	// All the participants and their team classified by arena
 	// All the participants and their team classified by arena
 	private static final ArenaParticipantsHolder[] _arenaPlayers = new ArenaParticipantsHolder[4];
 	private static final ArenaParticipantsHolder[] _arenaPlayers = new ArenaParticipantsHolder[4];
@@ -54,8 +54,7 @@ public final class HandysBlockCheckerManager
 	protected static List<Integer> _registrationPenalty = new ArrayList<>();
 	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
 	 * @param arenaId
 	 * @return int (number of votes)
 	 * @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
 	 * @param arena
 	 */
 	 */
 	public synchronized void increaseArenaVotes(int arena)
 	public synchronized void increaseArenaVotes(int arena)
@@ -74,13 +72,17 @@ public final class HandysBlockCheckerManager
 		int newVotes = _arenaVotes.get(arena) + 1;
 		int newVotes = _arenaVotes.get(arena) + 1;
 		ArenaParticipantsHolder holder = _arenaPlayers[arena];
 		ArenaParticipantsHolder holder = _arenaPlayers[arena];
 		
 		
-		if(newVotes > holder.getAllPlayers().size() / 2 && !holder.getEvent().isStarted())
+		if ((newVotes > (holder.getAllPlayers().size() / 2)) && !holder.getEvent().isStarted())
 		{
 		{
 			clearArenaVotes(arena);
 			clearArenaVotes(arena);
-			if(holder.getBlueTeamSize() == 0 || holder.getRedTeamSize() == 0)
+			if ((holder.getBlueTeamSize() == 0) || (holder.getRedTeamSize() == 0))
+			{
 				return;
 				return;
-			if(Config.HBCE_FAIR_PLAY)
+			}
+			if (Config.HBCE_FAIR_PLAY)
+			{
 				holder.checkAndShuffle();
 				holder.checkAndShuffle();
+			}
 			ThreadPoolManager.getInstance().executeTask(holder.getEvent().new StartEvent());
 			ThreadPoolManager.getInstance().executeTask(holder.getEvent().new StartEvent());
 		}
 		}
 		else
 		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
 	 * @param arena
 	 */
 	 */
 	public synchronized void clearArenaVotes(int arena)
 	public synchronized void clearArenaVotes(int arena)
 	{
 	{
 		_arenaVotes.put(arena, 0);
 		_arenaVotes.put(arena, 0);
 	}
 	}
-
+	
 	protected HandysBlockCheckerManager()
 	protected HandysBlockCheckerManager()
 	{
 	{
 		// Initialize arena status
 		// Initialize arena status
@@ -117,36 +118,35 @@ public final class HandysBlockCheckerManager
 	{
 	{
 		return _arenaPlayers[arena];
 		return _arenaPlayers[arena];
 	}
 	}
-		
+	
 	/**
 	/**
 	 * Initializes the participants holder
 	 * Initializes the participants holder
 	 */
 	 */
 	public void startUpParticipantsQueue()
 	public void startUpParticipantsQueue()
 	{
 	{
-		for(int i = 0; i < 4; ++i)
+		for (int i = 0; i < 4; ++i)
 		{
 		{
 			_arenaPlayers[i] = new ArenaParticipantsHolder(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 player
 	 * @param arenaId
 	 * @param arenaId
-	 * @return 
+	 * @return
 	 */
 	 */
 	public boolean addPlayerToArena(L2PcInstance player, int arenaId)
 	public boolean addPlayerToArena(L2PcInstance player, int arenaId)
 	{
 	{
 		ArenaParticipantsHolder holder = _arenaPlayers[arenaId];
 		ArenaParticipantsHolder holder = _arenaPlayers[arenaId];
 		
 		
-		synchronized(holder)
+		synchronized (holder)
 		{
 		{
 			boolean isRed;
 			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);
 					SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_MATCH_WAITING_LIST);
 					msg.addCharName(player);
 					msg.addCharName(player);
@@ -154,44 +154,43 @@ public final class HandysBlockCheckerManager
 					return false;
 					return false;
 				}
 				}
 			}
 			}
-				
-			if(player.isCursedWeaponEquipped())
+			
+			if (player.isCursedWeaponEquipped())
 			{
 			{
 				player.sendPacket(SystemMessageId.CANNOT_REGISTER_PROCESSING_CURSED_WEAPON);
 				player.sendPacket(SystemMessageId.CANNOT_REGISTER_PROCESSING_CURSED_WEAPON);
 				return false;
 				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");
 				player.sendMessage("Couldnt register you due other event participation");
 				return false;
 				return false;
 			}
 			}
-
-			if(OlympiadManager.getInstance().isRegistered(player))
+			
+			if (OlympiadManager.getInstance().isRegistered(player))
 			{
 			{
 				OlympiadManager.getInstance().unRegisterNoble(player);
 				OlympiadManager.getInstance().unRegisterNoble(player);
 				player.sendPacket(SystemMessageId.COLISEUM_OLYMPIAD_KRATEIS_APPLICANTS_CANNOT_PARTICIPATE);
 				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);
 				player.sendPacket(SystemMessageId.CANNOT_REQUEST_REGISTRATION_10_SECS_AFTER);
 				return false;
 				return false;
 			}
 			}
 			
 			
-			if(holder.getBlueTeamSize() < holder.getRedTeamSize())
+			if (holder.getBlueTeamSize() < holder.getRedTeamSize())
 			{
 			{
 				holder.addPlayer(player, 1);
 				holder.addPlayer(player, 1);
 				isRed = false;
 				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 player
 	 * @param arenaId
 	 * @param arenaId
-	 * @param team 
+	 * @param team
 	 */
 	 */
 	public void removePlayer(L2PcInstance player, int arenaId, int team)
 	public void removePlayer(L2PcInstance player, int arenaId, int team)
 	{
 	{
 		ArenaParticipantsHolder holder = _arenaPlayers[arenaId];
 		ArenaParticipantsHolder holder = _arenaPlayers[arenaId];
-		synchronized(holder)
+		synchronized (holder)
 		{
 		{
 			boolean isRed = team == 0 ? true : false;
 			boolean isRed = team == 0 ? true : false;
 			
 			
@@ -225,20 +222,23 @@ public final class HandysBlockCheckerManager
 			holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed));
 			holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed));
 			
 			
 			// End event if theres an empty team
 			// 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();
 				holder.getEvent().endEventAbnormally();
+			}
 			
 			
 			Integer objId = player.getObjectId();
 			Integer objId = player.getObjectId();
-			if(!_registrationPenalty.contains(objId))
+			if (!_registrationPenalty.contains(objId))
+			{
 				_registrationPenalty.add(objId);
 				_registrationPenalty.add(objId);
+			}
 			schedulePenaltyRemoval(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 player
 	 * @param arena
 	 * @param arena
 	 * @param team
 	 * @param team
@@ -247,28 +247,32 @@ public final class HandysBlockCheckerManager
 	{
 	{
 		ArenaParticipantsHolder holder = _arenaPlayers[arena];
 		ArenaParticipantsHolder holder = _arenaPlayers[arena];
 		
 		
-		synchronized(holder)
+		synchronized (holder)
 		{
 		{
 			boolean isFromRed = holder._redPlayers.contains(player);
 			boolean isFromRed = holder._redPlayers.contains(player);
 			
 			
-			if(isFromRed && holder.getBlueTeamSize() == 6)
+			if (isFromRed && (holder.getBlueTeamSize() == 6))
 			{
 			{
 				player.sendMessage("The team is full");
 				player.sendMessage("The team is full");
 				return;
 				return;
 			}
 			}
-			else if(!isFromRed && holder.getRedTeamSize() == 6)
+			else if (!isFromRed && (holder.getRedTeamSize() == 6))
 			{
 			{
 				player.sendMessage("The team is full");
 				player.sendMessage("The team is full");
 				return;
 				return;
 			}
 			}
 			
 			
-			int futureTeam = isFromRed? 1 : 0;
+			int futureTeam = isFromRed ? 1 : 0;
 			holder.addPlayer(player, futureTeam);
 			holder.addPlayer(player, futureTeam);
 			
 			
-			if(isFromRed)
+			if (isFromRed)
+			{
 				holder.removePlayer(player, 0);
 				holder.removePlayer(player, 0);
+			}
 			else
 			else
+			{
 				holder.removePlayer(player, 1);
 				holder.removePlayer(player, 1);
+			}
 			holder.broadCastPacketToTeam(new ExCubeGameChangeTeam(player, isFromRed));
 			holder.broadCastPacketToTeam(new ExCubeGameChangeTeam(player, isFromRed));
 		}
 		}
 	}
 	}
@@ -289,8 +293,10 @@ public final class HandysBlockCheckerManager
 	 */
 	 */
 	public boolean arenaIsBeingUsed(int arenaId)
 	public boolean arenaIsBeingUsed(int arenaId)
 	{
 	{
-		if(arenaId < 0 || arenaId > 3) 
+		if ((arenaId < 0) || (arenaId > 3))
+		{
 			return false;
 			return false;
+		}
 		return _arenaStatus.get(arenaId);
 		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
 	 * @param arenaId
 	 */
 	 */
 	public void setArenaFree(int 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
 	 * @param player
 	 */
 	 */
 	public void onDisconnect(L2PcInstance player)
 	public void onDisconnect(L2PcInstance player)
@@ -323,7 +327,7 @@ public final class HandysBlockCheckerManager
 		int arena = player.getBlockCheckerArena();
 		int arena = player.getBlockCheckerArena();
 		int team = getHolder(arena).getPlayerTeam(player);
 		int team = getHolder(arena).getPlayerTeam(player);
 		HandysBlockCheckerManager.getInstance().removePlayer(player, arena, team);
 		HandysBlockCheckerManager.getInstance().removePlayer(player, arena, team);
-		if (player.getTeam() > 0 )
+		if (player.getTeam() > 0)
 		{
 		{
 			player.stopAllEffects();
 			player.stopAllEffects();
 			// Remove team aura
 			// Remove team aura
@@ -332,12 +336,12 @@ public final class HandysBlockCheckerManager
 			// Remove the event items
 			// Remove the event items
 			PcInventory inv = player.getInventory();
 			PcInventory inv = player.getInventory();
 			
 			
-			if(inv.getItemByItemId(13787) != null)
+			if (inv.getItemByItemId(13787) != null)
 			{
 			{
 				long count = inv.getInventoryItemCount(13787, 0);
 				long count = inv.getInventoryItemCount(13787, 0);
 				inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player);
 				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);
 				long count = inv.getInventoryItemCount(13788, 0);
 				inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player);
 				inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player);
@@ -383,28 +387,42 @@ public final class HandysBlockCheckerManager
 		
 		
 		public void addPlayer(L2PcInstance player, int team)
 		public void addPlayer(L2PcInstance player, int team)
 		{
 		{
-			if(team == 0)
+			if (team == 0)
+			{
 				_redPlayers.add(player);
 				_redPlayers.add(player);
+			}
 			else
 			else
+			{
 				_bluePlayers.add(player);
 				_bluePlayers.add(player);
+			}
 		}
 		}
 		
 		
 		public void removePlayer(L2PcInstance player, int team)
 		public void removePlayer(L2PcInstance player, int team)
 		{
 		{
-			if(team == 0)
+			if (team == 0)
+			{
 				_redPlayers.remove(player);
 				_redPlayers.remove(player);
+			}
 			else
 			else
+			{
 				_bluePlayers.remove(player);
 				_bluePlayers.remove(player);
+			}
 		}
 		}
 		
 		
 		public int getPlayerTeam(L2PcInstance player)
 		public int getPlayerTeam(L2PcInstance player)
 		{
 		{
-			if(_redPlayers.contains(player))
+			if (_redPlayers.contains(player))
+			{
 				return 0;
 				return 0;
-			else if(_bluePlayers.contains(player))
+			}
+			else if (_bluePlayers.contains(player))
+			{
 				return 1;
 				return 1;
+			}
 			else
 			else
+			{
 				return -1;
 				return -1;
+			}
 		}
 		}
 		
 		
 		public int getRedTeamSize()
 		public int getRedTeamSize()
@@ -419,10 +437,14 @@ public final class HandysBlockCheckerManager
 		
 		
 		public void broadCastPacketToTeam(L2GameServerPacket packet)
 		public void broadCastPacketToTeam(L2GameServerPacket packet)
 		{
 		{
-			for(L2PcInstance p : _redPlayers)
+			for (L2PcInstance p : _redPlayers)
+			{
 				p.sendPacket(packet);
 				p.sendPacket(packet);
-			for(L2PcInstance p : _bluePlayers)
+			}
+			for (L2PcInstance p : _bluePlayers)
+			{
 				p.sendPacket(packet);
 				p.sendPacket(packet);
+			}
 		}
 		}
 		
 		
 		public void clearPlayers()
 		public void clearPlayers()
@@ -445,25 +467,31 @@ public final class HandysBlockCheckerManager
 		{
 		{
 			int redSize = _redPlayers.size();
 			int redSize = _redPlayers.size();
 			int blueSize = _bluePlayers.size();
 			int blueSize = _bluePlayers.size();
-			if(redSize > blueSize + 1)
+			if (redSize > (blueSize + 1))
 			{
 			{
 				broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.TEAM_ADJUSTED_BECAUSE_WRONG_POPULATION_RATIO));
 				broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.TEAM_ADJUSTED_BECAUSE_WRONG_POPULATION_RATIO));
 				int needed = redSize - (blueSize + 1);
 				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);
 					L2PcInstance plr = _redPlayers.get(i);
-					if(plr == null) continue;
+					if (plr == null)
+					{
+						continue;
+					}
 					changePlayerToTeam(plr, _arena, 1);
 					changePlayerToTeam(plr, _arena, 1);
 				}
 				}
 			}
 			}
-			else if(blueSize > redSize + 1)
+			else if (blueSize > (redSize + 1))
 			{
 			{
 				broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.TEAM_ADJUSTED_BECAUSE_WRONG_POPULATION_RATIO));
 				broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.TEAM_ADJUSTED_BECAUSE_WRONG_POPULATION_RATIO));
 				int needed = blueSize - (redSize + 1);
 				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);
 					L2PcInstance plr = _bluePlayers.get(i);
-					if(plr == null) continue;
+					if (plr == null)
+					{
+						continue;
+					}
 					changePlayerToTeam(plr, _arena, 0);
 					changePlayerToTeam(plr, _arena, 0);
 				}
 				}
 			}
 			}
@@ -478,6 +506,7 @@ public final class HandysBlockCheckerManager
 	private class PenaltyRemove implements Runnable
 	private class PenaltyRemove implements Runnable
 	{
 	{
 		private final Integer objectId;
 		private final Integer objectId;
+		
 		public PenaltyRemove(Integer id)
 		public PenaltyRemove(Integer id)
 		{
 		{
 			objectId = 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 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 _level = 0;
 	private int _trust = 0;
 	private int _trust = 0;
@@ -52,7 +50,7 @@ public class HellboundManager
 	private final List<HellboundSpawn> _population = new ArrayList<>();
 	private final List<HellboundSpawn> _population = new ArrayList<>();
 	
 	
 	protected HellboundManager()
 	protected HellboundManager()
-	{	
+	{
 		loadData();
 		loadData();
 		loadSpawns();
 		loadSpawns();
 	}
 	}

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

@@ -14,8 +14,6 @@
  */
  */
 package com.l2jserver.gameserver.instancemanager;
 package com.l2jserver.gameserver.instancemanager;
 
 
-import gnu.trove.map.hash.TIntObjectHashMap;
-
 import java.io.File;
 import java.io.File;
 import java.sql.Connection;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.PreparedStatement;
@@ -36,6 +34,8 @@ import com.l2jserver.Config;
 import com.l2jserver.L2DatabaseFactory;
 import com.l2jserver.L2DatabaseFactory;
 import com.l2jserver.gameserver.model.itemauction.ItemAuctionInstance;
 import com.l2jserver.gameserver.model.itemauction.ItemAuctionInstance;
 
 
+import gnu.trove.map.hash.TIntObjectHashMap;
+
 /**
 /**
  * @author Forsaiken
  * @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"))
 			ResultSet rset = statement.executeQuery("SELECT auctionId FROM item_auction ORDER BY auctionId DESC LIMIT 0, 1"))
 		{
 		{
 			if (rset.next())
 			if (rset.next())
+			{
 				_auctionIds.set(rset.getInt(1) + 1);
 				_auctionIds.set(rset.getInt(1) + 1);
+			}
 		}
 		}
 		catch (final SQLException e)
 		catch (final SQLException e)
 		{
 		{
@@ -95,7 +97,9 @@ public final class ItemAuctionManager
 							final int instanceId = Integer.parseInt(nab.getNamedItem("id").getNodeValue());
 							final int instanceId = Integer.parseInt(nab.getNamedItem("id").getNodeValue());
 							
 							
 							if (_managerInstances.containsKey(instanceId))
 							if (_managerInstances.containsKey(instanceId))
+							{
 								throw new Exception("Dublicated instanceId " + instanceId);
 								throw new Exception("Dublicated instanceId " + instanceId);
+							}
 							
 							
 							final ItemAuctionInstance instance = new ItemAuctionInstance(instanceId, _auctionIds, nb);
 							final ItemAuctionInstance instance = new ItemAuctionInstance(instanceId, _auctionIds, nb);
 							_managerInstances.put(instanceId, instance);
 							_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
 	@Override
 	public synchronized void run()
 	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;
 import com.l2jserver.util.L2FastMap;
 
 
 /**
 /**
- * @author Migi, DS<br>
+ * @author Migi, DS
  */
  */
 public class MailManager
 public class MailManager
 {
 {
 	private static Logger _log = Logger.getLogger(MailManager.class.getName());
 	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()
 	protected MailManager()
 	{
 	{
@@ -56,7 +56,7 @@ public class MailManager
 		int count = 0;
 		int count = 0;
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
 		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();
 			ResultSet rset1 = statement.executeQuery();
 			while (rset1.next())
 			while (rset1.next())
 			{
 			{
@@ -71,9 +71,13 @@ public class MailManager
 				long expiration = msg.getExpiration();
 				long expiration = msg.getExpiration();
 				
 				
 				if (expiration < System.currentTimeMillis())
 				if (expiration < System.currentTimeMillis())
+				{
 					ThreadPoolManager.getInstance().scheduleGeneral(new MessageDeletionTask(msgId), 10000);
 					ThreadPoolManager.getInstance().scheduleGeneral(new MessageDeletionTask(msgId), 10000);
+				}
 				else
 				else
+				{
 					ThreadPoolManager.getInstance().scheduleGeneral(new MessageDeletionTask(msgId), expiration - System.currentTimeMillis());
 					ThreadPoolManager.getInstance().scheduleGeneral(new MessageDeletionTask(msgId), expiration - System.currentTimeMillis());
+				}
 			}
 			}
 			rset1.close();
 			rset1.close();
 			statement.close();
 			statement.close();
@@ -100,10 +104,10 @@ public class MailManager
 		final int objectId = player.getObjectId();
 		final int objectId = player.getObjectId();
 		for (Message msg : getMessages())
 		for (Message msg : getMessages())
 		{
 		{
-			if (msg != null
-					&& msg.getReceiverId() == objectId
-					&& msg.isUnread())
+			if ((msg != null) && (msg.getReceiverId() == objectId) && msg.isUnread())
+			{
 				return true;
 				return true;
+			}
 		}
 		}
 		return false;
 		return false;
 	}
 	}
@@ -113,10 +117,10 @@ public class MailManager
 		int size = 0;
 		int size = 0;
 		for (Message msg : getMessages())
 		for (Message msg : getMessages())
 		{
 		{
-			if (msg != null
-					&& msg.getReceiverId() == objectId
-					&& !msg.isDeletedByReceiver())
+			if ((msg != null) && (msg.getReceiverId() == objectId) && !msg.isDeletedByReceiver())
+			{
 				size++;
 				size++;
+			}
 		}
 		}
 		return size;
 		return size;
 	}
 	}
@@ -126,10 +130,10 @@ public class MailManager
 		int size = 0;
 		int size = 0;
 		for (Message msg : getMessages())
 		for (Message msg : getMessages())
 		{
 		{
-			if (msg != null
-					&& msg.getSenderId() == objectId
-					&& !msg.isDeletedBySender())
+			if ((msg != null) && (msg.getSenderId() == objectId) && !msg.isDeletedBySender())
+			{
 				size++;
 				size++;
+			}
 		}
 		}
 		return size;
 		return size;
 	}
 	}
@@ -139,10 +143,10 @@ public class MailManager
 		List<Message> inbox = new FastList<>();
 		List<Message> inbox = new FastList<>();
 		for (Message msg : getMessages())
 		for (Message msg : getMessages())
 		{
 		{
-			if (msg != null
-					&& msg.getReceiverId() == objectId
-					&& !msg.isDeletedByReceiver())
+			if ((msg != null) && (msg.getReceiverId() == objectId) && !msg.isDeletedByReceiver())
+			{
 				inbox.add(msg);
 				inbox.add(msg);
+			}
 		}
 		}
 		return inbox;
 		return inbox;
 	}
 	}
@@ -152,10 +156,10 @@ public class MailManager
 		List<Message> outbox = new FastList<>();
 		List<Message> outbox = new FastList<>();
 		for (Message msg : getMessages())
 		for (Message msg : getMessages())
 		{
 		{
-			if (msg != null
-					&& msg.getSenderId() == objectId
-					&& !msg.isDeletedBySender())
+			if ((msg != null) && (msg.getSenderId() == objectId) && !msg.isDeletedBySender())
+			{
 				outbox.add(msg);
 				outbox.add(msg);
+			}
 		}
 		}
 		return outbox;
 		return outbox;
 	}
 	}
@@ -176,7 +180,9 @@ public class MailManager
 		
 		
 		final L2PcInstance receiver = L2World.getInstance().getPlayer(msg.getReceiverId());
 		final L2PcInstance receiver = L2World.getInstance().getPlayer(msg.getReceiverId());
 		if (receiver != null)
 		if (receiver != null)
+		{
 			receiver.sendPacket(ExNoticePostArrived.valueOf(true));
 			receiver.sendPacket(ExNoticePostArrived.valueOf(true));
+		}
 		
 		
 		ThreadPoolManager.getInstance().scheduleGeneral(new MessageDeletionTask(msg.getId()), msg.getExpiration() - System.currentTimeMillis());
 		ThreadPoolManager.getInstance().scheduleGeneral(new MessageDeletionTask(msg.getId()), msg.getExpiration() - System.currentTimeMillis());
 	}
 	}
@@ -197,7 +203,9 @@ public class MailManager
 		{
 		{
 			final Message msg = getMessage(_msgId);
 			final Message msg = getMessage(_msgId);
 			if (msg == null)
 			if (msg == null)
+			{
 				return;
 				return;
+			}
 			
 			
 			if (msg.hasAttachments())
 			if (msg.hasAttachments())
 			{
 			{
@@ -210,7 +218,9 @@ public class MailManager
 						sender.sendPacket(SystemMessageId.MAIL_RETURNED);
 						sender.sendPacket(SystemMessageId.MAIL_RETURNED);
 					}
 					}
 					else
 					else
+					{
 						msg.getAttachments().returnToWh(null);
 						msg.getAttachments().returnToWh(null);
+					}
 					
 					
 					msg.getAttachments().deleteMe();
 					msg.getAttachments().deleteMe();
 					msg.removeAttachments();
 					msg.removeAttachments();
@@ -219,7 +229,7 @@ public class MailManager
 					if (receiver != null)
 					if (receiver != null)
 					{
 					{
 						SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.MAIL_RETURNED);
 						SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.MAIL_RETURNED);
-						//sm.addString(msg.getReceiverName());
+						// sm.addString(msg.getReceiverName());
 						receiver.sendPacket(sm);
 						receiver.sendPacket(sm);
 					}
 					}
 				}
 				}

Some files were not shown because too many files changed in this diff