TopBBSManager.java 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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.communitybbs.Manager;
  16. import java.util.StringTokenizer;
  17. import com.l2jserver.gameserver.cache.HtmCache;
  18. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  19. import com.l2jserver.gameserver.network.serverpackets.ShowBoard;
  20. public class TopBBSManager extends BaseBBSManager
  21. {
  22. private TopBBSManager()
  23. {
  24. }
  25. /**
  26. *
  27. * @see com.l2jserver.gameserver.communitybbs.Manager.BaseBBSManager#parsecmd(java.lang.String, com.l2jserver.gameserver.model.actor.instance.L2PcInstance)
  28. */
  29. @Override
  30. public void parsecmd(String command, L2PcInstance activeChar)
  31. {
  32. if (command.equals("_bbstop"))
  33. {
  34. String content = HtmCache.getInstance().getHtm("data/html/CommunityBoard/index.htm");
  35. if (content == null)
  36. {
  37. content = "<html><body><br><br><center>404 :File Not foud: 'data/html/CommunityBoard/index.htm' </center></body></html>";
  38. }
  39. separateAndSend(content, activeChar);
  40. }
  41. else if (command.equals("_bbshome"))
  42. {
  43. String content = HtmCache.getInstance().getHtm("data/html/CommunityBoard/index.htm");
  44. if (content == null)
  45. {
  46. content = "<html><body><br><br><center>404 :File Not foud: 'data/html/CommunityBoard/index.htm' </center></body></html>";
  47. }
  48. separateAndSend(content, activeChar);
  49. }
  50. else if (command.startsWith("_bbstop;"))
  51. {
  52. StringTokenizer st = new StringTokenizer(command, ";");
  53. st.nextToken();
  54. int idp = Integer.parseInt(st.nextToken());
  55. String content = HtmCache.getInstance().getHtm("data/html/CommunityBoard/" + idp + ".htm");
  56. if (content == null)
  57. {
  58. content = "<html><body><br><br><center>404 :File Not foud: 'data/html/CommunityBoard/" + idp
  59. + ".htm' </center></body></html>";
  60. }
  61. separateAndSend(content, activeChar);
  62. }
  63. else
  64. {
  65. ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + command
  66. + " is not implemented yet</center><br><br></body></html>", "101");
  67. activeChar.sendPacket(sb);
  68. activeChar.sendPacket(new ShowBoard(null, "102"));
  69. activeChar.sendPacket(new ShowBoard(null, "103"));
  70. }
  71. }
  72. /**
  73. *
  74. * @see com.l2jserver.gameserver.communitybbs.Manager.BaseBBSManager#parsewrite(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, com.l2jserver.gameserver.model.actor.instance.L2PcInstance)
  75. */
  76. @Override
  77. public void parsewrite(String ar1, String ar2, String ar3, String ar4, String ar5, L2PcInstance activeChar)
  78. {
  79. // TODO Auto-generated method stub
  80. }
  81. /**
  82. * @return
  83. */
  84. public static TopBBSManager getInstance()
  85. {
  86. return SingletonHolder._instance;
  87. }
  88. @SuppressWarnings("synthetic-access")
  89. private static class SingletonHolder
  90. {
  91. protected static final TopBBSManager _instance = new TopBBSManager();
  92. }
  93. }