vproxy/proxy/src/main/java/proxy/handler/ProxyHandler.java
2025-06-10 12:43:56 +02:00

858 lines
27 KiB
Java
Executable file

package proxy.handler;
import io.netty.buffer.Unpooled;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
import java.net.IDN;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;
import proxy.Proxy;
import proxy.network.Connection;
import proxy.network.Packet;
import proxy.network.PacketBuffer;
import proxy.network.Protocol;
import proxy.packet.*;
import proxy.packet.C16PacketClientStatus.EnumState;
import proxy.packet.S38PacketPlayerListItem.Action;
import proxy.util.Formatter;
import proxy.util.User;
import proxy.util.Log;
import proxy.util.Permissions;
public class ProxyHandler extends User implements Handler {
public class ProxyLoginHandler implements Handler {
public void handleEncryptionRequest(R01PacketEncryptionRequest packetIn) {
ProxyHandler.this.server.closeChannel("Online mode auth request received");
ProxyHandler.this.disconnect("Server tried to authenticate, check if online-mode ist set to false");
}
public void handleLoginSuccess(R02PacketLoginSuccess packetIn) {
if(!ProxyHandler.this.username.equals(packetIn.getName()) || !Proxy.getOfflineUUID(ProxyHandler.this.username).equals(packetIn.getId())) {
ProxyHandler.this.server.closeChannel("Different profile received");
ProxyHandler.this.disconnect("Server returned a different profile, check if server or plugins tamper with profiles");
}
ProxyHandler.this.server.setNetHandler(ProxyHandler.this);
ProxyHandler.this.server.setConnectionState(Protocol.PLAY);
ProxyHandler.this.connected = true;
ProxyHandler.this.connecting = false;
Log.info("Connected %s to forward host", ProxyHandler.this.username);
}
public void handleDisconnect(R00PacketDisconnect packetIn) {
ProxyHandler.this.server.closeChannel("Kicked by server on login: " + packetIn.getReason());
ProxyHandler.this.disconnect("Kicked by server on login");
}
public void handleEnableCompression(R03PacketEnableCompression packetIn) {
ProxyHandler.this.server.setCompressionTreshold(packetIn.getCompressionTreshold());
}
public void onDisconnect(Connection connection, String reason) {
ProxyHandler.this.onDisconnect(connection, reason);
}
}
private static final AtomicInteger CONN_COUNTER = new AtomicInteger();
private static final Pattern JOIN_LEAVE_REGEX = Pattern.compile("\\QJSON:{\"extra\":[{\"color\":\"yellow\",\"text\":\"\\E[0-9A-Za-z_]{3,16} (joined the game|left the game\\.)\\Q\"}],\"text\":\"\"}\\E");
private final Proxy proxy;
private final Connection client;
private Connection server;
private int ping;
private int pingKey;
private int networkTickCount;
private long lastPingTime;
private long lastSentPingPacket;
private volatile boolean connecting;
private volatile boolean connected;
private int passwordAttempts;
private boolean wasClosed;
private boolean hasMoved;
private volatile int signPreloaded;
private String completion;
private int spoofedId = -1;
private int realId = -1;
private int prevMode = -1;
private int mode = 0;
private byte modelFlags = 0x7f;
private static boolean isAllowedChar(char ch) {
return ch != 167 && ch >= 32 && ch != 127;
}
private static String filterString(String str) {
StringBuilder sb = new StringBuilder();
for(char ch : str.toCharArray()) {
if(isAllowedChar(ch)) {
sb.append(ch);
}
}
return sb.toString();
}
private static boolean isValidString(String str) {
for(int z = 0; z < str.length(); z++) {
if(!isAllowedChar(str.charAt(z))) {
return false;
}
}
return true;
}
public ProxyHandler(Proxy proxy, Connection client, String username) {
super(username);
this.proxy = proxy;
this.client = client;
}
public String getUsername() {
return this.username;
}
public int getPing() {
return this.ping;
}
public int getMode() {
return this.mode;
}
public String getListDisplayName() {
return null;
}
public String getTextureData() {
return this.skinTexture == null ? this.proxy.getDefaultSkinTexture() : this.skinTexture;
}
public String getTextureSignature() {
return this.skinTexture == null ? this.proxy.getDefaultSkinSignature() : this.skinSignature;
}
public void setupPlayer(int id) {
this.spoofedId = id;
this.sendToClient(new S01PacketJoinGame(id, true));
this.sendToClient(new S3FPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(Proxy.NAME)));
this.sendToClient(new S03PacketTimeUpdate(3000L, false));
this.sendToClient(new S26PacketMapChunkBulk(0, 64, 0));
this.sendToClient(new S08PacketPlayerPosLook(0.5, 65.0, 0.5, 0.0f, 0.0f));
// this.sendMessage(Formatter.DARK_PURPLE + "Welcome %s, please log in using the sign gui ...", this.username);
}
public void sendMessage(String message) {
this.sendToClient(new S02PacketChat(message, false));
}
public void sendMessage(String fmt, Object... args) {
this.sendToClient(new S02PacketChat(String.format(fmt, args), false));
}
public void update(Connection connection) {
if(connection == this.server)
return;
++this.networkTickCount;
if((long)this.networkTickCount - this.lastSentPingPacket > 40L) {
this.lastSentPingPacket = (long)this.networkTickCount;
this.lastPingTime = System.nanoTime() / 1000000L;
this.pingKey = (int)this.lastPingTime;
this.sendToClient(new S00PacketKeepAlive(this.pingKey));
}
if(!this.connected) {
if(this.hasMoved) {
this.hasMoved = false;
this.sendToClient(new S08PacketPlayerPosLook(0.5, 65.0, 0.5, 0.0f, 0.0f));
}
}
if(this.connecting || this.connected) {
if(this.mode != this.prevMode) {
this.prevMode = this.mode;
this.proxy.sendPacket(new S38PacketPlayerListItem(this, Action.UPDATE_GAME_MODE));
}
if(this.server.isChannelOpen()) {
try {
this.server.processReceivedPackets();
}
catch(Throwable e) {
this.disconnect("Forward server error");
Log.error(e, "Error in connection for %s", this.username);
}
}
else {
this.server.checkDisconnected();
}
}
}
public void sendToClient(Packet packetIn) {
this.client.sendPacket(packetIn);
}
public void sendToServer(Packet packetIn) {
this.server.sendPacket(packetIn);
}
public void disconnect(final String reason) {
this.client.sendPacket(new S40PacketDisconnect(reason), new GenericFutureListener<Future<? super Void>>() {
public void operationComplete(Future<? super Void> p_operationComplete_1_) throws Exception {
ProxyHandler.this.client.closeChannel(reason);
}
});
this.client.disableAutoRead();
this.proxy.schedule(new Runnable() {
public void run() {
ProxyHandler.this.client.checkDisconnected();
}
});
}
public boolean isOnline() {
return true;
}
private void connectToServer() {
this.proxy.setLoggedIn(this.username, this);
final String host = this.proxy.getForwardHost();
final int port = this.proxy.getForwardPort();
Log.info("Connecting %s to %s:%d", this.username, host, port);
new Thread(new Runnable() {
public void run() {
final Connection conn;
try {
conn = Connection.createNetworkManagerAndConnect(InetAddress.getByName(IDN.toASCII(host)),
port, ProxyHandler.this.proxy.isUsingEPoll());
}
catch(UnknownHostException e) {
ProxyHandler.this.disconnect("Could not connect to server: unknown host, check if the hostname is correct");
Log.error(e, "Could not connect to server");
return;
}
catch(Exception e) {
ProxyHandler.this.disconnect("Could not connect to server: connection failed, check if the server is running and reachable on this port");
Log.error(e, "Could not connect to server");
return;
}
conn.setNetHandler(new ProxyLoginHandler());
conn.sendPacket(new H00PacketHandshake(47, host, port, Protocol.LOGIN),
new GenericFutureListener<Future<? super Void>>() {
public void operationComplete(Future<? super Void> future) throws Exception {
conn.sendPacket(new L00PacketLoginStart(ProxyHandler.this.username));
}
});
ProxyHandler.this.server = conn;
ProxyHandler.this.connecting = true;
Log.info("Connected %s to login phase", ProxyHandler.this.username);
}
}, "Forward connector #" + CONN_COUNTER.incrementAndGet()).start();
}
public void processKeepAlive(C00PacketKeepAlive packetIn) {
if(packetIn.getKey() == this.pingKey) {
int passed = (int)(System.nanoTime() / 1000000L - this.lastPingTime);
this.ping = (this.ping * 3 + passed) / 4;
}
}
public void processInput(C0CPacketInput packetIn) {
if(this.connected)
this.sendToServer(packetIn);
}
public void processPlayer(C03PacketPlayer packetIn) {
if(this.connected) {
this.sendToServer(packetIn);
}
else {
if(packetIn.isMoving())
this.hasMoved = true;
if(this.signPreloaded == 1) {
this.signPreloaded = 2;
this.setSign(Formatter.DARK_BLUE + "" + Formatter.UNDERLINE + "Enter password", Formatter.DARK_GRAY + "Use 1 or 2 lines");
}
else if(this.signPreloaded == 0) {
this.signPreloaded = 1;
}
}
}
public void onDisconnect(Connection connection, String reason) {
if(connection == this.server) {
this.disconnect(reason);
Log.info("Server disconnected, kicking player %s", this.username);
}
if(connection == this.client) {
if(this.connected)
this.server.closeChannel(reason);
Log.info("Client %s disconnected", this.username);
}
this.proxy.setLoggedOut(this.username);
Log.info("%s lost connection: " + reason, this.username);
}
private void setSign(String message, String desc) {
this.sendToClient(new S33PacketUpdateSign(0, 66, 1, "", "", message, desc));
this.sendToClient(new S36PacketSignEditorOpen(0, 66, 1));
}
private void handlePassword(String password) {
if(password.isEmpty()) {
if(this.wasClosed) {
this.disconnect("Login aborted");
}
else {
this.wasClosed = true;
this.setSign(Formatter.GOLD + "Press esc again", Formatter.GOLD + "to disconnect ...");
}
return;
}
this.wasClosed = false;
User stored = this.proxy.getUser(this.username);
if(stored == null) {
if(!this.proxy.canRegister()) {
this.disconnect("You are not whitelisted on this server");
}
else if(this.proxy.getMaximumPlayers() > 0 && this.proxy.getOnlinePlayers() >= this.proxy.getMaximumPlayers()) {
this.disconnect("The server is full (" + this.proxy.getOnlinePlayers() + " / " + this.proxy.getMaximumPlayers() + " players), please try registering later");
}
else if(password.isEmpty() || password.length() < this.proxy.getMinimumPasswordLength()) {
this.setSign(Formatter.DARK_RED + "" + Formatter.UNDERLINE + "Too short" + Formatter.DARK_RED + ", use",
Formatter.DARK_RED + "" + this.proxy.getMinimumPasswordLength() + "-32 characters");
}
else if(password.length() > 32) {
this.setSign(Formatter.DARK_RED + "" + Formatter.UNDERLINE + "Too long" + Formatter.DARK_RED + ", use",
Formatter.DARK_RED + "" + this.proxy.getMinimumPasswordLength() + "-32 characters");
}
else {
this.proxy.setUser(User.createUser(this.username, password));
Log.info("%s registered with password", this.username);
this.connectToServer();
}
}
else {
if(!stored.checkPassword(password)) {
if(++this.passwordAttempts >= this.proxy.getMaximumPasswordAttempts())
this.disconnect("Too many password attempts");
else
this.setSign(Formatter.DARK_RED + "" + Formatter.UNDERLINE + "Wrong password", Formatter.DARK_RED + "Please try again");
Log.info("%s failed password attempt %d/%d", this.username, this.passwordAttempts, this.proxy.getMaximumPasswordAttempts());
}
else if(this.proxy.isCheckingCase() && !stored.getUsername().equals(this.username)) {
this.disconnect("You used the wrong username casing, please use '" + stored.getUsername() + "' exactly");
Log.info("%s tried to use a different username casing", this.username);
}
else if(this.proxy.getPlayer(this.username) != null) {
this.disconnect("You are already logged in");
Log.info("%s was already logged in from another client", this.username);
}
else if(!stored.hasPermission(Permissions.BYPASS_PLAYER_LIMIT) && this.proxy.getMaximumPlayers() > 0 && this.proxy.getOnlinePlayers() >= this.proxy.getMaximumPlayers()) {
this.disconnect("The server is full (" + this.proxy.getOnlinePlayers() + " / " + this.proxy.getMaximumPlayers() + " players), please try again later");
}
else {
Log.info("%s logged in with password", this.username);
this.connectToServer();
}
}
}
public void processUpdateSign(C12PacketUpdateSign packetIn) {
if(!this.connected) {
Handler.syncToMain(packetIn, this, this.proxy);
String line1 = Formatter.fromJsonString(packetIn.getLines()[0]);
String line2 = Formatter.fromJsonString(packetIn.getLines()[1]);
if(line1 == null || line2 == null || line1.length() > 50 || line2.length() > 50 || !isValidString(line1) || !isValidString(line2))
return;
String password = line1 + line2;
this.handlePassword(password);
return;
}
String[] lines = packetIn.getLines();
for(String line : lines) {
String value = Formatter.fromJsonString(line);
if(value == null || value.length() > 50 || !isValidString(value))
return;
}
this.sendToServer(packetIn);
}
public void processChatMessage(C01PacketChatMessage packetIn) {
if(this.connected) {
Handler.syncToMain(packetIn, this, this.proxy);
String msg = packetIn.getMessage();
if(!isValidString(msg))
return;
this.proxy.run(this, msg);
}
}
public void processTabComplete(C14PacketTabComplete packetIn) {
if(this.connected) {
Handler.syncToMain(packetIn, this, this.proxy);
String msg = packetIn.getMessage();
if(!isValidString(msg))
return;
this.completion = msg;
this.sendToServer(packetIn);
}
}
public void handleTabComplete(S3APacketTabComplete packetIn) {
Handler.syncToMain(packetIn, this, this.proxy);
if(this.completion == null) {
this.sendToClient(new S3APacketTabComplete(new String[0]));
return;
}
List<String> list = this.proxy.complete(this, this.completion, packetIn.getMatches());
this.sendToClient(list != null ? new S3APacketTabComplete(list.toArray(new String[list.size()])) : packetIn);
this.completion = null;
}
public void processPlayerDigging(C07PacketPlayerDigging packetIn) {
if(this.connected)
this.sendToServer(packetIn);
}
public void processPlayerBlockPlacement(C08PacketPlayerBlockPlacement packetIn) {
if(this.connected)
this.sendToServer(packetIn);
}
public void handleSpectate(C18PacketSpectate packetIn) {
if(this.connected)
this.sendToServer(packetIn);
}
public void processHeldItemChange(C09PacketHeldItemChange packetIn) {
if(this.connected)
this.sendToServer(packetIn);
}
public void handleAnimation(C0APacketAnimation packetIn) {
if(this.connected)
this.sendToServer(packetIn);
}
public void processEntityAction(C0BPacketEntityAction packetIn) {
if(this.connected)
this.sendToServer(packetIn.replaceEntityId(this.realId, this.spoofedId));
}
public void processUseEntity(C02PacketUseEntity packetIn) {
if(this.connected)
this.sendToServer(packetIn.replaceEntityId(this.realId, this.spoofedId));
}
public void processClientStatus(C16PacketClientStatus packetIn) {
if(this.connected)
this.sendToServer(packetIn);
}
public void processCloseWindow(C0DPacketCloseWindow packetIn) {
if(this.connected)
this.sendToServer(packetIn);
}
public void processClickWindow(C0EPacketClickWindow packetIn) {
if(this.connected)
this.sendToServer(packetIn);
}
public void processEnchantItem(C11PacketEnchantItem packetIn) {
if(this.connected)
this.sendToServer(packetIn);
}
public void processConfirmTransaction(C0FPacketConfirmTransaction packetIn) {
if(this.connected)
this.sendToServer(packetIn);
}
public void processPlayerAbilities(C13PacketPlayerAbilities packetIn) {
if(this.connected)
this.sendToServer(packetIn);
}
public void processClientSettings(C15PacketClientSettings packetIn) {
if(this.connected)
this.sendToServer(packetIn);
this.modelFlags = packetIn.getModelFlags();
}
public void processCreativeInventoryAction(C10PacketCreativeInventoryAction packetIn) {
if(!this.connected)
return;
Stack stack = packetIn.getStack();
// TODO: validate item
this.sendToServer(packetIn);
}
public void processVanilla250Packet(C17PacketCustomPayload packetIn) {
if(!this.connected) {
if("MC|Brand".equals(packetIn.getChannelName())) {
PacketBuffer packetbuffer = packetIn.getBufferData();
String brand = packetbuffer.readStringFromBuffer(32767);
Log.info("Client brand of %s: %s", this.username,
filterString(Formatter.strip(brand.length() > 128 ? brand.substring(0, 128) + " ..." : brand)));
packetbuffer.release();
}
return;
}
if("MC|BEdit".equals(packetIn.getChannelName())) {
PacketBuffer packetbuffer = packetIn.getBufferData();
try {
Stack itemstack1 = packetbuffer.readStack();
if(itemstack1 != null && itemstack1.getTag() != null) {
int pages = Nbt.getStringListLength(itemstack1.getTag(), "pages");
if(pages > 50)
return;
}
}
catch(Exception exception3) {
return;
}
finally {
packetbuffer.release();
}
}
else if("MC|BSign".equals(packetIn.getChannelName())) {
PacketBuffer packetbuffer = packetIn.getBufferData();
try {
Stack itemstack = packetbuffer.readStack();
if(itemstack != null && itemstack.getTag() != null) {
String title = Nbt.getString(itemstack.getTag(), "title");
if(title != null && (title.length() > 50 || !isValidString(title)))
return;
int pages = Nbt.getStringListLength(itemstack.getTag(), "pages");
if(pages > 50)
return;
}
}
catch(Exception exception4) {
return;
}
finally {
packetbuffer.release();
}
}
else if("MC|TrSel".equals(packetIn.getChannelName())) {
PacketBuffer packetbuffer = packetIn.getBufferData();
int index = packetbuffer.readInt();
packetbuffer.release();
}
else if("MC|AdvCdm".equals(packetIn.getChannelName())) {
PacketBuffer packetbuffer = packetIn.getBufferData();
int type = packetbuffer.readByte();
if(type == 0) {
packetbuffer.readInt();
packetbuffer.readInt();
packetbuffer.readInt();
}
else if(type == 1) {
packetbuffer.readInt();
}
String command = packetbuffer.readStringFromBuffer(packetbuffer.readableBytes());
if(!isValidString(command))
return;
boolean track = packetbuffer.readBoolean();
packetbuffer.release();
}
else if("MC|Beacon".equals(packetIn.getChannelName())) {
PacketBuffer packetbuffer = packetIn.getBufferData();
int id = packetbuffer.readInt();
if(id != 1 /* moveSpeed */ && id != 3 /* digSpeed */ && id != 11 /* resistance */ && id != 8 /* jump */ && id != 5 /* damageBoost */) {
packetbuffer.release();
return;
}
id = packetbuffer.readInt();
if(id != 1 /* moveSpeed */ && id != 3 /* digSpeed */ && id != 11 /* resistance */ && id != 8 /* jump */ && id != 5 /* damageBoost */
&& id != 10 /* regeneration */) {
packetbuffer.release();
return;
}
packetbuffer.release();
}
else if("MC|ItemName".equals(packetIn.getChannelName())) {
PacketBuffer packetbuffer = packetIn.getBufferData();
if(packetbuffer.readableBytes() >= 1 && filterString(packetbuffer.readStringFromBuffer(32767)).length() > 30) {
packetbuffer.release();
return;
}
packetbuffer.release();
}
else {
return;
}
this.sendToServer(packetIn);
}
public void handleDisconnect(S40PacketDisconnect packetIn) {
String reason = packetIn.getReason();
this.server.closeChannel("Disconnected by server: " + reason);
this.disconnect("Disconnected: '" + reason + "'");
}
public void handleJoinGame(S01PacketJoinGame packetIn) {
this.realId = packetIn.getEntityId();
this.mode = packetIn.getGameType();
this.sendToClient(new S07PacketRespawn(packetIn));
// this.sendToClient(new S2EPacketCloseWindow());
this.sendToServer(new C15PacketClientSettings(this.modelFlags));
}
public void handleSetCompressionLevel(S46PacketSetCompressionLevel packetIn) {
this.server.setCompressionTreshold(packetIn.getThreshold());
}
public void handleKeepAlive(S00PacketKeepAlive packetIn) {
this.sendToServer(new C00PacketKeepAlive(packetIn.func_149134_c()));
}
public void handleSpawnObject(S0EPacketSpawnObject packetIn) {
this.sendToClient(packetIn);
}
public void handleSpawnExperienceOrb(S11PacketSpawnExperienceOrb packetIn) {
this.sendToClient(packetIn);
}
public void handleSpawnGlobalEntity(S2CPacketSpawnGlobalEntity packetIn) {
this.sendToClient(packetIn);
}
public void handleSpawnPainting(S10PacketSpawnPainting packetIn) {
this.sendToClient(packetIn);
}
public void handleEntityVelocity(S12PacketEntityVelocity packetIn) {
this.sendToClient(packetIn.replaceEntityId(this.realId, this.spoofedId));
}
public void handleEntityMetadata(S1CPacketEntityMetadata packetIn) {
this.sendToClient(packetIn.replaceEntityId(this.realId, this.spoofedId));
}
public void handleSpawnPlayer(S0CPacketSpawnPlayer packetIn) {
this.sendToClient(packetIn.replaceEntityId(this.realId, this.spoofedId));
}
public void handleEntityTeleport(S18PacketEntityTeleport packetIn) {
this.sendToClient(packetIn.replaceEntityId(this.realId, this.spoofedId));
}
public void handleHeldItemChange(S09PacketHeldItemChange packetIn) {
this.sendToClient(packetIn);
}
public void handleEntityMovement(S14PacketEntity packetIn) {
this.sendToClient(packetIn.replaceEntityId(this.realId, this.spoofedId));
}
public void handleEntityHeadLook(S19PacketEntityHeadLook packetIn) {
this.sendToClient(packetIn.replaceEntityId(this.realId, this.spoofedId));
}
public void handleDestroyEntities(S13PacketDestroyEntities packetIn) {
this.sendToClient(packetIn);
}
public void handlePlayerPosLook(S08PacketPlayerPosLook packetIn) {
this.sendToClient(packetIn);
}
public void handleMultiBlockChange(S22PacketMultiBlockChange packetIn) {
this.sendToClient(packetIn);
}
public void handleChunkData(S21PacketChunkData packetIn) {
this.sendToClient(packetIn);
}
public void handleBlockChange(S23PacketBlockChange packetIn) {
this.sendToClient(packetIn);
}
public void handleCollectItem(S0DPacketCollectItem packetIn) {
this.sendToClient(packetIn.replaceEntityId(this.realId, this.spoofedId));
}
public void handleChat(S02PacketChat packetIn) {
if(packetIn.getType() != 1 || !JOIN_LEAVE_REGEX.matcher(packetIn.getMessage()).matches())
this.sendToClient(packetIn);
}
public void handleAnimation(S0BPacketAnimation packetIn) {
this.sendToClient(packetIn.replaceEntityId(this.realId, this.spoofedId));
}
public void handleUseBed(S0APacketUseBed packetIn) {
this.sendToClient(packetIn.replaceEntityId(this.realId, this.spoofedId));
}
public void handleSpawnMob(S0FPacketSpawnMob packetIn) {
this.sendToClient(packetIn);
}
public void handleTimeUpdate(S03PacketTimeUpdate packetIn) {
this.sendToClient(packetIn);
}
public void handleSpawnPosition(S05PacketSpawnPosition packetIn) {
this.sendToClient(packetIn);
}
public void handleEntityAttach(S1BPacketEntityAttach packetIn) {
this.sendToClient(packetIn.replaceEntityId(this.realId, this.spoofedId));
}
public void handleEntityStatus(S19PacketEntityStatus packetIn) {
this.sendToClient(packetIn.replaceEntityId(this.realId, this.spoofedId));
}
public void handleUpdateHealth(S06PacketUpdateHealth packetIn) {
this.sendToClient(packetIn);
}
public void handleSetExperience(S1FPacketSetExperience packetIn) {
this.sendToClient(packetIn);
}
public void handleRespawn(S07PacketRespawn packetIn) {
this.mode = packetIn.getGameType();
this.sendToClient(packetIn);
}
public void handleExplosion(S27PacketExplosion packetIn) {
this.sendToClient(packetIn);
}
public void handleOpenWindow(S2DPacketOpenWindow packetIn) {
this.sendToClient(packetIn);
}
public void handleSetSlot(S2FPacketSetSlot packetIn) {
this.sendToClient(packetIn);
}
public void handleConfirmTransaction(S32PacketConfirmTransaction packetIn) {
this.sendToClient(packetIn);
}
public void handleWindowItems(S30PacketWindowItems packetIn) {
this.sendToClient(packetIn);
}
public void handleSignEditorOpen(S36PacketSignEditorOpen packetIn) {
this.sendToClient(packetIn);
}
public void handleUpdateSign(S33PacketUpdateSign packetIn) {
this.sendToClient(packetIn);
}
public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn) {
this.sendToClient(packetIn);
}
public void handleWindowProperty(S31PacketWindowProperty packetIn) {
this.sendToClient(packetIn);
}
public void handleEntityEquipment(S04PacketEntityEquipment packetIn) {
this.sendToClient(packetIn.replaceEntityId(this.realId, this.spoofedId));
}
public void handleCloseWindow(S2EPacketCloseWindow packetIn) {
this.sendToClient(packetIn);
}
public void handleBlockAction(S24PacketBlockAction packetIn) {
this.sendToClient(packetIn);
}
public void handleBlockBreakAnim(S25PacketBlockBreakAnim packetIn) {
this.sendToClient(packetIn.replaceEntityId(this.realId, this.spoofedId));
}
public void handleMapChunkBulk(S26PacketMapChunkBulk packetIn) {
this.sendToClient(packetIn);
}
public void handleChangeGameState(S2BPacketChangeGameState packetIn) {
if(packetIn.getType() == 3) {
this.mode = packetIn.getIntValue();
}
else if(packetIn.getType() == 4) {
this.sendToServer(new C16PacketClientStatus(EnumState.PERFORM_RESPAWN));
return;
}
this.sendToClient(packetIn);
}
public void handleMaps(S34PacketMaps packetIn) {
this.sendToClient(packetIn);
}
public void handleEffect(S28PacketEffect packetIn) {
this.sendToClient(packetIn);
}
public void handleStatistics(S37PacketStatistics packetIn) {
this.sendToClient(packetIn);
}
public void handleEntityEffect(S1DPacketEntityEffect packetIn) {
this.sendToClient(packetIn.replaceEntityId(this.realId, this.spoofedId));
}
public void handleServerDifficulty(S41PacketServerDifficulty packetIn) {
this.sendToClient(packetIn);
}
public void handleCamera(S43PacketCamera packetIn) {
this.sendToClient(packetIn.replaceEntityId(this.realId, this.spoofedId));
}
public void handleWorldBorder(S44PacketWorldBorder packetIn) {
this.sendToClient(packetIn);
}
public void handleRemoveEntityEffect(S1EPacketRemoveEntityEffect packetIn) {
this.sendToClient(packetIn.replaceEntityId(this.realId, this.spoofedId));
}
public void handlePlayerAbilities(S39PacketPlayerAbilities packetIn) {
this.sendToClient(packetIn);
}
public void handleSoundEffect(S29PacketSoundEffect packetIn) {
this.sendToClient(packetIn);
}
public void handleEntityNBT(S49PacketUpdateEntityNBT packetIn) {
this.sendToClient(packetIn.replaceEntityId(this.realId, this.spoofedId));
}
public void handleCustomPayload(S3FPacketCustomPayload packetIn) {
if("MC|TrList".equals(packetIn.getChannelName()) || "MC|BOpen".equals(packetIn.getChannelName()))
this.sendToClient(packetIn);
}
public void handleParticles(S2APacketParticles packetIn) {
this.sendToClient(packetIn);
}
public void handleEntityProperties(S20PacketEntityProperties packetIn) {
this.sendToClient(packetIn.replaceEntityId(this.realId, this.spoofedId));
}
}