EffectMasterHandler.java 7.0 KB

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