mirror of
https://github.com/AppleDash/SaneEconomy.git
synced 2024-09-29 06:57:31 +02: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();
|
economyManager.getBackend().waitUntilFlushed();
|
||||||
if (economyManager.getBackend() instanceof EconomyStorageBackendMySQL) {
|
if (economyManager.getBackend() instanceof EconomyStorageBackendMySQL) {
|
||||||
((EconomyStorageBackendMySQL) economyManager.getBackend()).closeConnections();
|
((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
|
@Override
|
||||||
public synchronized void reloadDatabase() {
|
public synchronized void reloadDatabase() {
|
||||||
// waitUntilFlushed();
|
waitUntilFlushed();
|
||||||
createTables();
|
createTables();
|
||||||
try (Connection conn = dbConn.openConnection()) {
|
try (Connection conn = dbConn.openConnection()) {
|
||||||
PreparedStatement ps = dbConn.prepareStatement(conn, String.format("SELECT * FROM `%s`", dbConn.getTable("saneeconomy_balances")));
|
PreparedStatement ps = dbConn.prepareStatement(conn, String.format("SELECT * FROM `%s`", dbConn.getTable("saneeconomy_balances")));
|
||||||
|
@ -78,7 +78,7 @@ public class MySQLConnection {
|
|||||||
|
|
||||||
public void waitUntilFlushed() {
|
public void waitUntilFlushed() {
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
while (!this.saneDatabase.isFinished()) {
|
while (!this.saneDatabase.areAllTransactionsDone()) {
|
||||||
if ((System.currentTimeMillis() - startTime) > 5000) {
|
if ((System.currentTimeMillis() - startTime) > 5000) {
|
||||||
LOGGER.warning("Took too long to flush all transactions - something has probably hung :(");
|
LOGGER.warning("Took too long to flush all transactions - something has probably hung :(");
|
||||||
break;
|
break;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>SaneEconomyMobKills</artifactId>
|
<artifactId>SaneEconomyMobKills</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.1-SNAPSHOT</version>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -37,6 +37,32 @@
|
|||||||
<target>1.8</target>
|
<target>1.8</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</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>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
@ -43,7 +43,6 @@ public class SaneEconomyMobKills extends SanePlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getServer().getPluginManager().registerEvents(new EntityDamageListener(this), this);
|
getServer().getPluginManager().registerEvents(new EntityDamageListener(this), this);
|
||||||
this.getI18n().loadTranslations();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SaneEconomy getSaneEconomy() {
|
public SaneEconomy getSaneEconomy() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: SaneEconomyMobKills
|
name: SaneEconomyMobKills
|
||||||
description: A plugin to give players experience when they kill mobs.
|
description: A plugin to give players experience when they kill mobs.
|
||||||
version: 0.1.0
|
version: 0.1.1
|
||||||
author: AppleDash
|
author: AppleDash
|
||||||
main: org.appledash.saneeconomymobkills.SaneEconomyMobKills
|
main: org.appledash.saneeconomymobkills.SaneEconomyMobKills
|
||||||
depend: [SaneEconomy]
|
depend: [SaneEconomy]
|
||||||
|
@ -37,6 +37,32 @@
|
|||||||
<target>1.8</target>
|
<target>1.8</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</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>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<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 SignChangeListener(this), this);
|
||||||
getServer().getPluginManager().registerEvents(new InteractListener(this), this);
|
getServer().getPluginManager().registerEvents(new InteractListener(this), this);
|
||||||
getServer().getPluginManager().registerEvents(new BreakListener(this), this);
|
getServer().getPluginManager().registerEvents(new BreakListener(this), this);
|
||||||
this.getI18n().loadTranslations();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SignShopManager getSignShopManager() {
|
public SignShopManager getSignShopManager() {
|
||||||
|
2
pom.xml
2
pom.xml
@ -46,7 +46,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.appledash</groupId>
|
<groupId>org.appledash</groupId>
|
||||||
<artifactId>sanelib</artifactId>
|
<artifactId>sanelib</artifactId>
|
||||||
<version>0.2.0-SNAPSHOT</version>
|
<version>0.2.6-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
Loading…
Reference in New Issue
Block a user