mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-30 09:50:51 +01:00
Revert "add flyway migrations - older flyway as new one is being a dick"
This reverts commit efc2707a
This commit is contained in:
parent
11fd7d8c26
commit
ca5970b2b7
12
pom.xml
12
pom.xml
@ -175,12 +175,6 @@
|
|||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.flywaydb</groupId>
|
|
||||||
<artifactId>flyway-core</artifactId>
|
|
||||||
<version>7.7.3</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter</artifactId>
|
<artifactId>junit-jupiter</artifactId>
|
||||||
@ -223,11 +217,5 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.flywaydb</groupId>-->
|
|
||||||
<!-- <artifactId>flyway-mysql</artifactId>-->
|
|
||||||
<!-- <version>9.11.0</version>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
@ -3,8 +3,6 @@ package com.eu.habbo;
|
|||||||
import ch.qos.logback.classic.Level;
|
import ch.qos.logback.classic.Level;
|
||||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||||
import ch.qos.logback.core.ConsoleAppender;
|
import ch.qos.logback.core.ConsoleAppender;
|
||||||
import ch.qos.logback.core.filter.Filter;
|
|
||||||
import ch.qos.logback.core.spi.FilterReply;
|
|
||||||
import com.eu.habbo.core.*;
|
import com.eu.habbo.core.*;
|
||||||
import com.eu.habbo.core.consolecommands.ConsoleCommand;
|
import com.eu.habbo.core.consolecommands.ConsoleCommand;
|
||||||
import com.eu.habbo.database.Database;
|
import com.eu.habbo.database.Database;
|
||||||
@ -19,8 +17,6 @@ import com.eu.habbo.plugin.events.emulator.EmulatorStartShutdownEvent;
|
|||||||
import com.eu.habbo.plugin.events.emulator.EmulatorStoppedEvent;
|
import com.eu.habbo.plugin.events.emulator.EmulatorStoppedEvent;
|
||||||
import com.eu.habbo.threading.ThreadPooling;
|
import com.eu.habbo.threading.ThreadPooling;
|
||||||
import com.eu.habbo.util.imager.badges.BadgeImager;
|
import com.eu.habbo.util.imager.badges.BadgeImager;
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -62,43 +58,33 @@ public final class Emulator {
|
|||||||
""";
|
""";
|
||||||
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private static int timeStarted = 0;
|
private static int timeStarted = 0;
|
||||||
@Getter
|
|
||||||
private static Runtime runtime;
|
private static Runtime runtime;
|
||||||
@Getter
|
|
||||||
private static ConfigurationManager config;
|
private static ConfigurationManager config;
|
||||||
@Getter
|
|
||||||
private static CryptoConfig crypto;
|
private static CryptoConfig crypto;
|
||||||
@Getter
|
|
||||||
private static TextsManager texts;
|
private static TextsManager texts;
|
||||||
@Getter
|
|
||||||
private static GameServer gameServer;
|
private static GameServer gameServer;
|
||||||
@Getter
|
|
||||||
private static RCONServer rconServer;
|
private static RCONServer rconServer;
|
||||||
@Setter
|
|
||||||
@Getter
|
|
||||||
private static CameraClient cameraClient;
|
private static CameraClient cameraClient;
|
||||||
@Getter
|
|
||||||
private static Database database;
|
private static Database database;
|
||||||
@Getter
|
|
||||||
private static DatabaseLogger databaseLogger;
|
private static DatabaseLogger databaseLogger;
|
||||||
@Getter
|
|
||||||
private static ThreadPooling threading;
|
private static ThreadPooling threading;
|
||||||
@Getter
|
|
||||||
private static GameEnvironment gameEnvironment;
|
private static GameEnvironment gameEnvironment;
|
||||||
@Getter
|
|
||||||
private static PluginManager pluginManager;
|
private static PluginManager pluginManager;
|
||||||
@Getter
|
|
||||||
private static BadgeImager badgeImager;
|
private static BadgeImager badgeImager;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Thread hook = new Thread(Emulator::dispose);
|
Thread hook = new Thread(new Runnable() {
|
||||||
|
public synchronized void run() {
|
||||||
|
Emulator.dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
hook.setPriority(10);
|
hook.setPriority(10);
|
||||||
Runtime.getRuntime().addShutdownHook(hook);
|
Runtime.getRuntime().addShutdownHook(hook);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void promptEnterKey() {
|
public static void promptEnterKey(){
|
||||||
log.info("\n");
|
log.info("\n");
|
||||||
log.info("This is a developer preview build. Your plugins for Arcturus Morningstar 3.x will NOT work on this build.");
|
log.info("This is a developer preview build. Your plugins for Arcturus Morningstar 3.x will NOT work on this build.");
|
||||||
log.info("Press \"ENTER\" if you agree to the terms stated above...");
|
log.info("Press \"ENTER\" if you agree to the terms stated above...");
|
||||||
@ -119,7 +105,7 @@ public final class Emulator {
|
|||||||
appender.start();
|
appender.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
Locale.setDefault( Locale.ENGLISH);
|
Locale.setDefault(new Locale("en"));
|
||||||
setBuild();
|
setBuild();
|
||||||
Emulator.stopped = false;
|
Emulator.stopped = false;
|
||||||
ConsoleCommand.load();
|
ConsoleCommand.load();
|
||||||
@ -127,7 +113,7 @@ public final class Emulator {
|
|||||||
System.out.println(logo);
|
System.out.println(logo);
|
||||||
|
|
||||||
// Checks if this is a BETA build before allowing them to continue.
|
// Checks if this is a BETA build before allowing them to continue.
|
||||||
if (PREVIEW.toLowerCase().contains("preview")) {
|
if (PREVIEW.toLowerCase().contains("preview") ) {
|
||||||
System.out.println();
|
System.out.println();
|
||||||
promptEnterKey();
|
promptEnterKey();
|
||||||
}
|
}
|
||||||
@ -229,7 +215,7 @@ public final class Emulator {
|
|||||||
try {
|
try {
|
||||||
String filepath = new File(Emulator.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getAbsolutePath();
|
String filepath = new File(Emulator.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getAbsolutePath();
|
||||||
MessageDigest md = MessageDigest.getInstance("MD5");// MD5
|
MessageDigest md = MessageDigest.getInstance("MD5");// MD5
|
||||||
try (FileInputStream fis = new FileInputStream(filepath)) {
|
try(FileInputStream fis = new FileInputStream(filepath)) {
|
||||||
byte[] dataBytes = new byte[1024];
|
byte[] dataBytes = new byte[1024];
|
||||||
int nread;
|
int nread;
|
||||||
while ((nread = fis.read(dataBytes)) != -1)
|
while ((nread = fis.read(dataBytes)) != -1)
|
||||||
@ -316,11 +302,71 @@ public final class Emulator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ConfigurationManager getConfig() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CryptoConfig getCrypto() {
|
||||||
|
return crypto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TextsManager getTexts() {
|
||||||
|
return texts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Database getDatabase() {
|
||||||
|
return database;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DatabaseLogger getDatabaseLogger() {
|
||||||
|
return databaseLogger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Runtime getRuntime() {
|
||||||
|
return runtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GameServer getGameServer() {
|
||||||
|
return gameServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RCONServer getRconServer() {
|
||||||
|
return rconServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static ThreadPooling getThreading() {
|
||||||
|
return threading;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GameEnvironment getGameEnvironment() {
|
||||||
|
return gameEnvironment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PluginManager getPluginManager() {
|
||||||
|
return pluginManager;
|
||||||
|
}
|
||||||
|
|
||||||
public static Random getRandom() {
|
public static Random getRandom() {
|
||||||
return ThreadLocalRandom.current();
|
return ThreadLocalRandom.current();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static BadgeImager getBadgeImager() {
|
||||||
|
return badgeImager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static synchronized CameraClient getCameraClient() {
|
||||||
|
return cameraClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static synchronized void setCameraClient(CameraClient client) {
|
||||||
|
cameraClient = client;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getTimeStarted() {
|
||||||
|
return timeStarted;
|
||||||
|
}
|
||||||
|
|
||||||
public static int getOnlineTime() {
|
public static int getOnlineTime() {
|
||||||
return getIntUnixTimestamp() - timeStarted;
|
return getIntUnixTimestamp() - timeStarted;
|
||||||
}
|
}
|
||||||
@ -333,7 +379,7 @@ public final class Emulator {
|
|||||||
int totalSeconds = 0;
|
int totalSeconds = 0;
|
||||||
|
|
||||||
Matcher m = Pattern.compile("(([0-9]*) (second|minute|hour|day|week|month|year))").matcher(timeString);
|
Matcher m = Pattern.compile("(([0-9]*) (second|minute|hour|day|week|month|year))").matcher(timeString);
|
||||||
Map<String, Integer> map = new HashMap<>();
|
Map<String,Integer> map = new HashMap<>();
|
||||||
map.put("second", 1);
|
map.put("second", 1);
|
||||||
map.put("minute", 60);
|
map.put("minute", 60);
|
||||||
map.put("hour", 3600);
|
map.put("hour", 3600);
|
||||||
@ -347,8 +393,8 @@ public final class Emulator {
|
|||||||
int amount = Integer.parseInt(m.group(2));
|
int amount = Integer.parseInt(m.group(2));
|
||||||
String what = m.group(3);
|
String what = m.group(3);
|
||||||
totalSeconds += amount * map.get(what);
|
totalSeconds += amount * map.get(what);
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
}
|
||||||
|
catch (Exception ignored) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
return totalSeconds;
|
return totalSeconds;
|
||||||
@ -374,8 +420,8 @@ public final class Emulator {
|
|||||||
int amount = Integer.parseInt(m.group(2));
|
int amount = Integer.parseInt(m.group(2));
|
||||||
String what = m.group(3);
|
String what = m.group(3);
|
||||||
c.add(map.get(what), amount);
|
c.add(map.get(what), amount);
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
}
|
||||||
|
catch (Exception ignored) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.getTime();
|
return c.getTime();
|
||||||
@ -384,7 +430,7 @@ public final class Emulator {
|
|||||||
private static String dateToUnixTimestamp(Date date) {
|
private static String dateToUnixTimestamp(Date date) {
|
||||||
String res = "";
|
String res = "";
|
||||||
Date aux = stringToDate("1970-01-01 00:00:00");
|
Date aux = stringToDate("1970-01-01 00:00:00");
|
||||||
if (aux == null) return null;
|
if(aux == null) return null;
|
||||||
|
|
||||||
Timestamp aux1 = dateToTimeStamp(aux);
|
Timestamp aux1 = dateToTimeStamp(aux);
|
||||||
Timestamp aux2 = dateToTimeStamp(date);
|
Timestamp aux2 = dateToTimeStamp(date);
|
||||||
|
@ -6,8 +6,6 @@ import com.zaxxer.hikari.HikariDataSource;
|
|||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
import gnu.trove.set.hash.THashSet;
|
import gnu.trove.set.hash.THashSet;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.flywaydb.core.Flyway;
|
|
||||||
import org.flywaydb.core.api.output.MigrateResult;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@ -44,20 +42,6 @@ public class Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.info("Database -> Connected! ({} MS)", System.currentTimeMillis() - millis);
|
log.info("Database -> Connected! ({} MS)", System.currentTimeMillis() - millis);
|
||||||
|
|
||||||
Flyway flyway = Flyway.configure().placeholderReplacement(false).dataSource(dataSource).load();
|
|
||||||
MigrateResult migrateResult = flyway.migrate();
|
|
||||||
|
|
||||||
if (migrateResult.migrationsExecuted > 0) {
|
|
||||||
if (migrateResult.initialSchemaVersion != null)
|
|
||||||
log.info("Database -> {} Original Schema Version", migrateResult.initialSchemaVersion);
|
|
||||||
else
|
|
||||||
log.info("Database -> Initial migration completed");
|
|
||||||
|
|
||||||
log.info("Database -> Successfully migrated! ({} migrations executed)", migrateResult.migrationsExecuted);
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info("Database -> Ready!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
File diff suppressed because one or more lines are too long
@ -62,10 +62,6 @@
|
|||||||
<level value="error"/>
|
<level value="error"/>
|
||||||
</logger>
|
</logger>
|
||||||
|
|
||||||
<logger name="org.flywaydb.core.internal.sqlscript">
|
|
||||||
<level value="warn"/>
|
|
||||||
</logger>
|
|
||||||
|
|
||||||
<root level="info">
|
<root level="info">
|
||||||
<appender-ref ref="Console" />
|
<appender-ref ref="Console" />
|
||||||
<appender-ref ref="FileDebug" />
|
<appender-ref ref="FileDebug" />
|
||||||
|
Loading…
Reference in New Issue
Block a user