Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.emulation.net.packet.impl;
- import com.emulation.model.player.Player;
- import com.emulation.net.packet.PacketBuilder;
- import com.emulation.net.packet.PacketContext;
- import com.emulation.net.packet.PacketHandler;
- import com.emulation.world.Location;
- import com.emulation.world.World;
- public class LoginPacketHandler implements PacketHandler {
- @SuppressWarnings("unused")
- @Override
- public void handlePacket(PacketContext pc, Player player) {
- int magicCode = (Integer) pc.getAttribute("magic_code");
- int clientVersion = (Integer) pc.getAttribute("client_version");
- boolean lowDetail = ((Integer) pc.getAttribute("high_detail")) == 0;
- int data = (Integer) pc.getAttribute("login_block_data");
- long clientSessionKey = (Long) pc.getAttribute("client_session_key");
- long serverSessionKey = (Long) pc.getAttribute("server_session_key");
- int uid = (Integer) pc.getAttribute("uid");
- String username = (String) pc.getAttribute("username");
- String password = (String) pc.getAttribute("password");
- String id = "" + World.getWorld().getPlayerList().indexOf(player) + 1;
- if (id.startsWith("0")) {
- id = id.substring(1);
- }
- player.setID(Integer.parseInt(id));
- player.setLocation(new Location(3200, 3200, 0));
- player.write(new PacketBuilder().putByte((byte) 2).putByte((byte) 0)
- .putByte((byte) 0));
- player.setLoggedIn(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement