diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/listener/EventRecordListener.java b/FightSystem_Main/src/de/steamwar/fightsystem/listener/EventRecordListener.java index bfea12e..af677e9 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/listener/EventRecordListener.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/listener/EventRecordListener.java @@ -35,4 +35,6 @@ public class EventRecordListener extends BasicListener { RecordSystem.entityMoves(e.getPlayer()); } + + //TODO: Listener, if player gets out (leaves, dies or starts to spectate), alternatively: track sent players } diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/record/RecordSystem.java b/FightSystem_Main/src/de/steamwar/fightsystem/record/RecordSystem.java index 1e228c2..632048f 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/record/RecordSystem.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/record/RecordSystem.java @@ -21,16 +21,16 @@ public class RecordSystem { } /* - * PlayerJoinPacket (0x00) + int SWUserId + int EntityId + * PlayerJoinPacket (0x00) + int EntityId + int SWUserId * EntityMovePacket (0x01) + int EntityId + double x, y, z + float pitch, yaw + * EntityDespawnsPacket (0x02) + int EntityId TODO Implementation * + * TODO (Player-Oriented): + * ItemInHandPacket (0x03) + int EntityId + * LeftClickPacket (0x04) + int EntityId + * RightClickPacket (0x05) + int EntityId TODO Bow spanning * - * - * - * - * - * - * + * TODO: Block Change Recordings * * * @@ -45,10 +45,10 @@ public class RecordSystem { public static void playerJoins(Player p){ SteamwarUser user = SteamwarUser.get(p.getUniqueId()); - ByteBuf buf = new UnpooledUnsafeDirectByteBuf(ByteBufAllocator.DEFAULT, 8, 8); //TODO size + ByteBuf buf = getByteBuf(); buf.writeByte(0x00); - buf.writeInt(user.getId()); buf.writeInt(p.getEntityId()); + buf.writeInt(user.getId()); send(buf); entityMoves(p); @@ -57,7 +57,7 @@ public class RecordSystem { public static void entityMoves(Entity e){ Location location = e.getLocation(); - ByteBuf buf = new UnpooledUnsafeDirectByteBuf(ByteBufAllocator.DEFAULT, 8, 8); //TODO size + ByteBuf buf = getByteBuf(); buf.writeByte(0x01); buf.writeInt(e.getEntityId()); buf.writeDouble(location.getX()); @@ -68,11 +68,23 @@ public class RecordSystem { send(buf); } + public static void playerLeaves(Player p){ + SteamwarUser user = SteamwarUser.get(p.getUniqueId()); + + ByteBuf buf = getByteBuf(); + buf.writeByte(0x02); + buf.writeInt(p.getEntityId()); + } + + private static ByteBuf getByteBuf(){ + return new UnpooledUnsafeDirectByteBuf(ByteBufAllocator.DEFAULT, 8, 8); //TODO size + } + private static void send(ByteBuf buf){ } private static void checkWorldState(){ - //TODO: TNT Entity position check + //TODO: Entity position transmissions } }