diff --git a/.idea/.gitignore b/.idea/.gitignore index 13566b81b018ad684f3a35fee301741b2734c8f4..2fd2e631a061da0fd9d009491ab696e69f18960a 100644 --- a/.idea/.gitignore +++ b/.idea/.gitignore @@ -6,3 +6,5 @@ # Datasource local storage ignored files /dataSources/ /dataSources.local.xml +/misc.xml + diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000000000000000000000000000000000000..f07edf43fd5a289e4b6ae3c41e745c07417fb94b --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="DataSourceManagerImpl" format="xml" multifile-model="true"> + <data-source source="LOCAL" name="battleArena@battlearena.database.windows.net" uuid="7b1fc391-14cb-46cf-a8a0-29c091f02047"> + <driver-ref>azure.ms</driver-ref> + <synchronize>true</synchronize> + <jdbc-driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc-driver> + <jdbc-url>jdbc:sqlserver://battlearena.database.windows.net:1433;database=battleArena;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;</jdbc-url> + <working-dir>$ProjectFileDir$</working-dir> + </data-source> + </component> +</project> \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index e7a7ee4e1a8bb936f74453926c8d1206f86e405b..f33e38f0f5d3f09852522d1e2b2b2325f91a3785 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -7,7 +7,7 @@ </list> </option> </component> - <component name="ProjectRootManager" version="2" languageLevel="JDK_21" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK"> + <component name="ProjectRootManager" version="2" languageLevel="JDK_21" project-jdk-name="21" project-jdk-type="JavaSDK"> <output url="file://$PROJECT_DIR$/out" /> </component> </project> \ No newline at end of file diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml new file mode 100644 index 0000000000000000000000000000000000000000..202cd50f9c4409d6939d4254c8f800abdc8d38f1 --- /dev/null +++ b/.idea/sqldialects.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="SqlDialectMappings"> + <file url="file://$PROJECT_DIR$/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Scripts/DDL_Script_Oracle.sql" dialect="AZURE" /> + <file url="PROJECT" dialect="AZURE" /> + </component> + <component name="SqlResolveMappings"> + <file url="file://$PROJECT_DIR$/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/DBalt.java" scope="{"node":{ "@negative":"1", "group":{ "@kind":"root", "node":{ "@negative":"1" } } }}" /> + </component> +</project> \ No newline at end of file diff --git a/pom.xml b/pom.xml index 231758b8295c2602c5156431d7eec666619df078..36eb916d13a61d55187df911e80f4a17af79d830 100644 --- a/pom.xml +++ b/pom.xml @@ -51,6 +51,24 @@ <version>19.0.2.1</version> </dependency> + <dependency> + <groupId>com.oracle.database.jdbc</groupId> + <artifactId>ojdbc11</artifactId> + <version>23.3.0.23.09</version> + </dependency> + + <dependency> + <groupId>com.microsoft.sqlserver</groupId> + <artifactId>mssql-jdbc</artifactId> + <version>12.4.2.jre11</version> + </dependency> + + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <version>2.10.1</version> + </dependency> + </dependencies> <build> diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/GameSceneController.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/GameSceneController.java index 5b490adc8bf54a93797c501e974081b25cbc9b7b..2e458da47f8bfdd16359a1c95f37a80cc0adec93 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/GameSceneController.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/GameSceneController.java @@ -4,7 +4,6 @@ import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; public class GameSceneController { - private static final Logger log = LogManager.getLogger(GameSceneController.class); } diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Exceptions/DatabaseError.java b/src/main/java/de/hdm_stuttgart/battlearena/Exceptions/DatabaseError.java new file mode 100644 index 0000000000000000000000000000000000000000..3c2e953535ca48de2903cebcd893380cebe023af --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Exceptions/DatabaseError.java @@ -0,0 +1,12 @@ +package de.hdm_stuttgart.battlearena.Exceptions; + +public class DatabaseError extends Exception{ + + public DatabaseError() {} + + public DatabaseError(String message2) + { + super(message2); + } + +} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/AzureDB.java b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/AzureDB.java new file mode 100644 index 0000000000000000000000000000000000000000..7fca7c404662488c81f3c3e85c21e077d82d94dd --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/AzureDB.java @@ -0,0 +1,86 @@ +package de.hdm_stuttgart.battlearena.Persistance.Classes; + +import de.hdm_stuttgart.battlearena.Exceptions.DatabaseError; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.ArrayList; + +public class AzureDB implements IDataBase{ + + /*this class is only here for showcasing the interchangeability of the DBMS*/ + + private static final Logger log = LogManager.getLogger(OracleDB.class); + + @Override + public Connection connect() throws DatabaseError { + try { + String url = "jdbc:sqlserver://battlearena.database.windows.net;encrypt=true;user=battleArenaAdmin;password=krassesRPGGame23#;databaseName=battleArena;"; + + log.info("Connecting to the database!"); + Connection connection = DriverManager.getConnection(url); + log.info("Database connection test" + connection.getCatalog()); + + connection.setAutoCommit(true); + + return connection; + } + catch(Exception e){ + log.error(e); + throw new DatabaseError("SQL Connection Error"); + } + } + + @Override + public ArrayList<MapData> getCoreMaps() throws DatabaseError{ + try(Connection connection = connect()) { + ArrayList<MapData> newMaps = new ArrayList<MapData>(); + String sql = "SELECT * FROM CoreMaps"; + PreparedStatement stmt = connection.prepareStatement(sql); + + log.info("Sending SQL statement"); + ResultSet rs = stmt.executeQuery(); + + while(rs.next()){ + newMaps.add(new MapData(rs.getString("map_id"), rs.getString("map_name"), rs.getInt("map_width"), rs.getInt("map_height"), rs.getString("map_data"))); + } + log.info("SQL query successful"); + rs.close(); + stmt.close(); + return newMaps; + } + catch(Exception e){ + log.error(e); + throw new DatabaseError("Error retrieving Coremaps"); + } + } + + public ArrayList<String> getCommunityMapsList() throws DatabaseError{ + try(Connection connection = connect()) { + ArrayList<String> tempList = new ArrayList<String>(); + String sql = "SELECT map_name FROM CommunityMaps"; + PreparedStatement stmt = connection.prepareStatement(sql); + + log.info("Sending SQL statement"); + ResultSet rs = stmt.executeQuery(); + + while(rs.next()){ + tempList.add(rs.getString("map_name")); + } + log.info("SQL query successful"); + rs.close(); + stmt.close(); + return tempList; + } + catch(Exception e){ + log.error(e); + throw new DatabaseError("Error retrieving MapList"); + } + } + + +} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/DBalt.java b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/DBalt.java new file mode 100644 index 0000000000000000000000000000000000000000..ddb1c2ba3bd5aac87f5231a7c78ae45bd306da87 --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/DBalt.java @@ -0,0 +1,191 @@ +package de.hdm_stuttgart.battlearena.Persistance.Classes; + +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; + + +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Properties; +import java.sql.*; + +public class DBalt implements IDataBasealt { + + private static final Logger log = LogManager.getLogger(DBalt.class); + + + @Override + public Connection connect() throws IOException, SQLException { + + log.info("Loading the properties File!"); + Properties properties = new Properties(); + properties.load(getClass().getClassLoader().getResourceAsStream("config.properties")); + + log.info("Connecting to the database!"); + Connection connection = DriverManager.getConnection(properties.getProperty("url"), properties.getProperty("user"), properties.getProperty("password")); + log.info("Database connection test" + connection.getCatalog()); + + connection.setAutoCommit(true); + + return connection; + } + + + @Override + public void createNewPlayer(String playerName) throws SQLException, IOException { + try(Connection connection = connect()) { + String sql = "INSERT INTO players (player_name, games_won, games_lost, kills, deaths, blocks_destroyed, ingame_time)" + "VALUES (?,?,?,?,?,?,?)"; + PreparedStatement preparedStatement = connection.prepareStatement(sql); + preparedStatement.setString(1, playerName); + preparedStatement.setInt(2, 0); + preparedStatement.setInt(3, 0); + preparedStatement.setInt(4, 0); + preparedStatement.setInt(5, 0); + preparedStatement.setInt(6, 0); + preparedStatement.setInt(7, 0); + + log.info("Inserting new player"); + preparedStatement.execute(); + } + } + + @Override + public void createMap(String name, int length, int width, String mapData) throws SQLException, IOException { + try(Connection connection = connect()) { + String mapSize = length + "X" + width; + + String sql = "INSERT INTO battleArena.dbo.maps (map_name, map_size, map_data, map_version, map_hash) VALUES(?,?,?,?,?)"; + PreparedStatement preparedStatement = connection.prepareStatement(sql); + preparedStatement.setString(1, name); + preparedStatement.setString(2, mapSize); + preparedStatement.setString(3, mapData); + + log.info("Inserting new map"); + preparedStatement.execute(); + } + } + + @Override + public LinkedHashMap<String, String> getMapNames() throws SQLException, IOException { + LinkedHashMap<String, String> mapNames = new LinkedHashMap<>(); + + try(Connection connection = connect()) { + String sql = "SELECT maps.map_id, maps.map_name FROM maps"; + PreparedStatement preparedStatement = connection.prepareStatement(sql); + ResultSet results = preparedStatement.executeQuery(); + log.info("Getting map names"); + while (results.next()) { + mapNames.put(results.getString("map_id"), results.getString("map_name")); + } + connection.close(); + return mapNames; + } + } + + @Override + public String getMapByID(String ID) throws SQLException, IOException { + try(Connection connection = connect()) { + String sql = "SELECT map_name FROM maps WHERE map_id = ?"; + PreparedStatement preparedStatement = connection.prepareStatement(sql); + preparedStatement.setString(1, ID); + log.info("Getting Map..."); + String map = preparedStatement.executeQuery().toString(); + return map; + } + } + + @Override + public String getMapSizeByID(String ID) throws SQLException, IOException { + try(Connection connection = connect()) { + String sql = "SELECT map_size FROM maps WHERE battleArena.dbo.maps.map_id=?"; + PreparedStatement preparedStatement = connection.prepareStatement(sql); + preparedStatement.setString(1, ID); + ResultSet result = preparedStatement.executeQuery(); + log.info("getting map size..."); + String mapSize = result.getString("map_size"); + return mapSize; + } + } + + @Override + public ResultSet getStatistics(String playerName) throws SQLException, IOException { + try(Connection connection = connect()){ + String sql = "SELECT * FROM players where player_name = ?"; + PreparedStatement preparedStatement = connection.prepareStatement(sql); + preparedStatement.setString(1, playerName); + ResultSet resultSet = preparedStatement.executeQuery(); + log.info("getting statistics..."); + return resultSet; + } + } + + @Override + public void updateMap(String mapID, String mapName, String mapData) throws SQLException, IOException { + try(Connection connection = connect()) { + String sql = "UPDATE maps SET map_name = ?, map_data = ? WHERE map_id = ?"; + PreparedStatement preparedStatement = connection.prepareStatement(sql); + preparedStatement.setString(1, mapName); + preparedStatement.setString(2, mapData); + preparedStatement.setString(3, mapID); + preparedStatement.execute(); + log.info("updating map in Database"); + } + } + + + @Override + public void updatePlayerName(String playerNameNew, String playerNameOld) throws SQLException, IOException { + try(Connection connection = connect()){ + String sql = "UPDATE players SET player_name = ? WHERE player_name = ?"; + PreparedStatement preparedStatement = connection.prepareStatement(sql); + preparedStatement.setString(1, playerNameNew); + preparedStatement.setString(2, playerNameOld); + preparedStatement.execute(); + log.info("updating player name in Database..."); + } + } + + @Override + public void updatePlayerStatistics(String playerName, int gamesWon, int gamesLost, int kills, int deaths, int blocksDestroyed, int gameTime) throws SQLException, IOException { + try (Connection connection = connect()){ + String sql = "UPDATE players SET games_won = ?, games_lost = ?, kills = ?, " + "deaths = ?, blocks_destroyed = ?, ingame_time = ? WHERE player_name = ?"; + PreparedStatement preparedStatement = connection.prepareStatement(sql); + preparedStatement.setInt(1, gamesWon); + preparedStatement.setInt(2, gamesLost); + preparedStatement.setInt(3, kills); + preparedStatement.setInt(4, deaths); + preparedStatement.setInt(5, blocksDestroyed); + preparedStatement.setInt(6, gameTime); + preparedStatement.setString(7, playerName); + preparedStatement.execute(); + log.info("updating player statistics"); + + } + } + + + @Override + public void deletePlayer(String playerName) throws IOException, SQLException { + try(Connection connection = connect()) { + String sql = "DELETE FROM players WHERE player_name=?"; + PreparedStatement preparedStatement = connection.prepareStatement(sql); + preparedStatement.setString(1, playerName); + preparedStatement.execute(); + log.info("deleting player"); + + } + } + + @Override + public void deleteMap(String mapID) throws SQLException, IOException { + try(Connection connection = connect()) { + String sql = "DELETE * FROM maps WHERE map_id = ?"; + PreparedStatement preparedStatement = connection.prepareStatement(sql); + preparedStatement.setString(1, mapID); + preparedStatement.execute(); + log.info("deleting map..."); + } + } + + +} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/GsonHandler.java b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/GsonHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..f0ae2281b4bc5dc4c928ab622c1363d99ff21995 --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/GsonHandler.java @@ -0,0 +1,45 @@ +package de.hdm_stuttgart.battlearena.Persistance.Classes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import de.hdm_stuttgart.battlearena.Exceptions.DatabaseError; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.io.FileReader; +import java.io.FileWriter; +import java.lang.reflect.Type; +import java.util.ArrayList; + +public class GsonHandler { + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + + private static final Logger log = LogManager.getLogger(GsonHandler.class); + Type mapDataType = new TypeToken<ArrayList<MapData>>(){}.getType(); + + public ArrayList<MapData> loadMaps(String filePath) throws DatabaseError{ + try (FileReader reader = new FileReader(filePath)) { + ArrayList<MapData> maps = new ArrayList<MapData>(); + maps = gson.fromJson(reader, mapDataType); + log.info("GSON - Maps successfully loaded from JSON"); + return maps; + } catch (Exception e) { + log.info(e); + log.info("GSON - Loading Maps from JSON failed"); + throw new DatabaseError("Error Loading Maps!"); + } + } + + public void saveMaps(ArrayList<MapData> maps, String filePath) throws DatabaseError{ + try (FileWriter writer = new FileWriter(filePath)) { + gson.toJson(maps, writer); + log.info("GSON - Maps successfully saved to JSON"); + } catch ( + Exception e) { + log.info(e); + log.info("GSON - Saving Maps to JSON failed"); + throw new DatabaseError("Error Loading Maps!"); + } + } +} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/IDataBase.java b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/IDataBase.java new file mode 100644 index 0000000000000000000000000000000000000000..cab1ba1463de1d506f2c5ea4b98affcb2f0c53d8 --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/IDataBase.java @@ -0,0 +1,14 @@ +package de.hdm_stuttgart.battlearena.Persistance.Classes; + +import de.hdm_stuttgart.battlearena.Exceptions.DatabaseError; + +import java.sql.Connection; +import java.util.ArrayList; + +public interface IDataBase { + + Connection connect() throws DatabaseError; + + ArrayList<MapData> getCoreMaps() throws DatabaseError; + +} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/IDataBasealt.java b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/IDataBasealt.java new file mode 100644 index 0000000000000000000000000000000000000000..fbd43943e8c18c1a57b381107379bf018375d238 --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/IDataBasealt.java @@ -0,0 +1,42 @@ +package de.hdm_stuttgart.battlearena.Persistance.Classes; + +import java.io.IOException; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.LinkedHashMap; + +public interface IDataBasealt { + + //connection-Methods + Connection connect() throws IOException, SQLException; + + + //CRUD Operations + + //Create Operations + void createNewPlayer(String playerName) throws SQLException, IOException; + + void createMap(String name, int length, int width, String mapData) throws SQLException, IOException; + + //Read-operations + LinkedHashMap<String, String> getMapNames() throws SQLException, IOException; + String getMapByID(String ID) throws SQLException, IOException; + String getMapSizeByID(String ID) throws SQLException, IOException; + + + + ResultSet getStatistics(String playerName) throws SQLException, IOException; + + //Update-operations + void updateMap(String mapID , String mapName, String mapData) throws SQLException, IOException; + + void updatePlayerName(String playerNameNew, String PlayerNameOld) throws SQLException, IOException; + + void updatePlayerStatistics(String playerName, int gamesWon, int gamesLost, int kills, int deaths, int blocksDestroyed, int gameTime) throws SQLException, IOException; + + + //Delete-operations + void deletePlayer(String playerName) throws IOException, SQLException; + void deleteMap(String mapID) throws SQLException, IOException; +} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/MapData.java b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/MapData.java new file mode 100644 index 0000000000000000000000000000000000000000..d395c69fee0d8229ec5cd1ebb05a4b4c4812580e --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/MapData.java @@ -0,0 +1,48 @@ +package de.hdm_stuttgart.battlearena.Persistance.Classes; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class MapData { + private static final Logger log = LogManager.getLogger(Persistence.class); + + private String mapID; + private String mapName; + private int mapWidth; + private int mapHeight; + private String mapData; + + protected MapData(String mapID, String mapName, int mapWidth, int mapHeight, String mapData) { + try { + this.mapID = mapID; + this.mapName = mapName; + this.mapWidth = mapWidth; + this.mapHeight = mapHeight; + this.mapData = mapData; + } + catch (Exception e){ + log.error(e); + } + } + + public String getMapID() { + return mapID; + } + + public String getMapName() { + return mapName; + } + + public int getMapWidth() { + return mapWidth; + } + + public int getMapHeight() { + return mapHeight; + } + + public String getMapData() { + return mapData; + } + +} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/OracleDB.java b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/OracleDB.java new file mode 100644 index 0000000000000000000000000000000000000000..596c158beaa32fa2339fd8c56e44c39906d71e6d --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/OracleDB.java @@ -0,0 +1,133 @@ +package de.hdm_stuttgart.battlearena.Persistance.Classes; + +import de.hdm_stuttgart.battlearena.Exceptions.DatabaseError; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.sql.*; +import java.util.ArrayList; +import java.util.Properties; + +import oracle.jdbc.pool.OracleDataSource; +import oracle.jdbc.OracleConnection; + +public class OracleDB implements IDataBase { + + private static final Logger log = LogManager.getLogger(OracleDB.class); + @Override + public Connection connect() throws DatabaseError{ + try { + OracleDataSource ods = new OracleDataSource(); + ods.setURL("jdbc:oracle:thin:@(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1521)(host=adb.eu-frankfurt-1.oraclecloud.com))(connect_data=(service_name=g093caf2cf1fea4_battlearena_high.adb.oraclecloud.com))(security=(ssl_server_dn_match=yes)))"); + ods.setUser("battlearenaplayer"); + ods.setPassword("jo3+++w3rw+s##AA"); + Connection conn = ods.getConnection(); + + log.info("Connecting to the database!"); + + return conn; + } + catch(Exception e){ + log.error(e); + throw new DatabaseError("SQL connection error"); + } + } + + @Override + public ArrayList<MapData> getCoreMaps() throws DatabaseError{ + try(Connection connection = connect()) { + ArrayList<MapData> newMaps = new ArrayList<MapData>(); + String sql = "SELECT * FROM battlearenadata.coremaps"; + PreparedStatement stmt = connection.prepareStatement(sql); + + log.info("Sending SQL statement"); + ResultSet rs = stmt.executeQuery(); + + while(rs.next()){ + newMaps.add(new MapData(rs.getString("map_id"), rs.getString("map_name"), rs.getInt("map_width"), rs.getInt("map_height"), rs.getString("map_data"))); + } + rs.close(); + stmt.close(); + log.info("Coremaps retrieved successfully"); + return newMaps; + } + catch(Exception e){ + log.error(e); + throw new DatabaseError("Error retrieving coremaps"); + } + } + + public ArrayList<String> getCommunityMapsList() throws DatabaseError{ + try(Connection connection = connect()) { + ArrayList<String> tempList = new ArrayList<String>(); + String sql = "SELECT map_name FROM battlearenadata.communitymaps"; + PreparedStatement stmt = connection.prepareStatement(sql); + + log.info("Sending SQL statement"); + ResultSet rs = stmt.executeQuery(); + + while(rs.next()){ + tempList.add(rs.getString("map_name")); + } + rs.close(); + stmt.close(); + log.info("Community map names retrieved successfully"); + return tempList; + } + catch(Exception e){ + log.error(e); + throw new DatabaseError("Error retrieving community map names"); + } + } + + public MapData getCommunityMapByID(String mapID) throws DatabaseError{ + try(Connection connection = connect()) { + String sql = "SELECT * FROM battlearenadata.communitymaps WHERE map_ID = ?"; + PreparedStatement stmt = connection.prepareStatement(sql); + stmt.setString(1, mapID); + + log.info("Sending SQL statement"); + ResultSet rs = stmt.executeQuery(); + + MapData mapChosen = new MapData(rs.getString("map_id"), rs.getString("map_name"), rs.getInt("map_width"), rs.getInt("map_height"), rs.getString("map_data")); + + rs.close(); + stmt.close(); + log.info("Community map retrieved successfully"); + return mapChosen; + } + catch(Exception e){ + log.error(e); + throw new DatabaseError("Error retrieving community map"); + } + } + + public void uploadCommunityMapByID(MapData map) throws DatabaseError{ + try(Connection connection = connect()) { + String sql = "INSERT INTO battlearenadata.communitymaps (map_id, map_name, map_width, map_height, map_data) VALUES (?, ?, ?, ?, ?)"; + PreparedStatement stmt = connection.prepareStatement(sql); + stmt.setString(1, map.getMapID()); + stmt.setString(2, map.getMapName()); + stmt.setInt(3, map.getMapWidth()); + stmt.setInt(4, map.getMapHeight()); + stmt.setString(5, map.getMapData()); + + log.info("Sending SQL statement"); + stmt.executeQuery(); + + stmt.close(); + log.info("Community Map retrieved successfully"); + } + catch(Exception e){ + log.error(e); + throw new DatabaseError("Error uploading created community map"); + } + } + +/* + public void updateCommunityStats(Persistence persistence){ + //Update the commulative Stats + } +*/ + +} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/Persistence.java b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/Persistence.java new file mode 100644 index 0000000000000000000000000000000000000000..f2a4fe12969855d9b7ad72d585f1678130e6e709 --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/Persistence.java @@ -0,0 +1,87 @@ +package de.hdm_stuttgart.battlearena.Persistance.Classes; + +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; + +import java.sql.Connection; +import java.util.ArrayList; + +public class Persistence { + + private static final Logger log = LogManager.getLogger(Persistence.class); + private static final Persistence persistenceSingleton = new Persistence(); + private final GsonHandler gsonHandler = new GsonHandler(); + private final DBalt sqlHandler = new DBalt(); //?? + private Connection connection; //?? + protected ArrayList<MapData> coreMaps; + protected ArrayList<MapData> communityMaps; + private final String filePathCoreMaps = "src/main/resources/maps/coreMaps.json"; + private final String filePathCommunityMaps = "src/main/resources/maps/communityMaps.json"; + private int[] sizeArrayInt; //?? + private String sizeString; //?? + protected static PlayerStatistics statistics = new PlayerStatistics("", 0,0,0,0,0,0); + //suggestion: rename to "playerData" + + + OracleDB db = new OracleDB(); //for testing purposes; evtl. Methoden von OracleDB static machen und von GSON Handler + + + private Persistence (){} + + public static Persistence getInstance(){ + return persistenceSingleton; + } + + public void loadCoreMaps(){ + try { + coreMaps = gsonHandler.loadMaps(filePathCoreMaps); + log.info("Maps successfully loaded from file"); + //log.info(coreMaps.get(0).getMapName()); //for testing purposes + } + catch(Exception e){ + log.error(e); + } + } + + public void updateCoreMaps(){ + try { + coreMaps = db.getCoreMaps(); + gsonHandler.saveMaps(coreMaps, filePathCoreMaps); + log.info("Maps successfully updated from SQL-Server"); + //log.info(coreMaps.get(0).getMapName()); //for testing purposes + } + catch(Exception e){ + log.error(e); + } + } + + public void getCommunityMap(String mapSelected){ + try { + communityMaps.add(db.getCommunityMapByID(mapSelected)); + gsonHandler.saveMaps(communityMaps, filePathCommunityMaps); + log.info("Community Map successfully retrieved from SQL-Server!"); + } + catch(Exception e){ + log.error(e); + } + } + + public void uploadCommunityMap(MapData map){ + try { + db.uploadCommunityMapByID(map); + communityMaps.add(map); //hier noch prüfen, ob die Map lokal bereits existiert (falls eine Verbindung zur DB scheitern sollte, kann man sie dennoch lokal speichern + gsonHandler.saveMaps(communityMaps, filePathCommunityMaps); + log.info("Maps successfully updated from SQL-Server!"); + } + catch(Exception e){ + log.error(e); + } + } + + public void createPlayer (){ + } + + public void loadStatistics(){ + } + +} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/PlayerStatistics.java b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/PlayerStatistics.java new file mode 100644 index 0000000000000000000000000000000000000000..fc46205131b8ea5a2a2dd37d17823261eaad90fa --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/PlayerStatistics.java @@ -0,0 +1,85 @@ +package de.hdm_stuttgart.battlearena.Persistance.Classes; + +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; + +public class PlayerStatistics { + private static final Logger log = LogManager.getLogger(PlayerStatistics.class); + + private String playerName; + private int gamesLost; + private int gamesWon; + private int kills; + private int deaths; + private int blocksDestroyed; + private int gameTime; + + public PlayerStatistics(String playerName, int gamesLost, int gamesWon, int kills, int deaths, int blocksDestroyed, int gameTime) { + this.playerName = playerName; + this.gamesLost = gamesLost; + this.gamesWon = gamesWon; + this.kills = kills; + this.deaths = deaths; + this.blocksDestroyed = blocksDestroyed; + this.gameTime = gameTime; + } + + public String getPlayerName() { + return playerName; + } + + public void setPlayerName(String playerName) { + this.playerName = playerName; + } + + public int getGamesLost() { + return gamesLost; + } + + public void setGamesLost(int gamesLost) { + this.gamesLost = gamesLost; + } + + public int getGamesWon() { + return gamesWon; + } + + public void setGamesWon(int gamesWon) { + this.gamesWon = gamesWon; + } + + public int getKills() { + return kills; + } + + public void setKills(int kills) { + this.kills = kills; + } + + public int getDeaths() { + return deaths; + } + + public void setDeaths(int deaths) { + this.deaths = deaths; + } + + public int getBlocksDestroyed() { + return blocksDestroyed; + } + + public void setBlocksDestroyed(int blocksDestroyed) { + this.blocksDestroyed = blocksDestroyed; + } + + public int getGameTime() { + return gameTime; + } + + public void setGameTime(int gameTime) { + this.gameTime = gameTime; + } + + + +} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/RuntimeInfo.java b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/RuntimeInfo.java new file mode 100644 index 0000000000000000000000000000000000000000..4a69623008a32deba93af9a097556a10bd759ef7 --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/RuntimeInfo.java @@ -0,0 +1,92 @@ +package de.hdm_stuttgart.battlearena.Persistance.Classes; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.util.ArrayList; +import java.util.LinkedHashMap; + +public class RuntimeInfo { + + private static final Logger log = LogManager.getLogger(RuntimeInfo.class); + private static final RuntimeInfo runtimeInfoSingleton = new RuntimeInfo(); + private final Persistence persistenceInst = Persistence.getInstance(); + private LinkedHashMap<String, String> mapNames; + public MapData mapCreated; //to store parsed Data from MapCreator for Upload to SQL + public String communityMapSelected; + protected ArrayList<String> coreMapsListLocal; //include mapID + protected ArrayList<String> communityMapsListLocal; //include mapID + protected ArrayList<String> communityMapsListRemote; + + public String mapTileString; //Maxe chose this name + + private RuntimeInfo(){}; + public static RuntimeInfo getInstance(){ + return runtimeInfoSingleton; + } + + private void setMap(String mapSelected, boolean choseCoremaps){ + if(choseCoremaps) { + for (int mapListIndex = 0; mapListIndex < persistenceInst.coreMaps.size(); mapListIndex++) { + if (persistenceInst.coreMaps.get(mapListIndex).getMapID().equals("mapSelected")) { + mapTileString = persistenceInst.coreMaps.get(mapListIndex).getMapID(); + } + } + } + else { + for (int mapListIndex = 0; mapListIndex < persistenceInst.communityMaps.size(); mapListIndex++) { + if (persistenceInst.communityMaps.get(mapListIndex).getMapID().equals("mapSelected")) { + mapTileString = persistenceInst.coreMaps.get(mapListIndex).getMapID(); + } + } + } + } + + public void getCommunityMap(){ + persistenceInst.getCommunityMap(communityMapSelected); + } + + public void uploadMapCreated(){ + persistenceInst.uploadCommunityMap(mapCreated); + } + //add Hash-Creator for creating map_ID and parse if map_data is according to specs + + private void updateStats(String outcome, String kills, String deaths, int gameTime){ + //update PlayerStatistics + //update SQL + } + + public void createCoreMapsList(){ + for(int i = 0; i < persistenceInst.coreMaps.size(); i++){ + coreMapsListLocal.add(persistenceInst.coreMaps.get(i).getMapName()); + } + } + + public void createCommunityMapsListLocal(){ + try { + for (int i = 0; i < persistenceInst.communityMaps.size(); i++) { + communityMapsListLocal.add(persistenceInst.communityMaps.get(i).getMapName()); + } + } + catch (Exception e){ + log.info(e); + } + } + //if no Data in JSON throw Exception and inform user + + public void fetchCommunityMapListRemote(){ + try { + communityMapsListRemote = persistenceInst.db.getCommunityMapsList(); + log.info("MapList successfully retrieved from server!"); + log.info(communityMapsListRemote.get(0)); //for testing purposes + } + catch(Exception e){ + log.error(e); + } + } + + public void getStatsByID(String playerID){ + //fetches from SQL stats by player with provided ID - players can display stats of other players in "Statistics" Scene + } + +} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/DataBase.java b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/DataBase.java deleted file mode 100644 index e766e18264ef67496e300c52199eae616e794db6..0000000000000000000000000000000000000000 --- a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/DataBase.java +++ /dev/null @@ -1,10 +0,0 @@ -package de.hdm_stuttgart.battlearena.Persistance; - -import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.LogManager; - -public class DataBase implements IDataBase{ - - private static final Logger log = LogManager.getLogger(DataBase.class); - -} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/IDataBase.java b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/IDataBase.java deleted file mode 100644 index 17187e8f1400a7d8e1af04e9e33392998a38246c..0000000000000000000000000000000000000000 --- a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/IDataBase.java +++ /dev/null @@ -1,4 +0,0 @@ -package de.hdm_stuttgart.battlearena.Persistance; - -public interface IDataBase { -} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Scripts/DDL_Script_AzureDB.sql b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Scripts/DDL_Script_AzureDB.sql new file mode 100644 index 0000000000000000000000000000000000000000..e3160edb42558c0e634ee0ba4efc3fa29c979013 --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Scripts/DDL_Script_AzureDB.sql @@ -0,0 +1,33 @@ +--Note: DDL to be run as admin on MsSQL (AzureDB); + +DROP TABLE coremaps; +DROP TABLE communitymaps; + +CREATE TABLE coremaps( + map_id CHAR(40) NOT NULL UNIQUE, --SHA1 hash is 40 chars length in hex + map_name VARCHAR(30) NOT NULL, + map_width INTEGER NOT NULL, + map_height INTEGER NOT NULL, + map_data VARCHAR(1682) NOT NULL); --allows for map size up to 29x29 + +CREATE TABLE communitymaps( + map_id CHAR(40) NOT NULL UNIQUE, --SHA1 hash is 40 chars length in hex + map_name VARCHAR(30) NOT NULL, + map_width INTEGER NOT NULL, + map_height INTEGER NOT NULL, + map_data VARCHAR(1682) NOT NULL); --allows for map size up to 29x29 + +INSERT INTO coremaps (map_id, map_name, map_width, map_height, map_data) +VALUES ('a593cafd1d061f0f463a2d2051bf4718aaaf5c48', + 'Arena1', + 18, + 18, + '4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 1 2 1 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 2 1 1 1 1 1 2 2 2 1 1 1 1 2 1 1 3 4 1 1 1 2 2 4 3 3 1 4 3 3 3 3 2 2 3 4 1 1 1 2 2 4 1 1 1 1 1 1 1 3 1 2 3 4 1 1 1 2 2 4 1 3 3 3 1 1 1 3 2 2 3 4 1 1 1 2 2 4 1 1 1 1 1 1 1 3 2 1 3 4 1 1 1 2 2 4 3 3 1 4 3 3 3 3 2 1 3 4 1 1 1 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 1 3 4 1 1 1 1 2 4 3 3 1 3 3 3 3 3 1 1 3 4 1 1 1 1 2 4 3 3 1 3 3 3 3 3 2 2 3 4 1 1 1 1 1 4 3 3 1 3 3 3 3 3 1 2 3 4 1 2 1 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 1 1 2 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 2 3 4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 2 3 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3'); + +INSERT INTO coremaps (map_id, map_name, map_width, map_height, map_data) +VALUES ('e559d8fbb53b333f5839cb3c6c0c515395afe344', + 'Arena2', + 18, + 18, + '4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 1 2 1 1 1 1 2 2 2 1 1 1 1 1 1 1 2 4 2 1 1 1 1 1 2 2 2 1 1 1 1 2 3 1 3 4 1 1 1 2 2 4 3 3 1 4 3 3 3 3 2 2 3 4 1 1 1 2 2 4 1 1 1 1 1 1 1 3 1 2 3 4 1 1 1 2 2 4 1 3 3 3 1 1 1 3 2 2 3 4 1 1 1 2 2 4 1 1 1 1 1 1 1 3 2 1 3 4 1 1 1 2 2 4 3 3 1 4 3 3 3 3 2 1 3 4 1 1 1 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 1 3 4 1 1 1 1 2 4 3 3 1 3 3 3 3 3 1 1 3 4 1 1 1 1 2 4 3 3 1 3 3 3 3 3 2 2 3 4 1 1 1 1 1 4 3 3 1 3 3 3 3 3 1 2 3 4 1 2 1 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 1 1 2 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 2 3 4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 2 3 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3'); + diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Scripts/DDL_Script_Oracle.sql b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Scripts/DDL_Script_Oracle.sql new file mode 100644 index 0000000000000000000000000000000000000000..aab3ddaec52c271354f8f716b7f4d5e56cced707 --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Scripts/DDL_Script_Oracle.sql @@ -0,0 +1,48 @@ +--Note: DDL to be run as admin on OracleDB; Passwords for user accounts are not included and must be inserted before execution + +DROP TABLE battlearenadata.coremaps; +DROP TABLE battlearenadata.communitymaps; + +DROP USER battlearenaplayer; +DROP USER battlearenadata; + +CREATE USER battlearenaplayer IDENTIFIED BY "insertPasswordHere"; +CREATE USER battlearenadata IDENTIFIED BY "insertPasswordHere"; + +GRANT CONNECT TO battlearenaplayer; + +CREATE TABLE battlearenadata.coremaps( + map_id CHAR(40) NOT NULL UNIQUE, --SHA1 hash is 40 chars length in hex + map_name VARCHAR(30) NOT NULL, + map_width INTEGER NOT NULL, + map_height INTEGER NOT NULL, + map_data VARCHAR(1682) NOT NULL); --allows for map size up to 29x29 + +CREATE TABLE battlearenadata.communitymaps( + map_id CHAR(40) NOT NULL UNIQUE, --SHA1 hash is 40 chars length in hex + map_name VARCHAR(30) NOT NULL, + map_width INTEGER NOT NULL, + map_height INTEGER NOT NULL, + map_data VARCHAR(1682) NOT NULL); --allows for map size up to 29x29 + +ALTER USER battlearenadata QUOTA 500M ON coremaps; +ALTER USER battlearenadata QUOTA 500M ON communitymaps; + +INSERT INTO battlearenadata.coremaps (map_id, map_name, map_width, map_height, map_data) +VALUES ('a593cafd1d061f0f463a2d2051bf4718aaaf5c48', + 'Arena1', + 18, + 18, + '4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 1 2 1 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 2 1 1 1 1 1 2 2 2 1 1 1 1 2 1 1 3 4 1 1 1 2 2 4 3 3 1 4 3 3 3 3 2 2 3 4 1 1 1 2 2 4 1 1 1 1 1 1 1 3 1 2 3 4 1 1 1 2 2 4 1 3 3 3 1 1 1 3 2 2 3 4 1 1 1 2 2 4 1 1 1 1 1 1 1 3 2 1 3 4 1 1 1 2 2 4 3 3 1 4 3 3 3 3 2 1 3 4 1 1 1 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 1 3 4 1 1 1 1 2 4 3 3 1 3 3 3 3 3 1 1 3 4 1 1 1 1 2 4 3 3 1 3 3 3 3 3 2 2 3 4 1 1 1 1 1 4 3 3 1 3 3 3 3 3 1 2 3 4 1 2 1 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 1 1 2 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 2 3 4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 2 3 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3'); + +INSERT INTO battlearenadata.coremaps (map_id, map_name, map_width, map_height, map_data) +VALUES ('e559d8fbb53b333f5839cb3c6c0c515395afe344', + 'Arena2', + 18, + 18, + '4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 1 2 1 1 1 1 2 2 2 1 1 1 1 1 1 1 2 4 2 1 1 1 1 1 2 2 2 1 1 1 1 2 3 1 3 4 1 1 1 2 2 4 3 3 1 4 3 3 3 3 2 2 3 4 1 1 1 2 2 4 1 1 1 1 1 1 1 3 1 2 3 4 1 1 1 2 2 4 1 3 3 3 1 1 1 3 2 2 3 4 1 1 1 2 2 4 1 1 1 1 1 1 1 3 2 1 3 4 1 1 1 2 2 4 3 3 1 4 3 3 3 3 2 1 3 4 1 1 1 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 1 3 4 1 1 1 1 2 4 3 3 1 3 3 3 3 3 1 1 3 4 1 1 1 1 2 4 3 3 1 3 3 3 3 3 2 2 3 4 1 1 1 1 1 4 3 3 1 3 3 3 3 3 1 2 3 4 1 2 1 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 1 1 2 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 2 3 4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 2 3 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3'); + + +GRANT SELECT ON battlearenadata.coremaps TO battlearenaplayer; + +GRANT SELECT, INSERT ON battlearenadata.communitymaps TO battlearenaplayer; \ No newline at end of file diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index c37776eeb147449e3fa1dbb6aaf650b8c5f12637..e006608abd4f23d42e2fac09ce505582f50d0423 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -3,8 +3,13 @@ module gui { requires javafx.fxml; requires javafx.media; requires org.apache.logging.log4j; + requires java.sql; + requires com.google.gson; + requires com.oracle.database.jdbc; + requires java.naming; opens de.hdm_stuttgart.battlearena to javafx.fxml; exports de.hdm_stuttgart.battlearena.Main; exports de.hdm_stuttgart.battlearena.Controller; + opens de.hdm_stuttgart.battlearena.Persistance.Classes to com.google.gson, javafx.fxml; } diff --git a/src/main/resources/de/hdm_stuttgart/battlearena/config.properties b/src/main/resources/de/hdm_stuttgart/battlearena/config.properties index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..dbd084cebdb997732b0b641b24d6d1d4a64c1c55 100644 --- a/src/main/resources/de/hdm_stuttgart/battlearena/config.properties +++ b/src/main/resources/de/hdm_stuttgart/battlearena/config.properties @@ -0,0 +1,3 @@ +url=jdbc:sqlserver://battlearena.database.windows.net:1433;database=battleArena;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30; +user=battleArenaAdmin@battlearena; +password=krassesRPGGame23# diff --git a/src/main/resources/maps/communityMaps.json b/src/main/resources/maps/communityMaps.json new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/main/resources/maps/coreMaps.json b/src/main/resources/maps/coreMaps.json new file mode 100644 index 0000000000000000000000000000000000000000..84828ae2b407d2ff4b089fdb479656a518e3a688 --- /dev/null +++ b/src/main/resources/maps/coreMaps.json @@ -0,0 +1,16 @@ +[ + { + "mapID": "a593cafd1d061f0f463a2d2051bf4718aaaf5c48", + "mapName": "Arena1", + "mapWidth": 18, + "mapHeight": 18, + "mapData": "4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 1 2 1 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 2 1 1 1 1 1 2 2 2 1 1 1 1 2 1 1 3 4 1 1 1 2 2 4 3 3 1 4 3 3 3 3 2 2 3 4 1 1 1 2 2 4 1 1 1 1 1 1 1 3 1 2 3 4 1 1 1 2 2 4 1 3 3 3 1 1 1 3 2 2 3 4 1 1 1 2 2 4 1 1 1 1 1 1 1 3 2 1 3 4 1 1 1 2 2 4 3 3 1 4 3 3 3 3 2 1 3 4 1 1 1 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 1 3 4 1 1 1 1 2 4 3 3 1 3 3 3 3 3 1 1 3 4 1 1 1 1 2 4 3 3 1 3 3 3 3 3 2 2 3 4 1 1 1 1 1 4 3 3 1 3 3 3 3 3 1 2 3 4 1 2 1 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 1 1 2 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 2 3 4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 2 3 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3" + }, + { + "mapID": "e559d8fbb53b333f5839cb3c6c0c515395afe344", + "mapName": "Arena2", + "mapWidth": 18, + "mapHeight": 18, + "mapData": "4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 1 2 1 1 1 1 2 2 2 1 1 1 1 1 1 1 2 4 2 1 1 1 1 1 2 2 2 1 1 1 1 2 3 1 3 4 1 1 1 2 2 4 3 3 1 4 3 3 3 3 2 2 3 4 1 1 1 2 2 4 1 1 1 1 1 1 1 3 1 2 3 4 1 1 1 2 2 4 1 3 3 3 1 1 1 3 2 2 3 4 1 1 1 2 2 4 1 1 1 1 1 1 1 3 2 1 3 4 1 1 1 2 2 4 3 3 1 4 3 3 3 3 2 1 3 4 1 1 1 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 1 3 4 1 1 1 1 2 4 3 3 1 3 3 3 3 3 1 1 3 4 1 1 1 1 2 4 3 3 1 3 3 3 3 3 2 2 3 4 1 1 1 1 1 4 3 3 1 3 3 3 3 3 1 2 3 4 1 2 1 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 1 1 2 1 1 1 2 2 2 1 1 1 1 1 1 1 3 4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 2 3 4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 2 3 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3" + } +] \ No newline at end of file diff --git a/src/main/resources/player/player.txt b/src/main/resources/player/player.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/main/resources/player/playerStats.json b/src/main/resources/player/playerStats.json new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391