Merge branch 'development'

This commit is contained in:
Brianna 2020-08-13 13:19:29 -05:00
commit c192449f55
3 changed files with 38 additions and 11 deletions

25
pom.xml
View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId>
<artifactId>UltimateModeration</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>2</version>
<version>2.0.1</version>
<build>
<defaultGoal>clean install</defaultGoal>
<finalName>UltimateModeration-${project.version}</finalName>
@ -55,6 +55,9 @@
<artifactSet>
<includes>
<include>com.songoda:SongodaCore</include>
<include>com.zaxxer:HikariCP</include>
<include>org.slf4j:slf4j-api</include>
<include>org.slf4j:slf4j-nop</include>
</includes>
</artifactSet>
<filters>
@ -117,5 +120,25 @@
<version>LATEST</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.23.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.25</version>
</dependency>
</dependencies>
</project>

View File

@ -55,6 +55,7 @@ public class UltimateModeration extends SongodaPlugin {
private ModerationManager moderationManager;
private DatabaseConnector databaseConnector;
private DataMigrationManager dataMigrationManager;
private DataManager dataManager;
public static UltimateModeration getInstance() {
@ -109,7 +110,7 @@ public class UltimateModeration extends SongodaPlugin {
this.staffChatManager = new StaffChatManager();
this.moderationManager = new ModerationManager(this);
// Database stuff, go!
try {
if (Settings.MYSQL_ENABLED.getBoolean()) {
String hostname = Settings.MYSQL_HOSTNAME.getString();
@ -125,15 +126,18 @@ public class UltimateModeration extends SongodaPlugin {
this.databaseConnector = new SQLiteConnector(this);
this.getLogger().info("Data handler connected using SQLite.");
}
} catch (Exception ex) {
this.getLogger().severe("Fatal error trying to connect to database. Please make sure all your connection settings are correct and try again. Plugin has been disabled.");
this.emergencyStop();
}
this.dataManager = new DataManager(this.databaseConnector, this);
DataMigrationManager dataMigrationManager = new DataMigrationManager(this.databaseConnector, this.dataManager,
new _1_InitialMigration());
dataMigrationManager.runMigrations();
this.dataManager = new DataManager(this.databaseConnector, this);
this.dataMigrationManager = new DataMigrationManager(this.databaseConnector, this.dataManager,
new _1_InitialMigration());
this.dataMigrationManager.runMigrations();
} catch (Exception ex) {
this.getLogger().severe("Fatal error trying to connect to database. " +
"Please make sure all your connection settings are correct and try again. Plugin has been disabled.");
emergencyStop();
return;
}
Bukkit.getScheduler().runTaskLaterAsynchronously(this, () -> {
// Legacy Data

View File

@ -284,7 +284,7 @@ public class PunishGui extends Gui {
});
ItemStack item = GuiUtils.createButtonItem(CompatibleMaterial.PAPER,
template.getName() == null ? plugin.getLocale().getMessage("gui.general.templatename").getMessage() : template.getName());
template == null ? plugin.getLocale().getMessage("gui.general.templatename").getMessage() : template.getName());
gui.setInput(item);
guiManager.showGUI(player, gui);