EffectTickTask.java 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (C) 2004-2014 L2J Server
  3. *
  4. * This file is part of L2J Server.
  5. *
  6. * L2J Server 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 Server 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 com.l2jserver.gameserver.model.effects;
  20. import java.util.concurrent.atomic.AtomicInteger;
  21. import com.l2jserver.gameserver.model.skills.BuffInfo;
  22. /**
  23. * Effect tick task.
  24. * @author Zoey76
  25. */
  26. public class EffectTickTask implements Runnable
  27. {
  28. private final BuffInfo _info;
  29. private final AbstractEffect _effect;
  30. private final AtomicInteger _tickCount = new AtomicInteger();
  31. /**
  32. * EffectTickTask constructor.
  33. * @param info the buff info
  34. * @param effect the effect
  35. */
  36. public EffectTickTask(BuffInfo info, AbstractEffect effect)
  37. {
  38. _info = info;
  39. _effect = effect;
  40. }
  41. /**
  42. * Gets the buff info.
  43. * @return the buff info
  44. */
  45. public BuffInfo getBuffInfo()
  46. {
  47. return _info;
  48. }
  49. /**
  50. * Gets the effect.
  51. * @return the effect
  52. */
  53. public AbstractEffect getEffect()
  54. {
  55. return _effect;
  56. }
  57. /**
  58. * Gets the current tick count.
  59. * @return the tick count
  60. */
  61. public int getTickCount()
  62. {
  63. return _tickCount.get();
  64. }
  65. @Override
  66. public void run()
  67. {
  68. _info.onTick(_effect, _tickCount.incrementAndGet());
  69. }
  70. }