Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  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 l2s.gameserver.network.clientpackets;
  16.  
  17. import l2s.commons.configuration.Config;
  18. import l2s.gameserver.network.serverpackets.KeyPacket;
  19. import l2s.gameserver.network.serverpackets.L2GameServerPacket;
  20. import l2s.protection.jts.Protection;
  21. import l2s.protection.jts.ProtectionConfig;
  22.  
  23. public final class ProtocolVersion extends L2GameClientPacket
  24. {
  25. private int version;
  26. private String HWid;
  27. private byte[] data;
  28.  
  29. @Override
  30. protected void readImpl()
  31. {
  32. version = readD();
  33. //Protection section
  34. if (_buf.remaining() > 260)
  35. {
  36. data = new byte[260];
  37. readB(data);
  38. if (ProtectionConfig.PROTECTION_ENABLED_HWID_REQUEST)
  39. HWid = readS();
  40. }
  41. else if (Protection.isProtectEnabled())
  42. getClient().close(new KeyPacket(null));
  43. //Protection section end
  44. }
  45.  
  46. @Override
  47. protected void runImpl()
  48. {
  49. if (version == -2)
  50. {
  51. getClient().close((L2GameServerPacket) null);
  52. }
  53. else if ((version < Config.MIN_PROTOCOL_REVISION) || (version > Config.MAX_PROTOCOL_REVISION))
  54. {
  55. _log.warn("Client: " + getClient().toString() + " -> Protocol Revision: " + version + " is invalid. Minimum and maximum allowed are: " + Config.MIN_PROTOCOL_REVISION + " and " + Config.MAX_PROTOCOL_REVISION + ". Closing connection.");
  56. getClient().close((L2GameServerPacket) null);
  57. }
  58. else
  59. {
  60. if (Protection.isProtectEnabled())
  61. getClient().setHWID(HWid);
  62. getClient().sendPacket(new KeyPacket(getClient().enableCrypt()));
  63. System.out.println("protocolverion lalalala");
  64. }
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement