FourSepulchersManagerSayTask.java 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (C) 2004-2015 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.instancemanager.tasks;
  20. import java.util.Calendar;
  21. import com.l2jserver.Config;
  22. import com.l2jserver.gameserver.ThreadPoolManager;
  23. import com.l2jserver.gameserver.instancemanager.FourSepulchersManager;
  24. /**
  25. * Four Sepulchers manager say task.
  26. * @author xban1x
  27. */
  28. public final class FourSepulchersManagerSayTask implements Runnable
  29. {
  30. @Override
  31. public void run()
  32. {
  33. if (FourSepulchersManager.getInstance().isAttackTime())
  34. {
  35. final Calendar tmp = Calendar.getInstance();
  36. tmp.setTimeInMillis(Calendar.getInstance().getTimeInMillis() - FourSepulchersManager.getInstance().getWarmUpTimeEnd());
  37. if ((tmp.get(Calendar.MINUTE) + 5) < Config.FS_TIME_ATTACK)
  38. {
  39. FourSepulchersManager.getInstance().managerSay((byte) tmp.get(Calendar.MINUTE)); // byte
  40. // because
  41. // minute
  42. // cannot be
  43. // more than
  44. // 59
  45. ThreadPoolManager.getInstance().scheduleGeneral(new FourSepulchersManagerSayTask(), 5 * 60000);
  46. }
  47. // attack time ending chat
  48. else if ((tmp.get(Calendar.MINUTE) + 5) >= Config.FS_TIME_ATTACK)
  49. {
  50. FourSepulchersManager.getInstance().managerSay((byte) 90); // sending a unique id :D
  51. }
  52. }
  53. else if (FourSepulchersManager.getInstance().isEntryTime())
  54. {
  55. FourSepulchersManager.getInstance().managerSay((byte) 0);
  56. }
  57. }
  58. }