FortUpdater.java 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* This program is free software: you can redistribute it and/or modify it under
  2. * the terms of the GNU General Public License as published by the Free Software
  3. * Foundation, either version 3 of the License, or (at your option) any later
  4. * version.
  5. *
  6. * This program is distributed in the hope that it will be useful, but WITHOUT
  7. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  9. * details.
  10. *
  11. * You should have received a copy of the GNU General Public License along with
  12. * this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. package com.l2jserver.gameserver;
  15. import java.util.logging.Logger;
  16. import com.l2jserver.Config;
  17. import com.l2jserver.gameserver.model.L2Clan;
  18. import com.l2jserver.gameserver.model.entity.Fort;
  19. /**
  20. *
  21. * Vice - 2008
  22. * Class managing periodical events with castle
  23. *
  24. */
  25. public class FortUpdater implements Runnable
  26. {
  27. protected static Logger _log = Logger.getLogger(FortUpdater.class.getName());
  28. private L2Clan _clan;
  29. private Fort _fort;
  30. private int _runCount;
  31. public FortUpdater(Fort fort, L2Clan clan, int runCount)
  32. {
  33. _fort = fort;
  34. _clan = clan;
  35. _runCount = runCount;
  36. }
  37. public void run()
  38. {
  39. try
  40. {
  41. _runCount++;
  42. if (_fort.getOwnerClan() == null || _fort.getOwnerClan() != _clan)
  43. return;
  44. _fort.setBloodOathReward(_fort.getBloodOathReward() + Config.FS_BLOOD_OATH_COUNT);
  45. }
  46. catch (Exception e)
  47. {
  48. e.printStackTrace();
  49. }
  50. }
  51. }