From 7033c243ef234236204030a481cace50281681fd Mon Sep 17 00:00:00 2001 From: Schuh Martin <ms618@hdm-stuttgart.de> Date: Mon, 18 Dec 2023 19:33:08 +0100 Subject: [PATCH] Revert "Merge branch 'DataBase' into 'main'" This reverts merge request !6 --- .idea/.gitignore | 2 - .idea/dataSources.xml | 12 -- .idea/misc.xml | 2 +- .idea/sqldialects.xml | 10 - pom.xml | 18 -- .../Controller/GameSceneController.java | 1 + .../battlearena/Exceptions/DatabaseError.java | 12 -- .../Persistance/Classes/AzureDB.java | 86 -------- .../Persistance/Classes/DBalt.java | 191 ------------------ .../Persistance/Classes/GsonHandler.java | 45 ----- .../Persistance/Classes/IDataBase.java | 14 -- .../Persistance/Classes/IDataBasealt.java | 42 ---- .../Persistance/Classes/MapData.java | 48 ----- .../Persistance/Classes/OracleDB.java | 133 ------------ .../Persistance/Classes/Persistence.java | 87 -------- .../Persistance/Classes/PlayerStatistics.java | 85 -------- .../Persistance/Classes/RuntimeInfo.java | 92 --------- .../battlearena/Persistance/DataBase.java | 10 + .../battlearena/Persistance/IDataBase.java | 4 + .../Scripts/DDL_Script_AzureDB.sql | 33 --- .../Persistance/Scripts/DDL_Script_Oracle.sql | 48 ----- src/main/java/module-info.java | 5 - .../battlearena/config.properties | 3 - src/main/resources/maps/communityMaps.json | 0 src/main/resources/maps/coreMaps.json | 16 -- src/main/resources/player/player.txt | 0 src/main/resources/player/playerStats.json | 0 27 files changed, 16 insertions(+), 983 deletions(-) delete mode 100644 .idea/dataSources.xml delete mode 100644 .idea/sqldialects.xml delete mode 100644 src/main/java/de/hdm_stuttgart/battlearena/Exceptions/DatabaseError.java delete mode 100644 src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/AzureDB.java delete mode 100644 src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/DBalt.java delete mode 100644 src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/GsonHandler.java delete mode 100644 src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/IDataBase.java delete mode 100644 src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/IDataBasealt.java delete mode 100644 src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/MapData.java delete mode 100644 src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/OracleDB.java delete mode 100644 src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/Persistence.java delete mode 100644 src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/PlayerStatistics.java delete mode 100644 src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/RuntimeInfo.java create mode 100644 src/main/java/de/hdm_stuttgart/battlearena/Persistance/DataBase.java create mode 100644 src/main/java/de/hdm_stuttgart/battlearena/Persistance/IDataBase.java delete mode 100644 src/main/java/de/hdm_stuttgart/battlearena/Persistance/Scripts/DDL_Script_AzureDB.sql delete mode 100644 src/main/java/de/hdm_stuttgart/battlearena/Persistance/Scripts/DDL_Script_Oracle.sql delete mode 100644 src/main/resources/maps/communityMaps.json delete mode 100644 src/main/resources/maps/coreMaps.json delete mode 100644 src/main/resources/player/player.txt delete mode 100644 src/main/resources/player/playerStats.json diff --git a/.idea/.gitignore b/.idea/.gitignore index 2fd2e631..13566b81 100644 --- a/.idea/.gitignore +++ b/.idea/.gitignore @@ -6,5 +6,3 @@ # Datasource local storage ignored files /dataSources/ /dataSources.local.xml -/misc.xml - diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml deleted file mode 100644 index f07edf43..00000000 --- a/.idea/dataSources.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?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 f33e38f0..e7a7ee4e 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="21" project-jdk-type="JavaSDK"> + <component name="ProjectRootManager" version="2" languageLevel="JDK_21" project-jdk-name="openjdk-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 deleted file mode 100644 index 202cd50f..00000000 --- a/.idea/sqldialects.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?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 36eb916d..231758b8 100644 --- a/pom.xml +++ b/pom.xml @@ -51,24 +51,6 @@ <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 2e458da4..5b490adc 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/GameSceneController.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/GameSceneController.java @@ -4,6 +4,7 @@ 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 deleted file mode 100644 index 3c2e9535..00000000 --- a/src/main/java/de/hdm_stuttgart/battlearena/Exceptions/DatabaseError.java +++ /dev/null @@ -1,12 +0,0 @@ -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 deleted file mode 100644 index 7fca7c40..00000000 --- a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/AzureDB.java +++ /dev/null @@ -1,86 +0,0 @@ -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 deleted file mode 100644 index ddb1c2ba..00000000 --- a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/DBalt.java +++ /dev/null @@ -1,191 +0,0 @@ -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 deleted file mode 100644 index f0ae2281..00000000 --- a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/GsonHandler.java +++ /dev/null @@ -1,45 +0,0 @@ -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 deleted file mode 100644 index cab1ba14..00000000 --- a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/IDataBase.java +++ /dev/null @@ -1,14 +0,0 @@ -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 deleted file mode 100644 index fbd43943..00000000 --- a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/IDataBasealt.java +++ /dev/null @@ -1,42 +0,0 @@ -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 deleted file mode 100644 index d395c69f..00000000 --- a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/MapData.java +++ /dev/null @@ -1,48 +0,0 @@ -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 deleted file mode 100644 index 596c158b..00000000 --- a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/OracleDB.java +++ /dev/null @@ -1,133 +0,0 @@ -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 deleted file mode 100644 index f2a4fe12..00000000 --- a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/Persistence.java +++ /dev/null @@ -1,87 +0,0 @@ -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 deleted file mode 100644 index fc462051..00000000 --- a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/PlayerStatistics.java +++ /dev/null @@ -1,85 +0,0 @@ -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 deleted file mode 100644 index 4a696230..00000000 --- a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Classes/RuntimeInfo.java +++ /dev/null @@ -1,92 +0,0 @@ -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 new file mode 100644 index 00000000..e766e182 --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/DataBase.java @@ -0,0 +1,10 @@ +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 new file mode 100644 index 00000000..17187e8f --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Persistance/IDataBase.java @@ -0,0 +1,4 @@ +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 deleted file mode 100644 index e3160edb..00000000 --- a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Scripts/DDL_Script_AzureDB.sql +++ /dev/null @@ -1,33 +0,0 @@ ---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 deleted file mode 100644 index aab3ddae..00000000 --- a/src/main/java/de/hdm_stuttgart/battlearena/Persistance/Scripts/DDL_Script_Oracle.sql +++ /dev/null @@ -1,48 +0,0 @@ ---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 e006608a..c37776ee 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -3,13 +3,8 @@ 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 dbd084ce..e69de29b 100644 --- a/src/main/resources/de/hdm_stuttgart/battlearena/config.properties +++ b/src/main/resources/de/hdm_stuttgart/battlearena/config.properties @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index e69de29b..00000000 diff --git a/src/main/resources/maps/coreMaps.json b/src/main/resources/maps/coreMaps.json deleted file mode 100644 index 84828ae2..00000000 --- a/src/main/resources/maps/coreMaps.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "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 deleted file mode 100644 index e69de29b..00000000 diff --git a/src/main/resources/player/playerStats.json b/src/main/resources/player/playerStats.json deleted file mode 100644 index e69de29b..00000000 -- GitLab