EffectMasterHandler.java 7.0 KB

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