summaryrefslogtreecommitdiff
path: root/src/main/java/net/cshift/transit/network/packet/StaticPacket.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/cshift/transit/network/packet/StaticPacket.java')
-rw-r--r--src/main/java/net/cshift/transit/network/packet/StaticPacket.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main/java/net/cshift/transit/network/packet/StaticPacket.java b/src/main/java/net/cshift/transit/network/packet/StaticPacket.java
new file mode 100644
index 0000000..3daefb0
--- /dev/null
+++ b/src/main/java/net/cshift/transit/network/packet/StaticPacket.java
@@ -0,0 +1,36 @@
+package net.cshift.transit.network.packet;
+
+import net.cshift.transit.type.*;
+
+/** Simple packet which stores an unchanging value.
+ * @author Kyle Gunger
+ *
+ * @param <D> The data type (Object) that the packet transfers.
+ */
+public class StaticPacket<D> implements IStaticPacket<D>
+{
+ private Object data;
+ private Type<D> type;
+
+ /** Constructor. Stores the given data and uses the given type.
+ *
+ * @param dat The packet's data
+ * @param t The packet's type
+ */
+ public StaticPacket(Object dat, Type<D> t)
+ {
+ data = dat;
+ type = t;
+ }
+
+ @Override
+ public Object getData()
+ {
+ return data;
+ }
+
+ @Override
+ public Type<D> getType() {
+ return type;
+ }
+}