Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. package com.emulation.net.packet.impl;
  2.  
  3. import com.emulation.model.player.Player;
  4. import com.emulation.net.packet.PacketBuilder;
  5. import com.emulation.net.packet.PacketContext;
  6. import com.emulation.net.packet.PacketHandler;
  7. import com.emulation.world.Location;
  8. import com.emulation.world.World;
  9.  
  10. public class LoginPacketHandler implements PacketHandler {
  11.  
  12. @SuppressWarnings("unused")
  13. @Override
  14. public void handlePacket(PacketContext pc, Player player) {
  15. int magicCode = (Integer) pc.getAttribute("magic_code");
  16. int clientVersion = (Integer) pc.getAttribute("client_version");
  17. boolean lowDetail = ((Integer) pc.getAttribute("high_detail")) == 0;
  18. int data = (Integer) pc.getAttribute("login_block_data");
  19. long clientSessionKey = (Long) pc.getAttribute("client_session_key");
  20. long serverSessionKey = (Long) pc.getAttribute("server_session_key");
  21. int uid = (Integer) pc.getAttribute("uid");
  22. String username = (String) pc.getAttribute("username");
  23. String password = (String) pc.getAttribute("password");
  24. String id = "" + World.getWorld().getPlayerList().indexOf(player) + 1;
  25. if (id.startsWith("0")) {
  26. id = id.substring(1);
  27. }
  28. player.setID(Integer.parseInt(id));
  29. player.setLocation(new Location(3200, 3200, 0));
  30. player.write(new PacketBuilder().putByte((byte) 2).putByte((byte) 0)
  31. .putByte((byte) 0));
  32. player.setLoggedIn(true);
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement