Implement remaining packets, comment out debug info.

This commit is contained in:
Myles 2016-02-29 18:49:31 +00:00
parent bf11edfaa9
commit c641f02d7e
4 changed files with 35 additions and 8 deletions

View File

@ -24,7 +24,7 @@ public class Core extends JavaPlugin {
try {
injectPacketHandler();
} catch (Exception e) {
System.out.println("Unable to inject handlers, this version only supports 1.8.8.");
System.out.println("Unable to inject handlers, are you on 1.8?");
e.printStackTrace();
}
}

View File

@ -114,7 +114,7 @@ public enum PacketType {
PLAY_UPDATE_HEALTH(State.PLAY, Direction.OUTGOING, 0x06, 0x3E),
PLAY_SCOREBOARD_OBJ(State.PLAY, Direction.OUTGOING, 0x3B, 0x3F),
PLAY_SET_PASSENGERS(State.PLAY, Direction.OUTGOING, -1, 0x40),
PLAY_TEAMS(State.PLAY, Direction.OUTGOING, 0x3E, 0x41),
PLAY_TEAM(State.PLAY, Direction.OUTGOING, 0x3E, 0x41),
PLAY_UPDATE_SCORE(State.PLAY, Direction.OUTGOING, 0x3C, 0x42),
PLAY_SPAWN_POSITION(State.PLAY, Direction.OUTGOING, 0x05, 0x43),
PLAY_TIME_UPDATE(State.PLAY, Direction.OUTGOING, 0x03, 0x44),

View File

@ -33,9 +33,9 @@ public class IncomingTransformer {
if (packet.getPacketID() != -1) {
packetID = packet.getPacketID();
}
if (packet != PacketType.PLAY_PLAYER_POSITION_LOOK_REQUEST && packet != PacketType.PLAY_KEEP_ALIVE_REQUEST && packet != PacketType.PLAY_PLAYER_POSITION_REQUEST && packet != PacketType.PLAY_PLAYER_LOOK_REQUEST) {
System.out.println("Packet Type: " + packet + " New ID: " + packetID + " Original: " + original);
}
// if (packet != PacketType.PLAY_PLAYER_POSITION_LOOK_REQUEST && packet != PacketType.PLAY_KEEP_ALIVE_REQUEST && packet != PacketType.PLAY_PLAYER_POSITION_REQUEST && packet != PacketType.PLAY_PLAYER_LOOK_REQUEST) {
// System.out.println("Packet Type: " + packet + " New ID: " + packetID + " Original: " + original);
// }
if (packet == PacketType.PLAY_TP_CONFIRM) {
throw new CancelException();
}
@ -167,7 +167,7 @@ public class IncomingTransformer {
int face = PacketUtil.readVarInt(input);
output.writeByte(face);
int hand = PacketUtil.readVarInt(input);
ItemStack inHand = Core.getHandItem(info);
Object item = null;
try {

View File

@ -45,8 +45,8 @@ public class OutgoingTransformer {
if (packet == null) {
throw new RuntimeException("Outgoing Packet not found? " + packetID + " State: " + info.getState() + " Version: " + info.getProtocol());
}
if (packet != PacketType.PLAY_CHUNK_DATA && packet != PacketType.PLAY_KEEP_ALIVE && packet != PacketType.PLAY_TIME_UPDATE && !packet.name().toLowerCase().contains("entity"))
System.out.println("Packet Type: " + packet + " Original ID: " + packetID + " State:" + info.getState());
// if (packet != PacketType.PLAY_CHUNK_DATA && packet != PacketType.PLAY_KEEP_ALIVE && packet != PacketType.PLAY_TIME_UPDATE && !packet.name().toLowerCase().contains("entity"))
// System.out.println("Packet Type: " + packet + " Original ID: " + packetID + " State:" + info.getState());
if (packet.getPacketID() != -1) {
packetID = packet.getNewPacketID();
}
@ -301,6 +301,33 @@ public class OutgoingTransformer {
return;
}
if(packet == PacketType.PLAY_MAP) {
int damage = PacketUtil.readVarInt(input);
PacketUtil.writeVarInt(damage, output);
byte scale = input.readByte();
output.writeByte(scale);
input.readBoolean();
output.writeBytes(input);
return;
}
if(packet == PacketType.PLAY_TEAM) {
String teamName = PacketUtil.readString(input);
PacketUtil.writeString(teamName, output);
byte mode = input.readByte();
output.writeByte(mode);
if(mode == 0 || mode == 2){
PacketUtil.writeString(PacketUtil.readString(input), output);
PacketUtil.writeString(PacketUtil.readString(input), output);
PacketUtil.writeString(PacketUtil.readString(input), output);
output.writeByte(input.readByte());
PacketUtil.writeString(PacketUtil.readString(input), output);
PacketUtil.readString(input); // collission rule :)
}
output.writeBytes(input);
return;
}
if (packet == PacketType.PLAY_CHUNK_DATA) {
// We need to catch unloading chunk packets as defined by wiki.vg
// To unload chunks, send this packet with Ground-Up Continuous=true and no 16^3 chunks (eg. Primary Bit Mask=0)