RequestBBSwrite.java 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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.network.clientpackets;
  16. import com.l2jserver.Config;
  17. import com.l2jserver.gameserver.communitybbs.CommunityBoard;
  18. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  19. import com.l2jserver.gameserver.network.SystemMessageId;
  20. import com.l2jserver.gameserver.network.communityserver.CommunityServerThread;
  21. import com.l2jserver.gameserver.network.communityserver.writepackets.RequestCommunityBoardWrite;
  22. import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
  23. /**
  24. * Format SSSSSS
  25. * @author -Wooden-
  26. *
  27. */
  28. public final class RequestBBSwrite extends L2GameClientPacket
  29. {
  30. private static final String _C__22_REQUESTBBSWRITE = "[C] 22 RequestBBSwrite";
  31. private String _url;
  32. private String _arg1;
  33. private String _arg2;
  34. private String _arg3;
  35. private String _arg4;
  36. private String _arg5;
  37. @Override
  38. protected final void readImpl()
  39. {
  40. _url = readS();
  41. _arg1 = readS();
  42. _arg2 = readS();
  43. _arg3 = readS();
  44. _arg4 = readS();
  45. _arg5 = readS();
  46. }
  47. @Override
  48. protected final void runImpl()
  49. {
  50. if (Config.ENABLE_COMMUNITY_BOARD)
  51. {
  52. L2PcInstance activeChar = getClient().getActiveChar();
  53. if (activeChar == null)
  54. return;
  55. if (!CommunityServerThread.getInstance().sendPacket(new RequestCommunityBoardWrite(activeChar.getObjectId(), _url,_arg1,_arg2, _arg3, _arg4, _arg5)))
  56. activeChar.sendPacket(new SystemMessage(SystemMessageId.CB_OFFLINE));
  57. }
  58. else
  59. CommunityBoard.getInstance().handleWriteCommands(getClient(),_url,_arg1,_arg2, _arg3, _arg4, _arg5);
  60. }
  61. @Override
  62. public final String getType()
  63. {
  64. return _C__22_REQUESTBBSWRITE;
  65. }
  66. }