Properly rewrite all plugins to use SaneLib

This commit is contained in:
AppleDash 2017-07-03 12:48:05 -04:00
parent 5574fcbac3
commit 4e4eb709fe
9 changed files with 60 additions and 7 deletions

View File

@ -81,6 +81,9 @@ public class SaneEconomy extends SanePlugin implements ISaneEconomy {
economyManager.getBackend().waitUntilFlushed();
if (economyManager.getBackend() instanceof EconomyStorageBackendMySQL) {
((EconomyStorageBackendMySQL) economyManager.getBackend()).closeConnections();
if (((EconomyStorageBackendMySQL) economyManager.getBackend()).getConnection().getConnection().isFinished()) {
this.getLogger().warning("SaneDatabase didn't terminate all threads, something weird is going on?");
}
}
}
}

View File

@ -75,7 +75,7 @@ public class EconomyStorageBackendMySQL extends EconomyStorageBackendCaching {
@Override
public synchronized void reloadDatabase() {
// waitUntilFlushed();
waitUntilFlushed();
createTables();
try (Connection conn = dbConn.openConnection()) {
PreparedStatement ps = dbConn.prepareStatement(conn, String.format("SELECT * FROM `%s`", dbConn.getTable("saneeconomy_balances")));

View File

@ -78,7 +78,7 @@ public class MySQLConnection {
public void waitUntilFlushed() {
long startTime = System.currentTimeMillis();
while (!this.saneDatabase.isFinished()) {
while (!this.saneDatabase.areAllTransactionsDone()) {
if ((System.currentTimeMillis() - startTime) > 5000) {
LOGGER.warning("Took too long to flush all transactions - something has probably hung :(");
break;

View File

@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>SaneEconomyMobKills</artifactId>
<version>0.1.0-SNAPSHOT</version>
<version>0.1.1-SNAPSHOT</version>
<dependencies>
<dependency>
@ -37,6 +37,32 @@
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>org.appledash:sanelib</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>org.appledash.sanelib</pattern>
<shadedPattern>org.appledash.saneeconomymobkills.shaded.sanelib</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>

View File

@ -43,7 +43,6 @@ public class SaneEconomyMobKills extends SanePlugin {
}
getServer().getPluginManager().registerEvents(new EntityDamageListener(this), this);
this.getI18n().loadTranslations();
}
public SaneEconomy getSaneEconomy() {

View File

@ -1,6 +1,6 @@
name: SaneEconomyMobKills
description: A plugin to give players experience when they kill mobs.
version: 0.1.0
version: 0.1.1
author: AppleDash
main: org.appledash.saneeconomymobkills.SaneEconomyMobKills
depend: [SaneEconomy]

View File

@ -37,6 +37,32 @@
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>org.appledash:sanelib</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>org.appledash.sanelib</pattern>
<shadedPattern>org.appledash.saneeconomysignshop.shaded.sanelib</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>

View File

@ -51,7 +51,6 @@ public class SaneEconomySignShop extends SanePlugin {
getServer().getPluginManager().registerEvents(new SignChangeListener(this), this);
getServer().getPluginManager().registerEvents(new InteractListener(this), this);
getServer().getPluginManager().registerEvents(new BreakListener(this), this);
this.getI18n().loadTranslations();
}
public SignShopManager getSignShopManager() {

View File

@ -46,7 +46,7 @@
<dependency>
<groupId>org.appledash</groupId>
<artifactId>sanelib</artifactId>
<version>0.2.0-SNAPSHOT</version>
<version>0.2.6-SNAPSHOT</version>
</dependency>
</dependencies>
</project>