TaskSevenSignsUpdate.java 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 com.l2jserver.gameserver.taskmanager.tasks;
  16. import com.l2jserver.gameserver.SevenSigns;
  17. import com.l2jserver.gameserver.SevenSignsFestival;
  18. import com.l2jserver.gameserver.taskmanager.Task;
  19. import com.l2jserver.gameserver.taskmanager.TaskManager;
  20. import com.l2jserver.gameserver.taskmanager.TaskManager.ExecutedTask;
  21. import com.l2jserver.gameserver.taskmanager.TaskTypes;
  22. /**
  23. * Updates all data for the Seven Signs and Festival of Darkness engines, when time is elapsed.
  24. * @author Tempy
  25. */
  26. public class TaskSevenSignsUpdate extends Task
  27. {
  28. private static final String NAME = "seven_signs_update";
  29. @Override
  30. public String getName()
  31. {
  32. return NAME;
  33. }
  34. @Override
  35. public void onTimeElapsed(ExecutedTask task)
  36. {
  37. try
  38. {
  39. SevenSigns.getInstance().saveSevenSignsStatus();
  40. if (!SevenSigns.getInstance().isSealValidationPeriod())
  41. {
  42. SevenSignsFestival.getInstance().saveFestivalData(false);
  43. }
  44. _log.info("SevenSigns: Data updated successfully.");
  45. }
  46. catch (Exception e)
  47. {
  48. _log.warning(getClass().getSimpleName() + ": SevenSigns: Failed to save Seven Signs configuration: " + e.getMessage());
  49. }
  50. }
  51. @Override
  52. public void initializate()
  53. {
  54. super.initializate();
  55. TaskManager.addUniqueTask(NAME, TaskTypes.TYPE_FIXED_SHEDULED, "1800000", "1800000", "");
  56. }
  57. }