diff --git a/pom.xml b/pom.xml
index 74543bbf..51d02e18 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.eu.habbo
Habbo
- 2.0.0
+ 2.1.0
UTF-8
@@ -88,27 +88,27 @@
io.netty
netty-all
- 4.1.24.Final
+ 4.1.36.Final
io.netty
netty-codec-http
- 4.1.24.Final
+ 4.1.36.Final
compile
io.netty
netty-codec-http2
- 4.1.24.Final
+ 4.1.36.Final
compile
io.netty
netty-handler
- 4.1.24.Final
+ 4.1.36.Final
compile
diff --git a/sqlupdates/2_0_0_TO_2_1_0-RC-1.sql b/sqlupdates/2_0_0_TO_2_1_0-RC-1.sql
new file mode 100644
index 00000000..2b1215f1
--- /dev/null
+++ b/sqlupdates/2_0_0_TO_2_1_0-RC-1.sql
@@ -0,0 +1,126 @@
+CREATE TABLE `users_saved_searches` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `search_code` varchar(255) NOT NULL,
+ `filter` varchar(255) NULL,
+ `user_id` int(11) NOT NULL,
+ PRIMARY KEY (`id`)
+);
+
+ALTER TABLE `users_settings`
+ADD COLUMN `ui_flags` int(11) NOT NULL DEFAULT 1 AFTER `forums_post_count`;
+
+ALTER TABLE `users_settings`
+ADD COLUMN `has_gotten_default_saved_searches` tinyint(1) NOT NULL DEFAULT 0 AFTER `ui_flags`;
+
+ALTER TABLE `support_tickets`
+ADD COLUMN `group_id` int(11) NOT NULL AFTER `category`,
+ADD COLUMN `thread_id` int(11) NOT NULL AFTER `group_id`,
+ADD COLUMN `comment_id` int(11) NOT NULL AFTER `thread_id`;
+
+ALTER TABLE `pet_actions`
+ADD COLUMN `can_swim` enum('1','0') NULL DEFAULT '0' AFTER `random_actions`;
+
+UPDATE `pet_actions` SET `can_swim` = '1' WHERE `pet_type` = 9 OR `pet_type` = 14 OR `pet_type` = 23 OR `pet_type` = 24 OR `pet_type` = 25 OR `pet_type` = 28 OR `pet_type` = 29 OR `pet_type` = 30 OR `pet_type` = 32;
+
+UPDATE `items_base` SET `customparams` = '30,60,120,180,300,600', `interaction_type` = 'game_timer', `interaction_modes_count` = 1 WHERE `item_name` IN ('fball_counter','bb_counter','es_counter');
+
+ALTER TABLE `youtube_playlists`
+CHANGE COLUMN `video_id` `playlist_id` varchar(255) NOT NULL COMMENT 'YouTube playlist ID' AFTER `item_id`;
+
+DROP TABLE `youtube_items`;
+
+TRUNCATE TABLE `youtube_playlists`;
+
+DROP PROCEDURE IF EXISTS DEFAULT_YTTV_PLAYLISTS;
+DELIMITER ;;
+
+CREATE PROCEDURE DEFAULT_YTTV_PLAYLISTS()
+BEGIN
+ DECLARE n INT DEFAULT 0;
+ DECLARE i INT DEFAULT 0;
+ DECLARE a INT DEFAULT 0;
+ DECLARE itemId INT default 0;
+ SELECT COUNT(*) FROM `items_base` WHERE `interaction_type` = 'youtube' INTO n;
+ SET i=0;
+
+ SET @defaultPlaylistIds = '["PL4YfV2mXS8WXOkxFly7YsGL8cKtqp873p","PL4F5KzcUTpEdux38c8CYunT9uNh_k2NPt","PL4F5KzcUTpEcO-1iw3P6gavJ_ALTxqNHn","PL4F5KzcUTpEfpHad_B7j_MulB3-cwtLFh","PL4F5KzcUTpEekJPbcVOaNYVV6VLSo9zRB","PL80F08DAE1B614BA9","PL4F5KzcUTpEfeS5t7EiEIYbpplZivDZTL","PL4ACB18CA629E650A","PL4F5KzcUTpEfyRBCOVKQ4qxlSoHsGDZ82","PL4F5KzcUTpEet7EMwhw0ge5n2oNMr7JY8","PL4F5KzcUTpEfTW4fkX9vrt497MEvWorwK","PL4F5KzcUTpEcit3i1q55-IFFndmo_dsR8","PL4F5KzcUTpEeJleVUhO1MWRJyYDWWp9Do","PL4F5KzcUTpEcFzCpH2_EXtwzKQH8mJGd9","PL4F5KzcUTpEcIiSOH2x3sg2jwACNbSIm9","PL4F5KzcUTpEfRxBiXwTBA7oiybPqoZD_j","PL4YfV2mXS8WUo09aevZX-b47k4PD08-i8","PL4F5KzcUTpEcFzCpH2_EXtwzKQH8mJGd9"]';
+
+ WHILE i < n DO
+ SET itemId = (SELECT id FROM `items_base` WHERE `interaction_type` = 'youtube' LIMIT i, 1);
+
+ WHILE abadge: BADGE CODE
Credits: credits#amount
Pixels: pixels#amount
Points: points#amount
Respect: respect#amount
Furniture: furni#FurnitureID
Catalog Item: cata#CatalogItemID' WHERE `key` = 'hotel.wired.superwired.info';
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/Emulator.java b/src/main/java/com/eu/habbo/Emulator.java
index 04cafd27..48a63e9f 100644
--- a/src/main/java/com/eu/habbo/Emulator.java
+++ b/src/main/java/com/eu/habbo/Emulator.java
@@ -7,7 +7,6 @@ import com.eu.habbo.core.TextsManager;
import com.eu.habbo.core.consolecommands.ConsoleCommand;
import com.eu.habbo.database.Database;
import com.eu.habbo.habbohotel.GameEnvironment;
-import com.eu.habbo.habbohotel.messenger.MessengerBuddy;
import com.eu.habbo.networking.camera.CameraClient;
import com.eu.habbo.networking.gameserver.GameServer;
import com.eu.habbo.networking.rconserver.RCONServer;
@@ -17,7 +16,6 @@ import com.eu.habbo.plugin.events.emulator.EmulatorLoadedEvent;
import com.eu.habbo.plugin.events.emulator.EmulatorStartShutdownEvent;
import com.eu.habbo.plugin.events.emulator.EmulatorStoppedEvent;
import com.eu.habbo.threading.ThreadPooling;
-import com.eu.habbo.threading.runnables.CameraClientAutoReconnect;
import com.eu.habbo.util.imager.badges.BadgeImager;
import java.io.BufferedReader;
@@ -30,55 +28,53 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Random;
-import java.util.zip.Checksum;
-public final class Emulator
-{
+public final class Emulator {
public final static int MAJOR = 2;
- public final static int MINOR = 0;
+ public final static int MINOR = 1;
public final static int BUILD = 0;
- public final static String PREVIEW = "";
+ public final static String PREVIEW = "Stable";
- public static final String version = "Arcturus Morningstar"+ " " + MAJOR + "." + MINOR + "." + BUILD;
+ public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD + " " + PREVIEW;
+ private static final String logo =
+ " \n" +
+ " __ ___ _ A R C T U R U S __ \n" +
+ " / |/ /___ _________ (_)___ ____ ______/ /_____ ______ \n" +
+ " / /|_/ / __ \\/ ___/ __ \\/ / __ \\/ __ `/ ___/ __/ __ `/ ___/ \n" +
+ " / / / / /_/ / / / / / / / / / / /_/ (__ ) /_/ /_/ / / \n" +
+ "/_/ /_/\\____/_/ /_/ /_/_/_/ /_/\\__, /____/\\__/\\__,_/_/ \n" +
+ " /____/ \n";
public static String build = "";
-
public static boolean isReady = false;
-
public static boolean isShuttingDown = false;
-
public static boolean stopped = false;
-
public static boolean debugging = false;
+ private static int timeStarted = 0;
+ private static Runtime runtime;
+ private static ConfigurationManager config;
+ private static TextsManager texts;
+ private static GameServer gameServer;
+ private static RCONServer rconServer;
+ private static CameraClient cameraClient;
+ private static Database database;
+ private static Logging logging;
+ private static ThreadPooling threading;
+ private static GameEnvironment gameEnvironment;
+ private static PluginManager pluginManager;
+ private static Random random;
+ private static BadgeImager badgeImager;
- private static int timeStarted = 0;
- private static Runtime runtime;
- private static ConfigurationManager config;
- private static TextsManager texts;
- private static GameServer gameServer;
- private static RCONServer rconServer;
- private static CameraClient cameraClient;
- private static Database database;
- private static Logging logging;
- private static ThreadPooling threading;
- private static GameEnvironment gameEnvironment;
- private static PluginManager pluginManager;
- private static Random random;
- private static BadgeImager badgeImager;
-
- static
- {
- Thread hook = new Thread(new Runnable()
- {
- public synchronized void run()
- {
+ static {
+ Thread hook = new Thread(new Runnable() {
+ public synchronized void run() {
Emulator.dispose();
}
});
@@ -86,11 +82,8 @@ public final class Emulator
Runtime.getRuntime().addShutdownHook(hook);
}
-
- public static void main(String[] args) throws Exception
- {
- try
- {
+ public static void main(String[] args) throws Exception {
+ try {
Locale.setDefault(new Locale("en"));
setBuild();
@@ -98,19 +91,12 @@ public final class Emulator
ConsoleCommand.load();
Emulator.logging = new Logging();
Emulator.getLogging().logStart("\r" + Emulator.logo +
- " Build: " + build + "\n");
+ " Build: " + build + "\n");
random = new Random();
long startTime = System.nanoTime();
Emulator.runtime = Runtime.getRuntime();
Emulator.config = new ConfigurationManager("config.ini");
-
- if (Emulator.getConfig().getValue("username").isEmpty())
- {
- Emulator.getLogging().logErrorLine("Please make sure you enter your forum login details!");
- Thread.sleep(2000);
- }
-
Emulator.database = new Database(Emulator.getConfig());
Emulator.config.loaded = true;
Emulator.config.loadFromDatabase();
@@ -131,12 +117,6 @@ public final class Emulator
Emulator.rconServer.initializePipeline();
Emulator.rconServer.connect();
Emulator.badgeImager = new BadgeImager();
- // Removed Wesleys Camera Server lol.
- /* if (Emulator.getConfig().getBoolean("camera.enabled"))
- {
- Emulator.getThreading().run(new CameraClientAutoReconnect());
- }
- */
Emulator.getLogging().logStart("Habbo Hotel Emulator has succesfully loaded.");
Emulator.getLogging().logStart("You're running: " + Emulator.version);
Emulator.getLogging().logStart("System launched in: " + (System.nanoTime() - startTime) / 1e6 + "ms. Using: " + (Runtime.getRuntime().availableProcessors() * 2) + " threads!");
@@ -144,8 +124,7 @@ public final class Emulator
Emulator.debugging = Emulator.getConfig().getBoolean("debug.mode");
- if (debugging)
- {
+ if (debugging) {
Emulator.getLogging().logDebugLine("Debugging Enabled!");
}
@@ -153,18 +132,15 @@ public final class Emulator
Emulator.isReady = true;
Emulator.timeStarted = getIntUnixTimestamp();
- if (Emulator.getConfig().getInt("runtime.threads") < (Runtime.getRuntime().availableProcessors() * 2))
- {
+ if (Emulator.getConfig().getInt("runtime.threads") < (Runtime.getRuntime().availableProcessors() * 2)) {
Emulator.getLogging().logStart("Emulator settings runtime.threads (" + Emulator.getConfig().getInt("runtime.threads") + ") can be increased to " + (Runtime.getRuntime().availableProcessors() * 2) + " to possibly increase performance.");
}
- Emulator.getThreading().run(new Runnable()
- {
+ Emulator.getThreading().run(new Runnable() {
@Override
- public void run()
- {
- Emulator.getLogging().logStart("Thankyou for downloading Arcturus Morningstar! This is a Release Candidate for 2.0.0, if you find any bugs please place them on our git repository.");
+ public void run() {
+ Emulator.getLogging().logStart("Thankyou for downloading Arcturus Morningstar! This is a stable 2.1.0 build, it should be more than stable for daily use on hotels, if you find any bugs please place them on our git repository.");
Emulator.getLogging().logStart("Please note, Arcturus Emulator is a project by TheGeneral, we take no credit for the original work, and only the work we have continued. If you'd like to support the project, join our discord at: ");
Emulator.getLogging().logStart("https://discord.gg/syuqgN");
System.out.println("Waiting for commands: ");
@@ -173,56 +149,46 @@ public final class Emulator
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- while (!isShuttingDown && isReady)
- {
- try
- {
+ while (!isShuttingDown && isReady && reader.ready()) {
+ try {
String line = reader.readLine();
- if (line != null)
- {
+ if (line != null) {
ConsoleCommand.handle(line);
}
System.out.println("Waiting for command: ");
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
}
}
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
e.printStackTrace();
}
}
private static void setBuild() {
- if(Emulator.class.getProtectionDomain().getCodeSource() == null) {
+ if (Emulator.class.getProtectionDomain().getCodeSource() == null) {
build = "UNKNOWN";
return;
}
StringBuilder sb = new StringBuilder();
- try
- {
+ try {
String filepath = new File(Emulator.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getAbsolutePath();
MessageDigest md = MessageDigest.getInstance("MD5");// MD5
FileInputStream fis = new FileInputStream(filepath);
byte[] dataBytes = new byte[1024];
int nread = 0;
- while((nread = fis.read(dataBytes)) != -1)
+ while ((nread = fis.read(dataBytes)) != -1)
md.update(dataBytes, 0, nread);
byte[] mdbytes = md.digest();
- for(int i=0; i RELOAD_HALL_OF_FAME)
- {
+ if (time - LAST_HOF_RELOAD > RELOAD_HALL_OF_FAME) {
Emulator.getGameEnvironment().getHotelViewManager().getHallOfFame().reload();
LAST_HOF_RELOAD = time;
}
- if (time - LAST_NL_RELOAD > RELOAD_NEWS_LIST)
- {
+ if (time - LAST_NL_RELOAD > RELOAD_NEWS_LIST) {
Emulator.getGameEnvironment().getHotelViewManager().getNewsList().reload();
LAST_NL_RELOAD = time;
}
- if (time - LAST_INACTIVE_ROOMS_CLEARED > REMOVE_INACTIVE_ROOMS)
- {
+ if (time - LAST_INACTIVE_ROOMS_CLEARED > REMOVE_INACTIVE_ROOMS) {
Emulator.getGameEnvironment().getRoomManager().clearInactiveRooms();
LAST_INACTIVE_ROOMS_CLEARED = time;
}
- if (time - LAST_INACTIVE_GUILDS_CLEARED > REMOVE_INACTIVE_GUILDS)
- {
+ if (time - LAST_INACTIVE_GUILDS_CLEARED > REMOVE_INACTIVE_GUILDS) {
Emulator.getGameEnvironment().getGuildManager().clearInactiveGuilds();
ForumThread.clearCache();
LAST_INACTIVE_GUILDS_CLEARED = time;
}
- if (time - LAST_INACTIVE_TOURS_CLEARED > REMOVE_INACTIVE_TOURS)
- {
+ if (time - LAST_INACTIVE_TOURS_CLEARED > REMOVE_INACTIVE_TOURS) {
Emulator.getGameEnvironment().getGuideManager().cleanup();
LAST_INACTIVE_TOURS_CLEARED = time;
}
- if (time - LAST_ERROR_LOGS_SAVED > SAVE_ERROR_LOGS)
- {
+ if (time - LAST_ERROR_LOGS_SAVED > SAVE_ERROR_LOGS) {
Emulator.getLogging().saveLogs();
LAST_ERROR_LOGS_SAVED = time;
}
- if (time - LAST_CALLBACK > CALLBACK_TIME)
- {
- // Emulator.getThreading().run(new HTTPPostStatus());
+ if (time - LAST_CALLBACK > CALLBACK_TIME) {
+ // Emulator.getThreading().run(new HTTPPostStatus());
LAST_CALLBACK = time;
}
- if (time - LAST_DAILY_REFILL > Emulator.getConfig().getInt("hotel.refill.daily"))
- {
+ if (time - LAST_DAILY_REFILL > Emulator.getConfig().getInt("hotel.refill.daily")) {
this.refillDailyRespects();
LAST_DAILY_REFILL = time;
}
- if (time - LAST_HABBO_CACHE_CLEARED > CLEAR_CACHED_VALUES)
- {
+ if (time - LAST_HABBO_CACHE_CLEARED > CLEAR_CACHED_VALUES) {
this.clearCachedValues();
LAST_HABBO_CACHE_CLEARED = time;
}
@@ -147,15 +134,12 @@ public class CleanerThread implements Runnable {
}
- void databaseCleanup()
- {
+ void databaseCleanup() {
this.refillDailyRespects();
int time = Emulator.getIntUnixTimestamp();
- try (Connection connection = Emulator.getDatabase().getDataSource().getConnection())
- {
- try (Statement statement = connection.createStatement())
- {
+ try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) {
+ try (Statement statement = connection.createStatement()) {
statement.execute("UPDATE users SET online = '0' WHERE online = '1'");
statement.execute("UPDATE rooms SET users = '0' WHERE users > 0");
statement.execute("DELETE FROM room_mutes WHERE ends < " + time);
@@ -163,63 +147,47 @@ public class CleanerThread implements Runnable {
statement.execute("DELETE users_favorite_rooms FROM users_favorite_rooms LEFT JOIN rooms ON room_id = rooms.id WHERE rooms.id IS NULL");
}
- try (PreparedStatement statement = connection.prepareStatement("UPDATE users_effects SET total = total - 1 WHERE activation_timestamp < ? AND activation_timestamp != 0"))
- {
+ try (PreparedStatement statement = connection.prepareStatement("UPDATE users_effects SET total = total - 1 WHERE activation_timestamp < ? AND activation_timestamp != 0")) {
statement.setInt(1, Emulator.getIntUnixTimestamp() - 86400);
statement.execute();
}
- try (Statement statement = connection.createStatement())
- {
+ try (Statement statement = connection.createStatement()) {
statement.execute("DELETE FROM users_effects WHERE total <= 0");
}
- }
- catch (SQLException e)
- {
+ } catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
}
Emulator.getLogging().logStart("Database -> Cleaned!");
}
- public void refillDailyRespects()
- {
- try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET daily_respect_points = ?, daily_pet_respect_points = ?"))
- {
+ public void refillDailyRespects() {
+ try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET daily_respect_points = ?, daily_pet_respect_points = ?")) {
statement.setInt(1, Emulator.getConfig().getInt("hotel.daily.respect"));
statement.setInt(2, Emulator.getConfig().getInt("hotel.daily.respect.pets"));
statement.executeUpdate();
- }
- catch (SQLException e)
- {
+ } catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
}
- if (Emulator.isReady)
- {
- for (Habbo habbo : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values())
- {
+ if (Emulator.isReady) {
+ for (Habbo habbo : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values()) {
habbo.getHabboStats().petRespectPointsToGive = Emulator.getConfig().getInt("hotel.daily.respect");
habbo.getHabboStats().respectPointsToGive = Emulator.getConfig().getInt("hotel.daily.respect.pets");
}
}
}
- private void clearCachedValues()
- {
+ private void clearCachedValues() {
Habbo habbo;
- for(Map.Entry map : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet())
- {
+ for (Map.Entry map : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
habbo = map.getValue();
- try
- {
- if (habbo != null)
- {
+ try {
+ if (habbo != null) {
habbo.clearCaches();
}
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
}
}
diff --git a/src/main/java/com/eu/habbo/core/CommandLog.java b/src/main/java/com/eu/habbo/core/CommandLog.java
index d6af2420..1f4cefbc 100644
--- a/src/main/java/com/eu/habbo/core/CommandLog.java
+++ b/src/main/java/com/eu/habbo/core/CommandLog.java
@@ -6,8 +6,7 @@ import com.eu.habbo.habbohotel.commands.Command;
import java.sql.PreparedStatement;
import java.sql.SQLException;
-public class CommandLog implements Loggable
-{
+public class CommandLog implements Loggable {
public static final String insertQuery = "INSERT INTO commandlogs (`user_id`, `timestamp`, `command`, `params`, `succes`) VALUES (?, ?, ?, ?, ?)";
private final int userId;
@@ -17,8 +16,7 @@ public class CommandLog implements Loggable
private final boolean succes;
- public CommandLog(int userId, Command command, String params, boolean succes)
- {
+ public CommandLog(int userId, Command command, String params, boolean succes) {
this.userId = userId;
this.command = command;
this.params = params;
@@ -26,8 +24,7 @@ public class CommandLog implements Loggable
}
@Override
- public void log(PreparedStatement statement) throws SQLException
- {
+ public void log(PreparedStatement statement) throws SQLException {
statement.setInt(1, this.userId);
statement.setInt(2, this.timestamp);
statement.setString(3, this.command.getClass().getSimpleName());
diff --git a/src/main/java/com/eu/habbo/core/ConfigurationManager.java b/src/main/java/com/eu/habbo/core/ConfigurationManager.java
index c6fe2e22..446c028f 100644
--- a/src/main/java/com/eu/habbo/core/ConfigurationManager.java
+++ b/src/main/java/com/eu/habbo/core/ConfigurationManager.java
@@ -11,128 +11,95 @@ import java.sql.*;
import java.util.Map;
import java.util.Properties;
-public class ConfigurationManager
-{
-
- public boolean loaded = false;
-
-
- public boolean isLoading = false;
-
+public class ConfigurationManager {
private final Properties properties;
-
private final String configurationPath;
-
- public ConfigurationManager(String configurationPath) throws Exception
- {
+ public boolean loaded = false;
+ public boolean isLoading = false;
+
+ public ConfigurationManager(String configurationPath) throws Exception {
this.properties = new Properties();
this.configurationPath = configurationPath;
this.reload();
}
- public void reload()
- {
+ public void reload() {
this.isLoading = true;
this.properties.clear();
InputStream input = null;
- try
- {
+ try {
File f = new File(this.configurationPath);
input = new FileInputStream(f);
this.properties.load(input);
- }
- catch (IOException ex)
- {
+ } catch (IOException ex) {
Emulator.getLogging().logErrorLine("[CRITICAL] FAILED TO LOAD CONFIG FILE! (" + this.configurationPath + ")");
ex.printStackTrace();
- }
- finally
- {
- if (input != null)
- {
- try
- {
+ } finally {
+ if (input != null) {
+ try {
input.close();
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
e.printStackTrace();
}
}
}
- if(this.loaded)
- {
+ if (this.loaded) {
this.loadFromDatabase();
}
this.isLoading = false;
Emulator.getLogging().logStart("Configuration Manager -> Loaded!");
- if (Emulator.getPluginManager() != null)
- {
+ if (Emulator.getPluginManager() != null) {
Emulator.getPluginManager().fireEvent(new EmulatorConfigUpdatedEvent());
}
}
- public void loadFromDatabase()
- {
+ public void loadFromDatabase() {
Emulator.getLogging().logStart("Loading configuration from database...");
long millis = System.currentTimeMillis();
- try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement())
- {
- if (statement.execute("SELECT * FROM emulator_settings"))
- {
- try (ResultSet set = statement.getResultSet())
- {
- while (set.next())
- {
+ try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement()) {
+ if (statement.execute("SELECT * FROM emulator_settings")) {
+ try (ResultSet set = statement.getResultSet()) {
+ while (set.next()) {
this.properties.put(set.getString("key"), set.getString("value"));
}
}
}
- }
- catch (SQLException e)
- {
+ } catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
}
Emulator.getLogging().logStart("Configuration -> loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
- public void saveToDatabase()
- {
- try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE emulator_settings SET `value` = ? WHERE `key` = ? LIMIT 1"))
- {
- for (Map.Entry