TopBBSManager.java 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 net.sf.l2j.gameserver.communitybbs.Manager;
  16. import java.util.StringTokenizer;
  17. import net.sf.l2j.gameserver.cache.HtmCache;
  18. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  19. import net.sf.l2j.gameserver.serverpackets.ShowBoard;
  20. public class TopBBSManager extends BaseBBSManager
  21. {
  22. /* (non-Javadoc)
  23. * @see net.sf.l2j.gameserver.communitybbs.Manager.BaseBBSManager#parsecmd(java.lang.String, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance)
  24. */
  25. @Override
  26. public void parsecmd(String command, L2PcInstance activeChar)
  27. {
  28. if(command.equals("_bbstop"))
  29. {
  30. String content = HtmCache.getInstance().getHtm("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("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("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+".htm' </center></body></html>";
  55. }
  56. separateAndSend(content,activeChar);
  57. }
  58. else
  59. {
  60. ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: "+command+" is not implemented yet</center><br><br></body></html>","101");
  61. activeChar.sendPacket(sb);
  62. activeChar.sendPacket(new ShowBoard(null,"102"));
  63. activeChar.sendPacket(new ShowBoard(null,"103"));
  64. }
  65. }
  66. /* (non-Javadoc)
  67. * @see net.sf.l2j.gameserver.communitybbs.Manager.BaseBBSManager#parsewrite(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance)
  68. */
  69. @Override
  70. public void parsewrite(String ar1, String ar2, String ar3, String ar4, String ar5, L2PcInstance activeChar)
  71. {
  72. // TODO Auto-generated method stub
  73. }
  74. private static TopBBSManager _instance = new TopBBSManager();
  75. /**
  76. * @return
  77. */
  78. public static TopBBSManager getInstance()
  79. {
  80. return _instance;
  81. }
  82. }