2
0

TopBBSManager.java 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. @Override
  23. public void parsecmd(String command, L2PcInstance activeChar)
  24. {
  25. if (command.equals("_bbstop"))
  26. {
  27. String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/index.htm");
  28. if (content == null)
  29. {
  30. content = "<html><body><br><br><center>404 :File not found: 'data/html/CommunityBoard/index.htm' </center></body></html>";
  31. }
  32. separateAndSend(content, activeChar);
  33. }
  34. else if (command.equals("_bbshome"))
  35. {
  36. String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/index.htm");
  37. if (content == null)
  38. {
  39. content = "<html><body><br><br><center>404 :File not found: 'data/html/CommunityBoard/index.htm' </center></body></html>";
  40. }
  41. separateAndSend(content, activeChar);
  42. }
  43. else if (command.startsWith("_bbstop;"))
  44. {
  45. StringTokenizer st = new StringTokenizer(command, ";");
  46. st.nextToken();
  47. int idp = Integer.parseInt(st.nextToken());
  48. String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/" + idp + ".htm");
  49. if (content == null)
  50. {
  51. content = "<html><body><br><br><center>404 :File not found: 'data/html/CommunityBoard/" + idp
  52. + ".htm' </center></body></html>";
  53. }
  54. separateAndSend(content, activeChar);
  55. }
  56. else
  57. {
  58. ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + command
  59. + " is not implemented yet</center><br><br></body></html>", "101");
  60. activeChar.sendPacket(sb);
  61. activeChar.sendPacket(new ShowBoard(null, "102"));
  62. activeChar.sendPacket(new ShowBoard(null, "103"));
  63. }
  64. }
  65. @Override
  66. public void parsewrite(String ar1, String ar2, String ar3, String ar4, String ar5, L2PcInstance activeChar)
  67. {
  68. }
  69. public static TopBBSManager getInstance()
  70. {
  71. return SingletonHolder._instance;
  72. }
  73. private static class SingletonHolder
  74. {
  75. protected static final TopBBSManager _instance = new TopBBSManager();
  76. }
  77. }