TaskOlympiadSave.java 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 net.sf.l2j.gameserver.taskmanager.tasks;
  16. import java.util.logging.Logger;
  17. import net.sf.l2j.gameserver.model.olympiad.Olympiad;
  18. import net.sf.l2j.gameserver.taskmanager.Task;
  19. import net.sf.l2j.gameserver.taskmanager.TaskManager;
  20. import net.sf.l2j.gameserver.taskmanager.TaskTypes;
  21. import net.sf.l2j.gameserver.taskmanager.TaskManager.ExecutedTask;
  22. /**
  23. * Updates all data of Olympiad nobles in db
  24. *
  25. * @author godson
  26. */
  27. public class TaskOlympiadSave extends Task
  28. {
  29. private static final Logger _log = Logger.getLogger(TaskOlympiadSave.class.getName());
  30. public static final String NAME = "olympiad_save";
  31. /**
  32. *
  33. * @see net.sf.l2j.gameserver.taskmanager.Task#getName()
  34. */
  35. @Override
  36. public String getName()
  37. {
  38. return NAME;
  39. }
  40. /**
  41. *
  42. * @see net.sf.l2j.gameserver.taskmanager.Task#onTimeElapsed(net.sf.l2j.gameserver.taskmanager.TaskManager.ExecutedTask)
  43. */
  44. @Override
  45. public void onTimeElapsed(ExecutedTask task)
  46. {
  47. if (Olympiad.getInstance().inCompPeriod())
  48. {
  49. Olympiad.getInstance().saveOlympiadStatus();
  50. _log.info("Olympiad System: Data updated.");
  51. }
  52. }
  53. /**
  54. *
  55. * @see net.sf.l2j.gameserver.taskmanager.Task#initializate()
  56. */
  57. @Override
  58. public void initializate()
  59. {
  60. super.initializate();
  61. TaskManager.addUniqueTask(NAME, TaskTypes.TYPE_FIXED_SHEDULED, "900000", "1800000", "");
  62. }
  63. }