mirror of
https://github.com/AppleDash/SaneEconomy.git
synced 2025-02-16 19:51:23 +01:00
Properly rewrite all plugins to use SaneLib
This commit is contained in:
parent
5574fcbac3
commit
4e4eb709fe
@ -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?");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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")));
|
||||
|
@ -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;
|
||||
|
@ -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>
|
||||
|
@ -43,7 +43,6 @@ public class SaneEconomyMobKills extends SanePlugin {
|
||||
}
|
||||
|
||||
getServer().getPluginManager().registerEvents(new EntityDamageListener(this), this);
|
||||
this.getI18n().loadTranslations();
|
||||
}
|
||||
|
||||
public SaneEconomy getSaneEconomy() {
|
||||
|
@ -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]
|
||||
|
@ -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>
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user