EffectMasterHandler.java 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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. AbortCast.class,
  36. RebalanceHP.class,
  37. Betray.class,
  38. BigHead.class,
  39. BlockBuffSlot.class,
  40. BlockResurrection.class,
  41. Bluff.class,
  42. Buff.class,
  43. Cancel.class,
  44. CancelAll.class,
  45. CancelDebuff.class,
  46. ChameleonRest.class,
  47. ChanceSkillTrigger.class,
  48. ChangeFace.class,
  49. ChangeHairColor.class,
  50. ChangeHairStyle.class,
  51. CharmOfCourage.class,
  52. CharmOfLuck.class,
  53. ClanGate.class,
  54. Confusion.class,
  55. ConsumeBody.class,
  56. ConvertItem.class,
  57. CpDamPercent.class,
  58. CpHeal.class,
  59. CpHealOverTime.class,
  60. CpHealPercent.class,
  61. CrystalGradeModify.class,
  62. CpDamPercent.class,
  63. DamOverTime.class,
  64. DamOverTimePercent.class,
  65. DeathLink.class,
  66. Debuff.class,
  67. DispelBySlot.class,
  68. Disarm.class,
  69. EnemyCharge.class,
  70. EnergyAttack.class,
  71. EnlargeAbnormalSlot.class,
  72. FakeDeath.class,
  73. FatalBlow.class,
  74. Fear.class,
  75. FocusEnergy.class,
  76. FocusMaxEnergy.class,
  77. FocusSouls.class,
  78. Fusion.class,
  79. GiveSp.class,
  80. Grow.class,
  81. Harvesting.class,
  82. HealOverTime.class,
  83. HealPercent.class,
  84. Heal.class,
  85. Hide.class,
  86. HpByLevel.class,
  87. HpDrain.class,
  88. ImmobileBuff.class,
  89. ImmobilePetBuff.class,
  90. Invincible.class,
  91. Lethal.class,
  92. Lucky.class,
  93. MagicalAttack.class,
  94. MagicalAttackMp.class,
  95. ManaDamOverTime.class,
  96. ManaHeal.class,
  97. ManaHealByLevel.class,
  98. ManaHealOverTime.class,
  99. ManaHealPercent.class,
  100. MpByLevel.class,
  101. MpConsumePerLevel.class,
  102. Mute.class,
  103. NoblesseBless.class,
  104. Paralyze.class,
  105. Petrification.class,
  106. PhoenixBless.class,
  107. PhysicalAttack.class,
  108. PhysicalAttackHpLink.class,
  109. PhysicalAttackMute.class,
  110. PhysicalMute.class,
  111. ProtectionBlessing.class,
  112. RandomizeHate.class,
  113. Recovery.class,
  114. Relax.class,
  115. RemoveTarget.class,
  116. Restoration.class,
  117. RestorationRandom.class,
  118. Root.class,
  119. ServitorShare.class,
  120. Signet.class,
  121. SignetAntiSummon.class,
  122. SignetMDam.class,
  123. SignetNoise.class,
  124. SilentMove.class,
  125. Sleep.class,
  126. Spoil.class,
  127. StaticDamage.class,
  128. Stun.class,
  129. SummonAgathion.class,
  130. SummonNpc.class,
  131. SummonPet.class,
  132. SummonTrap.class,
  133. Sweeper.class,
  134. TargetMe.class,
  135. ThrowUp.class,
  136. TransferDamage.class,
  137. Transformation.class,
  138. UnsummonAgathion.class,
  139. Warp.class,
  140. };
  141. public static void main(String[] args)
  142. {
  143. Object loadInstance = null;
  144. Method method = null;
  145. try
  146. {
  147. method = LOAD_INSTANCES.getMethod("getInstance");
  148. loadInstance = method.invoke(LOAD_INSTANCES);
  149. }
  150. catch (Exception e)
  151. {
  152. _log.log(Level.WARNING, "Failed invoking getInstance method for handler: " + LOAD_INSTANCES.getSimpleName(), e);
  153. return;
  154. }
  155. method = null; // Releasing variable for next method
  156. for (Class<?> c : EFFECTS)
  157. {
  158. if (c == null)
  159. {
  160. continue; // Disabled handler
  161. }
  162. try
  163. {
  164. if (method == null)
  165. {
  166. method = loadInstance.getClass().getMethod("registerHandler", Class.class);
  167. }
  168. method.invoke(loadInstance, c);
  169. }
  170. catch (Exception e)
  171. {
  172. _log.log(Level.WARNING, "Failed loading effect handler: " + c.getSimpleName(), e);
  173. continue;
  174. }
  175. }
  176. // And lets try get size
  177. try
  178. {
  179. method = loadInstance.getClass().getMethod("size");
  180. Object returnVal = method.invoke(loadInstance);
  181. _log.log(Level.INFO, loadInstance.getClass().getSimpleName() + ": Loaded " + returnVal + " Handlers");
  182. }
  183. catch (Exception e)
  184. {
  185. _log.log(Level.WARNING, "Failed invoking size method for handler: " + loadInstance.getClass().getSimpleName(), e);
  186. }
  187. }
  188. }