diff --git a/common/src/main/java/us/myles/ViaVersion/api/protocol/ClientboundPacketType.java b/common/src/main/java/us/myles/ViaVersion/api/protocol/ClientboundPacketType.java index ffda1facd..2997d8329 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/protocol/ClientboundPacketType.java +++ b/common/src/main/java/us/myles/ViaVersion/api/protocol/ClientboundPacketType.java @@ -4,15 +4,5 @@ package us.myles.ViaVersion.api.protocol; * Interface to be implemented by server outgoing packet type enums, * representing PLAY state packets, ordered by their packet id. */ -public interface ClientboundPacketType { - - /** - * @return name of the packet, to be consistent over multiple versions - */ - String name(); - - /** - * @return ordinal, being the packet id for the implemented protocol - */ - int ordinal(); +public interface ClientboundPacketType extends PacketType { } diff --git a/common/src/main/java/us/myles/ViaVersion/api/protocol/PacketType.java b/common/src/main/java/us/myles/ViaVersion/api/protocol/PacketType.java new file mode 100644 index 000000000..0d668fe9e --- /dev/null +++ b/common/src/main/java/us/myles/ViaVersion/api/protocol/PacketType.java @@ -0,0 +1,20 @@ +package us.myles.ViaVersion.api.protocol; + +/** + * Interface representing PLAY state packets, ordered by their packet id. + * + * @see ClientboundPacketType + * @see ServerboundPacketType + */ +public interface PacketType { + + /** + * @return name of the packet, to be consistent over multiple versions + */ + String name(); + + /** + * @return ordinal, being the packet id for the implemented protocol + */ + int ordinal(); +} diff --git a/common/src/main/java/us/myles/ViaVersion/api/protocol/Protocol.java b/common/src/main/java/us/myles/ViaVersion/api/protocol/Protocol.java index af872ea2d..56e8c2fcc 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/protocol/Protocol.java +++ b/common/src/main/java/us/myles/ViaVersion/api/protocol/Protocol.java @@ -284,6 +284,8 @@ public abstract class Protocol en.name().equals(packetType.name())).findAny().orElse(null); Preconditions.checkNotNull(mappedPacket, "Packet type " + packetType + " in " + packetType.getClass().getSimpleName() + " could not be automatically mapped!"); @@ -301,6 +303,9 @@ public abstract class Protocol en.name().equals(packetType.name())).findAny().orElse(null); @@ -345,6 +350,9 @@ public abstract class Protocol T get(Class objectClass) { return (T) storedObjects.get(objectClass); } diff --git a/common/src/main/java/us/myles/ViaVersion/api/protocol/ServerboundPacketType.java b/common/src/main/java/us/myles/ViaVersion/api/protocol/ServerboundPacketType.java index c6dbd3b4c..dc16ea337 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/protocol/ServerboundPacketType.java +++ b/common/src/main/java/us/myles/ViaVersion/api/protocol/ServerboundPacketType.java @@ -4,15 +4,5 @@ package us.myles.ViaVersion.api.protocol; * Interface to be implemented by server incoming packet type enums, * representing PLAY state packets, ordered by their packet id. */ -public interface ServerboundPacketType { - - /** - * @return name of the packet, to be consistent over multiple versions - */ - String name(); - - /** - * @return ordinal, being the packet id for the implemented protocol - */ - int ordinal(); +public interface ServerboundPacketType extends PacketType { }