EffectMasterHandler.java 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. /*
  2. * Copyright (C) 2004-2013 L2J DataPack
  3. *
  4. * This file is part of L2J DataPack.
  5. *
  6. * L2J DataPack is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J DataPack is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package handlers;
  20. import java.lang.reflect.Method;
  21. import java.util.logging.Level;
  22. import java.util.logging.Logger;
  23. import com.l2jserver.gameserver.handler.EffectHandler;
  24. import handlers.effecthandlers.*;
  25. /**
  26. * Effect Master handler.
  27. * @author BiggBoss
  28. */
  29. public final class EffectMasterHandler
  30. {
  31. private static final Logger _log = Logger.getLogger(EffectMasterHandler.class.getName());
  32. private static final Class<?> LOAD_INSTANCES = EffectHandler.class;
  33. private static final Class<?>[] EFFECTS =
  34. {
  35. AddHate.class,
  36. AttackTrait.class,
  37. Backstab.class,
  38. Betray.class,
  39. BigHead.class,
  40. Blink.class,
  41. BlockAction.class,
  42. BlockChat.class,
  43. BlockParty.class,
  44. BlockBuffSlot.class,
  45. BlockResurrection.class,
  46. Bluff.class,
  47. Buff.class,
  48. CallParty.class,
  49. CallPc.class,
  50. ChameleonRest.class,
  51. ChanceSkillTrigger.class,
  52. ChangeFace.class,
  53. ChangeFishingMastery.class,
  54. ChangeHairColor.class,
  55. ChangeHairStyle.class,
  56. CharmOfCourage.class,
  57. CharmOfLuck.class,
  58. ClanGate.class,
  59. Confuse.class,
  60. ConsumeBody.class,
  61. ConvertItem.class,
  62. CpDamPercent.class,
  63. CpHeal.class,
  64. CpHealOverTime.class,
  65. CpHealPercent.class,
  66. CrystalGradeModify.class,
  67. CubicMastery.class,
  68. DamOverTime.class,
  69. DamOverTimePercent.class,
  70. DeathLink.class,
  71. Debuff.class,
  72. DefenceTrait.class,
  73. DeleteHate.class,
  74. DeleteHateOfMe.class,
  75. Disarm.class,
  76. DispelAll.class,
  77. DispelByCategory.class,
  78. DispelBySlot.class,
  79. DispelBySlotProbability.class,
  80. EnemyCharge.class,
  81. EnergyAttack.class,
  82. EnlargeAbnormalSlot.class,
  83. Escape.class,
  84. FakeDeath.class,
  85. FatalBlow.class,
  86. Fear.class,
  87. FocusEnergy.class,
  88. Flag.class,
  89. FocusMaxEnergy.class,
  90. FocusSouls.class,
  91. Fusion.class,
  92. GetAgro.class,
  93. GiveSp.class,
  94. Grow.class,
  95. Harvesting.class,
  96. Heal.class,
  97. HealOverTime.class,
  98. HealPercent.class,
  99. Hide.class,
  100. HpByLevel.class,
  101. HpDrain.class,
  102. ImmobileBuff.class,
  103. ImmobilePetBuff.class,
  104. Invincible.class,
  105. Lethal.class,
  106. Lucky.class,
  107. MagicalAttack.class,
  108. MagicalAttackMp.class,
  109. MagicalSoulAttack.class,
  110. ManaDamOverTime.class,
  111. ManaHeal.class,
  112. ManaHealByLevel.class,
  113. ManaHealOverTime.class,
  114. ManaHealPercent.class,
  115. MpByLevel.class,
  116. MpConsumePerLevel.class,
  117. Mute.class,
  118. NoblesseBless.class,
  119. NpcKill.class,
  120. OpenCommonRecipeBook.class,
  121. OpenDwarfRecipeBook.class,
  122. Paralyze.class,
  123. Passive.class,
  124. Petrification.class,
  125. PhoenixBless.class,
  126. PhysicalAttack.class,
  127. PhysicalAttackHpLink.class,
  128. PhysicalAttackMute.class,
  129. PhysicalMute.class,
  130. PhysicalSoulAttack.class,
  131. ProtectionBlessing.class,
  132. RandomizeHate.class,
  133. RebalanceHP.class,
  134. Recovery.class,
  135. RefuelAirship.class,
  136. Relax.class,
  137. Restoration.class,
  138. RestorationRandom.class,
  139. Resurrection.class,
  140. Root.class,
  141. ServitorShare.class,
  142. SetSkill.class,
  143. Signet.class,
  144. SignetAntiSummon.class,
  145. SignetMDam.class,
  146. SignetNoise.class,
  147. SilentMove.class,
  148. SkillTurning.class,
  149. Sleep.class,
  150. SoulBlow.class,
  151. SoulEating.class,
  152. Spoil.class,
  153. StaticDamage.class,
  154. StealAbnormal.class,
  155. Stun.class,
  156. SummonAgathion.class,
  157. SummonCubic.class,
  158. SummonNpc.class,
  159. SummonPet.class,
  160. SummonTrap.class,
  161. Sweeper.class,
  162. TargetCancel.class,
  163. TargetMe.class,
  164. TargetMeProbability.class,
  165. Teleport.class,
  166. TeleportToTarget.class,
  167. ThrowUp.class,
  168. TransferDamage.class,
  169. TransferHate.class,
  170. Transformation.class,
  171. TriggerSkillByDamage.class,
  172. UnsummonAgathion.class,
  173. VitalityPointUp.class,
  174. };
  175. public static void main(String[] args)
  176. {
  177. Object loadInstance = null;
  178. Method method = null;
  179. try
  180. {
  181. method = LOAD_INSTANCES.getMethod("getInstance");
  182. loadInstance = method.invoke(LOAD_INSTANCES);
  183. }
  184. catch (Exception e)
  185. {
  186. _log.log(Level.WARNING, "Failed invoking getInstance method for handler: " + LOAD_INSTANCES.getSimpleName(), e);
  187. return;
  188. }
  189. method = null; // Releasing variable for next method
  190. for (Class<?> c : EFFECTS)
  191. {
  192. if (c == null)
  193. {
  194. continue; // Disabled handler
  195. }
  196. try
  197. {
  198. if (method == null)
  199. {
  200. method = loadInstance.getClass().getMethod("registerHandler", Class.class);
  201. }
  202. method.invoke(loadInstance, c);
  203. }
  204. catch (Exception e)
  205. {
  206. _log.log(Level.WARNING, "Failed loading effect handler: " + c.getSimpleName(), e);
  207. continue;
  208. }
  209. }
  210. // And lets try get size
  211. try
  212. {
  213. method = loadInstance.getClass().getMethod("size");
  214. Object returnVal = method.invoke(loadInstance);
  215. _log.log(Level.INFO, loadInstance.getClass().getSimpleName() + ": Loaded " + returnVal + " Handlers");
  216. }
  217. catch (Exception e)
  218. {
  219. _log.log(Level.WARNING, "Failed invoking size method for handler: " + loadInstance.getClass().getSimpleName(), e);
  220. }
  221. }
  222. }