EffectMasterHandler.java 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package handlers;
  16. import handlers.effecthandlers.AbortCast;
  17. import handlers.effecthandlers.Betray;
  18. import handlers.effecthandlers.BigHead;
  19. import handlers.effecthandlers.BlockResurrection;
  20. import handlers.effecthandlers.Bluff;
  21. import handlers.effecthandlers.Buff;
  22. import handlers.effecthandlers.Cancel;
  23. import handlers.effecthandlers.CancelAll;
  24. import handlers.effecthandlers.CancelDebuff;
  25. import handlers.effecthandlers.ChameleonRest;
  26. import handlers.effecthandlers.ChanceSkillTrigger;
  27. import handlers.effecthandlers.CharmOfCourage;
  28. import handlers.effecthandlers.CharmOfLuck;
  29. import handlers.effecthandlers.ClanGate;
  30. import handlers.effecthandlers.ConfuseMob;
  31. import handlers.effecthandlers.Confusion;
  32. import handlers.effecthandlers.CpDamPercent;
  33. import handlers.effecthandlers.CpHeal;
  34. import handlers.effecthandlers.CpHealOverTime;
  35. import handlers.effecthandlers.CpHealPercent;
  36. import handlers.effecthandlers.DamOverTime;
  37. import handlers.effecthandlers.Debuff;
  38. import handlers.effecthandlers.Disarm;
  39. import handlers.effecthandlers.DispelBySlot;
  40. import handlers.effecthandlers.EnemyCharge;
  41. import handlers.effecthandlers.FakeDeath;
  42. import handlers.effecthandlers.Fear;
  43. import handlers.effecthandlers.Fusion;
  44. import handlers.effecthandlers.Grow;
  45. import handlers.effecthandlers.Heal;
  46. import handlers.effecthandlers.HealOverTime;
  47. import handlers.effecthandlers.HealPercent;
  48. import handlers.effecthandlers.Hide;
  49. import handlers.effecthandlers.ImmobileBuff;
  50. import handlers.effecthandlers.ImmobilePetBuff;
  51. import handlers.effecthandlers.IncreaseCharges;
  52. import handlers.effecthandlers.Invincible;
  53. import handlers.effecthandlers.ManaDamOverTime;
  54. import handlers.effecthandlers.ManaHeal;
  55. import handlers.effecthandlers.ManaHealByLevel;
  56. import handlers.effecthandlers.ManaHealOverTime;
  57. import handlers.effecthandlers.ManaHealPercent;
  58. import handlers.effecthandlers.MpConsumePerLevel;
  59. import handlers.effecthandlers.Mute;
  60. import handlers.effecthandlers.Negate;
  61. import handlers.effecthandlers.NoblesseBless;
  62. import handlers.effecthandlers.Paralyze;
  63. import handlers.effecthandlers.Petrification;
  64. import handlers.effecthandlers.PhoenixBless;
  65. import handlers.effecthandlers.PhysicalAttackMute;
  66. import handlers.effecthandlers.PhysicalMute;
  67. import handlers.effecthandlers.ProtectionBlessing;
  68. import handlers.effecthandlers.RandomizeHate;
  69. import handlers.effecthandlers.Recovery;
  70. import handlers.effecthandlers.Relax;
  71. import handlers.effecthandlers.RemoveTarget;
  72. import handlers.effecthandlers.Root;
  73. import handlers.effecthandlers.Signet;
  74. import handlers.effecthandlers.SignetAntiSummon;
  75. import handlers.effecthandlers.SignetMDam;
  76. import handlers.effecthandlers.SignetNoise;
  77. import handlers.effecthandlers.SilentMove;
  78. import handlers.effecthandlers.Sleep;
  79. import handlers.effecthandlers.Spoil;
  80. import handlers.effecthandlers.Stun;
  81. import handlers.effecthandlers.TargetMe;
  82. import handlers.effecthandlers.ThrowUp;
  83. import handlers.effecthandlers.TransferDamage;
  84. import handlers.effecthandlers.Transformation;
  85. import handlers.effecthandlers.Warp;
  86. import java.lang.reflect.Method;
  87. import java.util.logging.Level;
  88. import java.util.logging.Logger;
  89. import com.l2jserver.gameserver.handler.EffectHandler;
  90. /**
  91. * @author BiggBoss
  92. */
  93. public final class EffectMasterHandler
  94. {
  95. private static final Logger _log = Logger.getLogger(EffectMasterHandler.class.getName());
  96. private static final Class<?> _loadInstances = EffectHandler.class;
  97. private static final Class<?>[] _effects =
  98. {
  99. AbortCast.class,
  100. Betray.class,
  101. BigHead.class,
  102. BlockResurrection.class,
  103. Bluff.class,
  104. Buff.class,
  105. Cancel.class,
  106. CancelAll.class,
  107. CancelDebuff.class,
  108. ChameleonRest.class,
  109. ChanceSkillTrigger.class,
  110. CharmOfCourage.class,
  111. CharmOfLuck.class,
  112. ClanGate.class,
  113. ConfuseMob.class,
  114. Confusion.class,
  115. CpHeal.class,
  116. CpHealOverTime.class,
  117. CpHealPercent.class,
  118. CpDamPercent.class,
  119. DamOverTime.class,
  120. Debuff.class,
  121. DispelBySlot.class,
  122. Disarm.class,
  123. EnemyCharge.class,
  124. FakeDeath.class,
  125. Fear.class,
  126. Fusion.class,
  127. Grow.class,
  128. HealOverTime.class,
  129. HealPercent.class,
  130. Heal.class,
  131. Hide.class,
  132. ImmobileBuff.class,
  133. IncreaseCharges.class,
  134. ImmobilePetBuff.class,
  135. Invincible.class,
  136. ManaDamOverTime.class,
  137. ManaHeal.class,
  138. ManaHealByLevel.class,
  139. ManaHealOverTime.class,
  140. ManaHealPercent.class,
  141. MpConsumePerLevel.class,
  142. Mute.class,
  143. Negate.class,
  144. NoblesseBless.class,
  145. Paralyze.class,
  146. Petrification.class,
  147. PhoenixBless.class,
  148. PhysicalAttackMute.class,
  149. PhysicalMute.class,
  150. ProtectionBlessing.class,
  151. RandomizeHate.class,
  152. Recovery.class,
  153. Relax.class,
  154. RemoveTarget.class,
  155. Root.class,
  156. Signet.class,
  157. SignetAntiSummon.class,
  158. SignetMDam.class,
  159. SignetNoise.class,
  160. SilentMove.class,
  161. Sleep.class,
  162. Spoil.class,
  163. Stun.class,
  164. TargetMe.class,
  165. ThrowUp.class,
  166. TransferDamage.class,
  167. Transformation.class,
  168. Warp.class,
  169. };
  170. public static void main(String[] args)
  171. {
  172. Object loadInstance = null;
  173. Method method = null;
  174. try
  175. {
  176. method = _loadInstances.getMethod("getInstance");
  177. loadInstance = method.invoke(_loadInstances);
  178. }
  179. catch (Exception e)
  180. {
  181. _log.log(Level.WARNING, "Failed invoking getInstance method for handler: " + _loadInstances.getSimpleName(), e);
  182. return;
  183. }
  184. method = null; // Releasing variable for next method
  185. for (Class<?> c : _effects)
  186. {
  187. try
  188. {
  189. if (c == null)
  190. continue; // Disabled handler
  191. if (method == null)
  192. method = loadInstance.getClass().getMethod("registerHandler", String.class, Class.class);
  193. method.invoke(loadInstance, c.getSimpleName(), c);
  194. }
  195. catch (Exception e)
  196. {
  197. _log.log(Level.WARNING, "Failed loading handler: " + c.getSimpleName(), e);
  198. continue;
  199. }
  200. }
  201. // And lets try get size
  202. try
  203. {
  204. method = loadInstance.getClass().getMethod("size");
  205. Object returnVal = method.invoke(loadInstance);
  206. _log.log(Level.INFO, loadInstance.getClass().getSimpleName() + ": Loaded " + returnVal + " Handlers");
  207. }
  208. catch (Exception e)
  209. {
  210. _log.log(Level.WARNING, "Failed invoking size method for handler: " + loadInstance.getClass().getSimpleName(), e);
  211. }
  212. }
  213. }