TopBBSManager.java 3.0 KB

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