EffectMasterHandler.java 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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.AbortCast;
  25. import handlers.effecthandlers.Betray;
  26. import handlers.effecthandlers.BigHead;
  27. import handlers.effecthandlers.BlockResurrection;
  28. import handlers.effecthandlers.Bluff;
  29. import handlers.effecthandlers.Buff;
  30. import handlers.effecthandlers.Cancel;
  31. import handlers.effecthandlers.CancelAll;
  32. import handlers.effecthandlers.CancelDebuff;
  33. import handlers.effecthandlers.ChameleonRest;
  34. import handlers.effecthandlers.ChanceSkillTrigger;
  35. import handlers.effecthandlers.CharmOfCourage;
  36. import handlers.effecthandlers.CharmOfLuck;
  37. import handlers.effecthandlers.ClanGate;
  38. import handlers.effecthandlers.ConfuseMob;
  39. import handlers.effecthandlers.Confusion;
  40. import handlers.effecthandlers.CpDamPercent;
  41. import handlers.effecthandlers.CpHeal;
  42. import handlers.effecthandlers.CpHealOverTime;
  43. import handlers.effecthandlers.CpHealPercent;
  44. import handlers.effecthandlers.CrystalGradeModify;
  45. import handlers.effecthandlers.DamOverTime;
  46. import handlers.effecthandlers.DamOverTimePercent;
  47. import handlers.effecthandlers.Debuff;
  48. import handlers.effecthandlers.Disarm;
  49. import handlers.effecthandlers.DispelBySlot;
  50. import handlers.effecthandlers.EnemyCharge;
  51. import handlers.effecthandlers.FakeDeath;
  52. import handlers.effecthandlers.Fear;
  53. import handlers.effecthandlers.Fusion;
  54. import handlers.effecthandlers.Grow;
  55. import handlers.effecthandlers.Harvesting;
  56. import handlers.effecthandlers.Heal;
  57. import handlers.effecthandlers.HealOverTime;
  58. import handlers.effecthandlers.HealPercent;
  59. import handlers.effecthandlers.Hide;
  60. import handlers.effecthandlers.ImmobileBuff;
  61. import handlers.effecthandlers.ImmobilePetBuff;
  62. import handlers.effecthandlers.IncreaseCharges;
  63. import handlers.effecthandlers.Invincible;
  64. import handlers.effecthandlers.ManaDamOverTime;
  65. import handlers.effecthandlers.ManaHeal;
  66. import handlers.effecthandlers.ManaHealByLevel;
  67. import handlers.effecthandlers.ManaHealOverTime;
  68. import handlers.effecthandlers.ManaHealPercent;
  69. import handlers.effecthandlers.MpConsumePerLevel;
  70. import handlers.effecthandlers.Mute;
  71. import handlers.effecthandlers.Negate;
  72. import handlers.effecthandlers.NoblesseBless;
  73. import handlers.effecthandlers.Paralyze;
  74. import handlers.effecthandlers.Petrification;
  75. import handlers.effecthandlers.PhoenixBless;
  76. import handlers.effecthandlers.PhysicalAttackMute;
  77. import handlers.effecthandlers.PhysicalMute;
  78. import handlers.effecthandlers.ProtectionBlessing;
  79. import handlers.effecthandlers.RandomizeHate;
  80. import handlers.effecthandlers.Recovery;
  81. import handlers.effecthandlers.Relax;
  82. import handlers.effecthandlers.RemoveTarget;
  83. import handlers.effecthandlers.RestorationRandom;
  84. import handlers.effecthandlers.Root;
  85. import handlers.effecthandlers.ServitorShare;
  86. import handlers.effecthandlers.Signet;
  87. import handlers.effecthandlers.SignetAntiSummon;
  88. import handlers.effecthandlers.SignetMDam;
  89. import handlers.effecthandlers.SignetNoise;
  90. import handlers.effecthandlers.SilentMove;
  91. import handlers.effecthandlers.Sleep;
  92. import handlers.effecthandlers.Spoil;
  93. import handlers.effecthandlers.Stun;
  94. import handlers.effecthandlers.SummonAgathion;
  95. import handlers.effecthandlers.TargetMe;
  96. import handlers.effecthandlers.ThrowUp;
  97. import handlers.effecthandlers.TransferDamage;
  98. import handlers.effecthandlers.Transformation;
  99. import handlers.effecthandlers.UnsummonAgathion;
  100. import handlers.effecthandlers.Warp;
  101. /**
  102. * Effect Master handler.
  103. * @author BiggBoss
  104. */
  105. public final class EffectMasterHandler
  106. {
  107. private static final Logger _log = Logger.getLogger(EffectMasterHandler.class.getName());
  108. private static final Class<?> _loadInstances = EffectHandler.class;
  109. private static final Class<?>[] _effects =
  110. {
  111. AbortCast.class,
  112. Betray.class,
  113. BigHead.class,
  114. BlockResurrection.class,
  115. Bluff.class,
  116. Buff.class,
  117. Cancel.class,
  118. CancelAll.class,
  119. CancelDebuff.class,
  120. ChameleonRest.class,
  121. ChanceSkillTrigger.class,
  122. CharmOfCourage.class,
  123. CharmOfLuck.class,
  124. ClanGate.class,
  125. ConfuseMob.class,
  126. Confusion.class,
  127. CpHeal.class,
  128. CpHealOverTime.class,
  129. CpHealPercent.class,
  130. CrystalGradeModify.class,
  131. CpDamPercent.class,
  132. DamOverTime.class,
  133. DamOverTimePercent.class,
  134. Debuff.class,
  135. DispelBySlot.class,
  136. Disarm.class,
  137. EnemyCharge.class,
  138. FakeDeath.class,
  139. Fear.class,
  140. Fusion.class,
  141. Grow.class,
  142. Harvesting.class,
  143. HealOverTime.class,
  144. HealPercent.class,
  145. Heal.class,
  146. Hide.class,
  147. ImmobileBuff.class,
  148. IncreaseCharges.class,
  149. ImmobilePetBuff.class,
  150. Invincible.class,
  151. ManaDamOverTime.class,
  152. ManaHeal.class,
  153. ManaHealByLevel.class,
  154. ManaHealOverTime.class,
  155. ManaHealPercent.class,
  156. MpConsumePerLevel.class,
  157. Mute.class,
  158. Negate.class,
  159. NoblesseBless.class,
  160. Paralyze.class,
  161. Petrification.class,
  162. PhoenixBless.class,
  163. PhysicalAttackMute.class,
  164. PhysicalMute.class,
  165. ProtectionBlessing.class,
  166. RandomizeHate.class,
  167. Recovery.class,
  168. Relax.class,
  169. RemoveTarget.class,
  170. RestorationRandom.class,
  171. Root.class,
  172. ServitorShare.class,
  173. Signet.class,
  174. SignetAntiSummon.class,
  175. SignetMDam.class,
  176. SignetNoise.class,
  177. SilentMove.class,
  178. Sleep.class,
  179. Spoil.class,
  180. Stun.class,
  181. SummonAgathion.class,
  182. TargetMe.class,
  183. ThrowUp.class,
  184. TransferDamage.class,
  185. Transformation.class,
  186. UnsummonAgathion.class,
  187. Warp.class,
  188. };
  189. public static void main(String[] args)
  190. {
  191. Object loadInstance = null;
  192. Method method = null;
  193. try
  194. {
  195. method = _loadInstances.getMethod("getInstance");
  196. loadInstance = method.invoke(_loadInstances);
  197. }
  198. catch (Exception e)
  199. {
  200. _log.log(Level.WARNING, "Failed invoking getInstance method for handler: " + _loadInstances.getSimpleName(), e);
  201. return;
  202. }
  203. method = null; // Releasing variable for next method
  204. for (Class<?> c : _effects)
  205. {
  206. try
  207. {
  208. if (c == null)
  209. {
  210. continue; // Disabled handler
  211. }
  212. if (method == null)
  213. {
  214. method = loadInstance.getClass().getMethod("registerHandler", Class.class);
  215. }
  216. method.invoke(loadInstance, c);
  217. }
  218. catch (Exception e)
  219. {
  220. _log.log(Level.WARNING, "Failed loading effect handler" + ((c == null) ? "!" : ":" + c.getSimpleName()), e);
  221. continue;
  222. }
  223. }
  224. // And lets try get size
  225. try
  226. {
  227. method = loadInstance.getClass().getMethod("size");
  228. Object returnVal = method.invoke(loadInstance);
  229. _log.log(Level.INFO, loadInstance.getClass().getSimpleName() + ": Loaded " + returnVal + " Handlers");
  230. }
  231. catch (Exception e)
  232. {
  233. _log.log(Level.WARNING, "Failed invoking size method for handler: " + loadInstance.getClass().getSimpleName(), e);
  234. }
  235. }
  236. }