TopBBSManager.java 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright (C) 2004-2014 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.communitybbs.Manager;
  20. import java.util.StringTokenizer;
  21. import com.l2jserver.gameserver.cache.HtmCache;
  22. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  23. import com.l2jserver.gameserver.network.serverpackets.ShowBoard;
  24. public class TopBBSManager extends BaseBBSManager
  25. {
  26. @Override
  27. public void parsecmd(String command, L2PcInstance activeChar)
  28. {
  29. if (command.equals("_bbstop"))
  30. {
  31. String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/index.htm");
  32. if (content == null)
  33. {
  34. content = "<html><body><br><br><center>404 :File not found: 'data/html/CommunityBoard/index.htm' </center></body></html>";
  35. }
  36. separateAndSend(content, activeChar);
  37. }
  38. else if (command.equals("_bbshome"))
  39. {
  40. String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/index.htm");
  41. if (content == null)
  42. {
  43. content = "<html><body><br><br><center>404 :File not found: 'data/html/CommunityBoard/index.htm' </center></body></html>";
  44. }
  45. separateAndSend(content, activeChar);
  46. }
  47. else if (command.startsWith("_bbstop;"))
  48. {
  49. StringTokenizer st = new StringTokenizer(command, ";");
  50. st.nextToken();
  51. int idp = Integer.parseInt(st.nextToken());
  52. String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/" + idp + ".htm");
  53. if (content == null)
  54. {
  55. content = "<html><body><br><br><center>404 :File not found: 'data/html/CommunityBoard/" + idp + ".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 + " is not implemented yet</center><br><br></body></html>", "101");
  62. activeChar.sendPacket(sb);
  63. activeChar.sendPacket(new ShowBoard(null, "102"));
  64. activeChar.sendPacket(new ShowBoard(null, "103"));
  65. }
  66. }
  67. @Override
  68. public void parsewrite(String ar1, String ar2, String ar3, String ar4, String ar5, L2PcInstance activeChar)
  69. {
  70. }
  71. public static TopBBSManager getInstance()
  72. {
  73. return SingletonHolder._instance;
  74. }
  75. private static class SingletonHolder
  76. {
  77. protected static final TopBBSManager _instance = new TopBBSManager();
  78. }
  79. }