TopBBSManager.java 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 + ".htm' </center></body></html>";
  52. }
  53. separateAndSend(content, activeChar);
  54. }
  55. else
  56. {
  57. ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + command + " is not implemented yet</center><br><br></body></html>", "101");
  58. activeChar.sendPacket(sb);
  59. activeChar.sendPacket(new ShowBoard(null, "102"));
  60. activeChar.sendPacket(new ShowBoard(null, "103"));
  61. }
  62. }
  63. @Override
  64. public void parsewrite(String ar1, String ar2, String ar3, String ar4, String ar5, L2PcInstance activeChar)
  65. {
  66. }
  67. public static TopBBSManager getInstance()
  68. {
  69. return SingletonHolder._instance;
  70. }
  71. private static class SingletonHolder
  72. {
  73. protected static final TopBBSManager _instance = new TopBBSManager();
  74. }
  75. }