diff --git a/src/de/steamwar/network/packets/NetworkPacket.java b/src/de/steamwar/network/packets/NetworkPacket.java
new file mode 100644
index 0000000..b1d6bf3
--- /dev/null
+++ b/src/de/steamwar/network/packets/NetworkPacket.java
@@ -0,0 +1,49 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2022 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar.network.packets;
+
+import lombok.EqualsAndHashCode;
+import lombok.SneakyThrows;
+
+import java.io.*;
+
+@EqualsAndHashCode
+public abstract class NetworkPacket implements Serializable {
+
+ @SneakyThrows
+ public byte[] serialize() {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(this);
+ oos.flush();
+ return baos.toByteArray();
+ }
+
+ public static void handle(byte[] data) {
+ PacketHandler.handlePacket(deserialize(data));
+ }
+
+ @SneakyThrows
+ public static NetworkPacket deserialize(byte[] data) {
+ ByteArrayInputStream bais = new ByteArrayInputStream(data);
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ return (NetworkPacket) ois.readObject();
+ }
+}
diff --git a/src/de/steamwar/network/packets/PacketHandler.java b/src/de/steamwar/network/packets/PacketHandler.java
new file mode 100644
index 0000000..f23afe5
--- /dev/null
+++ b/src/de/steamwar/network/packets/PacketHandler.java
@@ -0,0 +1,76 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2022 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar.network.packets;
+
+import lombok.SneakyThrows;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public abstract class PacketHandler {
+
+ private static final List PACKET_HANDLERS = new ArrayList<>();
+
+ private final Map, Method> HANDLER_MAP = new HashMap<>();
+
+ public static void handlePacket(NetworkPacket packet) {
+ for (PacketHandler handler : PACKET_HANDLERS) {
+ handler.handle(packet);
+ }
+ }
+
+ protected PacketHandler() {
+ Method[] methods = getClass().getMethods();
+ for (Method method : methods) {
+ if(method.getParameterCount() != 1 || !NetworkPacket.class.isAssignableFrom(method.getParameterTypes()[0])) {
+ continue;
+ }
+ if (method.isAnnotationPresent(Handler.class)) {
+ Class extends NetworkPacket> packetClass = (Class extends NetworkPacket>) method.getParameterTypes()[0];
+ HANDLER_MAP.put(packetClass, method);
+ }
+ }
+ }
+
+ public void register() {
+ PACKET_HANDLERS.add(this);
+ }
+
+ public void unregister() {
+ PACKET_HANDLERS.remove(this);
+ }
+
+ @SneakyThrows
+ public void handle(NetworkPacket packet) {
+ Method method = HANDLER_MAP.get(packet.getClass());
+ if (method == null) {
+ return;
+ }
+ method.invoke(this, packet);
+ }
+
+ @Retention(RetentionPolicy.RUNTIME)
+ protected @interface Handler {}
+}
diff --git a/src/de/steamwar/network/packets/client/ExecuteCommandPacket.java b/src/de/steamwar/network/packets/client/ExecuteCommandPacket.java
new file mode 100644
index 0000000..9f7d000
--- /dev/null
+++ b/src/de/steamwar/network/packets/client/ExecuteCommandPacket.java
@@ -0,0 +1,37 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2022 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar.network.packets.client;
+
+import de.steamwar.network.packets.NetworkPacket;
+import lombok.AllArgsConstructor;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Getter
+public class ExecuteCommandPacket extends NetworkPacket {
+
+ private static final long serialVersionUID = 6283457297487602016L;
+ private int playerId;
+ private String command;
+}
diff --git a/src/de/steamwar/network/packets/client/ImALobbyPacket.java b/src/de/steamwar/network/packets/client/ImALobbyPacket.java
new file mode 100644
index 0000000..d8e1ba4
--- /dev/null
+++ b/src/de/steamwar/network/packets/client/ImALobbyPacket.java
@@ -0,0 +1,29 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2022 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar.network.packets.client;
+
+import de.steamwar.network.packets.NetworkPacket;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+
+@EqualsAndHashCode(callSuper = true)
+public class ImALobbyPacket extends NetworkPacket {
+ private static final long serialVersionUID = 8110246509205246654L;
+}
diff --git a/src/de/steamwar/network/packets/client/InventoryCallbackPacket.java b/src/de/steamwar/network/packets/client/InventoryCallbackPacket.java
new file mode 100644
index 0000000..cfe9fbc
--- /dev/null
+++ b/src/de/steamwar/network/packets/client/InventoryCallbackPacket.java
@@ -0,0 +1,88 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2022 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar.network.packets.client;
+
+import de.steamwar.network.packets.NetworkPacket;
+import lombok.*;
+
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Getter
+public class InventoryCallbackPacket extends NetworkPacket {
+ private static final long serialVersionUID = -261823209186008718L;
+ @Builder.Default
+ private int position = -1;
+ private int owner;
+ private CallbackType type;
+ @Builder.Default
+ private ClickType clickType = ClickType.UNKNOWN;
+
+ public enum CallbackType {
+ CLICK,
+ CLOSE,
+ }
+
+ public enum ClickType {
+ LEFT,
+ SHIFT_LEFT,
+ RIGHT,
+ SHIFT_RIGHT,
+ WINDOW_BORDER_LEFT,
+ WINDOW_BORDER_RIGHT,
+ MIDDLE,
+ NUMBER_KEY,
+ DOUBLE_CLICK,
+ DROP,
+ CONTROL_DROP,
+ CREATIVE,
+ UNKNOWN;
+
+ public boolean isKeyboardClick() {
+ return this == NUMBER_KEY || this == DROP || this == CONTROL_DROP;
+ }
+
+ public boolean isCreativeAction() {
+ return this == MIDDLE || this == CREATIVE;
+ }
+
+ public boolean isRightClick() {
+ return this == RIGHT || this == SHIFT_RIGHT;
+ }
+
+ public boolean isLeftClick() {
+ return this == LEFT || this == SHIFT_LEFT || this == DOUBLE_CLICK || this == CREATIVE;
+ }
+
+ public boolean isShiftClick() {
+ return this == SHIFT_LEFT || this == SHIFT_RIGHT || this == CONTROL_DROP;
+ }
+
+ public static ClickType getByName(String name) {
+ for (ClickType type : values()) {
+ if (type.name().equalsIgnoreCase(name)) {
+ return type;
+ }
+ }
+ return UNKNOWN;
+ }
+ }
+}
diff --git a/src/de/steamwar/network/packets/client/PrepareSchemPacket.java b/src/de/steamwar/network/packets/client/PrepareSchemPacket.java
new file mode 100644
index 0000000..8f607fa
--- /dev/null
+++ b/src/de/steamwar/network/packets/client/PrepareSchemPacket.java
@@ -0,0 +1,38 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2022 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar.network.packets.client;
+
+import de.steamwar.network.packets.NetworkPacket;
+import lombok.AllArgsConstructor;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Getter
+public class PrepareSchemPacket extends NetworkPacket {
+
+ private static final long serialVersionUID = -4798561188105813349L;
+ private int player;
+ private int schem;
+ private String schemType;
+}
diff --git a/src/de/steamwar/network/packets/common/FightEndsPacket.java b/src/de/steamwar/network/packets/common/FightEndsPacket.java
new file mode 100644
index 0000000..a970d7b
--- /dev/null
+++ b/src/de/steamwar/network/packets/common/FightEndsPacket.java
@@ -0,0 +1,41 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2022 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar.network.packets.common;
+
+import de.steamwar.network.packets.NetworkPacket;
+import lombok.*;
+
+import java.util.List;
+
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Getter
+public class FightEndsPacket extends NetworkPacket {
+
+ private static final long serialVersionUID = 1279352415549011332L;
+ private byte win;
+ private int blueSchem;
+ private int redSchem;
+ private List bluePlayers;
+ private List redPlayers;
+ private String gameMode;
+}
diff --git a/src/de/steamwar/network/packets/common/FightInfoPacket.java b/src/de/steamwar/network/packets/common/FightInfoPacket.java
new file mode 100644
index 0000000..bbca8b0
--- /dev/null
+++ b/src/de/steamwar/network/packets/common/FightInfoPacket.java
@@ -0,0 +1,49 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2022 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar.network.packets.common;
+
+import de.steamwar.network.packets.NetworkPacket;
+import lombok.*;
+
+import java.util.List;
+
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Getter
+public class FightInfoPacket extends NetworkPacket {
+
+ private static final long serialVersionUID = 7448644597856605853L;
+ private @With String serverName;
+ private String gameMode;
+ private String arena;
+ private String blueName;
+ private String redName;
+ private String fightState;
+ private int countdown;
+ private int blueLeader;
+ private int redLeader;
+ private int blueSchem;
+ private int redSchem;
+ private List bluePlayers;
+ private List redPlayers;
+ private List spectators;
+}
diff --git a/src/de/steamwar/network/packets/server/BaumemberUpdatePacket.java b/src/de/steamwar/network/packets/server/BaumemberUpdatePacket.java
new file mode 100644
index 0000000..5351473
--- /dev/null
+++ b/src/de/steamwar/network/packets/server/BaumemberUpdatePacket.java
@@ -0,0 +1,29 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2022 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar.network.packets.server;
+
+import de.steamwar.network.packets.NetworkPacket;
+import lombok.EqualsAndHashCode;
+
+@EqualsAndHashCode(callSuper = true)
+public class BaumemberUpdatePacket extends NetworkPacket {
+ private static final long serialVersionUID = 6863118892424244051L;
+
+}
diff --git a/src/de/steamwar/network/packets/server/CloseInventoryPacket.java b/src/de/steamwar/network/packets/server/CloseInventoryPacket.java
new file mode 100644
index 0000000..e30d927
--- /dev/null
+++ b/src/de/steamwar/network/packets/server/CloseInventoryPacket.java
@@ -0,0 +1,36 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2022 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar.network.packets.server;
+
+import de.steamwar.network.packets.NetworkPacket;
+import lombok.AllArgsConstructor;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Getter
+public class CloseInventoryPacket extends NetworkPacket {
+
+ private static final long serialVersionUID = -2191021190060504521L;
+ private int playerId;
+}
diff --git a/src/de/steamwar/network/packets/server/InventoryPacket.java b/src/de/steamwar/network/packets/server/InventoryPacket.java
new file mode 100644
index 0000000..8e7f7b3
--- /dev/null
+++ b/src/de/steamwar/network/packets/server/InventoryPacket.java
@@ -0,0 +1,41 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2022 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar.network.packets.server;
+
+import de.steamwar.network.packets.NetworkPacket;
+import lombok.AllArgsConstructor;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+import java.util.Map;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Getter
+public class InventoryPacket extends NetworkPacket {
+
+ private static final long serialVersionUID = 8071052544654047316L;
+ private String title;
+ private int player;
+ private int size;
+ private Map items;
+}
diff --git a/src/de/steamwar/network/packets/server/PingPacket.java b/src/de/steamwar/network/packets/server/PingPacket.java
new file mode 100644
index 0000000..88ac32a
--- /dev/null
+++ b/src/de/steamwar/network/packets/server/PingPacket.java
@@ -0,0 +1,35 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2022 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar.network.packets.server;
+
+import de.steamwar.network.packets.NetworkPacket;
+import lombok.AllArgsConstructor;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Getter
+public class PingPacket extends NetworkPacket {
+ private static final long serialVersionUID = 714647343959550378L;
+ private int id;
+}
diff --git a/src/de/steamwar/network/packets/server/StartingServerPacket.java b/src/de/steamwar/network/packets/server/StartingServerPacket.java
new file mode 100644
index 0000000..f536d8f
--- /dev/null
+++ b/src/de/steamwar/network/packets/server/StartingServerPacket.java
@@ -0,0 +1,35 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2022 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar.network.packets.server;
+
+import de.steamwar.network.packets.NetworkPacket;
+import lombok.AllArgsConstructor;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Getter
+public class StartingServerPacket extends NetworkPacket {
+ private static final long serialVersionUID = 2808607245898121801L;
+ private int user;
+}
diff --git a/testsrc/de/steamwar/RandomGenerator.java b/testsrc/de/steamwar/RandomGenerator.java
new file mode 100644
index 0000000..b9ea1a2
--- /dev/null
+++ b/testsrc/de/steamwar/RandomGenerator.java
@@ -0,0 +1,83 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2022 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar;
+
+import java.util.*;
+import java.util.function.Function;
+
+public class RandomGenerator {
+
+ private static final Random random = new Random();
+ private static final Map, Function, ?>> generators = new HashMap<>();
+
+ static {
+ generators.put(Integer.class, (clazz) -> random.nextInt());
+ generators.put(int.class, (clazz) -> random.nextInt());
+ generators.put(Double.class, (clazz) -> random.nextDouble());
+ generators.put(double.class, (clazz) -> random.nextInt());
+ generators.put(Boolean.class, (clazz) -> random.nextBoolean());
+ generators.put(boolean.class, (clazz) -> random.nextBoolean());
+ generators.put(Byte.class, (clazz) -> (byte) random.nextInt(127));
+ generators.put(byte.class, (clazz) -> (byte) random.nextInt(127));
+
+ generators.put(List.class, aClass -> {
+ int length = random.nextInt(10);
+ List