SaneEconomy: Only log database transactions if debug=true (in newer SaneLib)
This commit is contained in:
parent
c3f84698ce
commit
f54a43437d
|
@ -6,10 +6,10 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.appledash</groupId>
|
<groupId>org.appledash</groupId>
|
||||||
<artifactId>SaneEconomy</artifactId>
|
<artifactId>SaneEconomy</artifactId>
|
||||||
<version>0.12.3-SNAPSHOT</version>
|
<version>0.12.4-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>SaneEconomyCore</artifactId>
|
<artifactId>SaneEconomyCore</artifactId>
|
||||||
<version>0.12.3-SNAPSHOT</version>
|
<version>0.12.4-SNAPSHOT</version>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -75,11 +75,15 @@ public class SaneEconomy extends SanePlugin implements ISaneEconomy {
|
||||||
vaultHook.unhook();
|
vaultHook.unhook();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (economyManager != null) {
|
this.flushEconomyManager();
|
||||||
getLogger().info("Flushing database...");
|
}
|
||||||
economyManager.getBackend().waitUntilFlushed();
|
|
||||||
|
|
||||||
if (economyManager.getBackend() instanceof EconomyStorageBackendMySQL) {
|
private void flushEconomyManager() {
|
||||||
|
if (this.economyManager != null) {
|
||||||
|
this.getLogger().info("Flushing database...");
|
||||||
|
this.economyManager.getBackend().waitUntilFlushed();
|
||||||
|
|
||||||
|
if (this.economyManager.getBackend() instanceof EconomyStorageBackendMySQL) {
|
||||||
((EconomyStorageBackendMySQL) economyManager.getBackend()).closeConnections();
|
((EconomyStorageBackendMySQL) economyManager.getBackend()).closeConnections();
|
||||||
if (!((EconomyStorageBackendMySQL) economyManager.getBackend()).getConnection().getConnection().isFinished()) {
|
if (!((EconomyStorageBackendMySQL) economyManager.getBackend()).getConnection().getConnection().isFinished()) {
|
||||||
this.getLogger().warning("SaneDatabase didn't terminate all threads, something weird is going on?");
|
this.getLogger().warning("SaneDatabase didn't terminate all threads, something weird is going on?");
|
||||||
|
@ -88,7 +92,7 @@ public class SaneEconomy extends SanePlugin implements ISaneEconomy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean loadConfig() {
|
public boolean loadConfig() {
|
||||||
File configFile = new File(getDataFolder(), "config.yml");
|
File configFile = new File(getDataFolder(), "config.yml");
|
||||||
|
|
||||||
if (configFile.exists() && getConfig().getBoolean("debug", false)) {
|
if (configFile.exists() && getConfig().getBoolean("debug", false)) {
|
||||||
|
@ -99,10 +103,14 @@ public class SaneEconomy extends SanePlugin implements ISaneEconomy {
|
||||||
getConfig().set("debug", true);
|
getConfig().set("debug", true);
|
||||||
saveConfig();
|
saveConfig();
|
||||||
} else {
|
} else {
|
||||||
saveDefaultConfig();
|
if (!configFile.exists()) {
|
||||||
reloadConfig();
|
this.saveDefaultConfig();
|
||||||
|
}
|
||||||
|
this.reloadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.flushEconomyManager(); // If we're reloading the configuration, we flush the old economy manager first
|
||||||
|
|
||||||
SaneEconomyConfiguration config = new SaneEconomyConfiguration(this);
|
SaneEconomyConfiguration config = new SaneEconomyConfiguration(this);
|
||||||
|
|
||||||
economyManager = config.loadEconomyBackend();
|
economyManager = config.loadEconomyBackend();
|
||||||
|
|
|
@ -26,7 +26,9 @@ public class SaneEcoCommand extends SaneCommand {
|
||||||
@Override
|
@Override
|
||||||
public String[] getUsage() {
|
public String[] getUsage() {
|
||||||
return new String[] {
|
return new String[] {
|
||||||
"/<command> reload-database"
|
"/<command> reload - Reload everything.",
|
||||||
|
"/<command> reload-database - Reload the database.",
|
||||||
|
"/<command> reload-config - Reload the configuration."
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +44,15 @@ public class SaneEcoCommand extends SaneCommand {
|
||||||
this.saneEconomy.getMessenger().sendMessage(sender, "Reloading database...");
|
this.saneEconomy.getMessenger().sendMessage(sender, "Reloading database...");
|
||||||
saneEconomy.getEconomyManager().getBackend().reloadDatabase();
|
saneEconomy.getEconomyManager().getBackend().reloadDatabase();
|
||||||
this.saneEconomy.getMessenger().sendMessage(sender, "Database reloaded.");
|
this.saneEconomy.getMessenger().sendMessage(sender, "Database reloaded.");
|
||||||
|
} else if (subCommand.equalsIgnoreCase("reload-config")) {
|
||||||
|
this.saneEconomy.getMessenger().sendMessage(sender, "Reloading configuration...");
|
||||||
|
this.saneEconomy.loadConfig();
|
||||||
|
this.saneEconomy.getMessenger().sendMessage(sender, "Configuration reloaded.");
|
||||||
|
} else if (subCommand.equalsIgnoreCase("reload")) {
|
||||||
|
this.saneEconomy.getMessenger().sendMessage(sender, "Reloading configuration and database...");
|
||||||
|
this.saneEconomy.loadConfig();
|
||||||
|
this.saneEconomy.getEconomyManager().getBackend().reloadDatabase();
|
||||||
|
this.saneEconomy.getMessenger().sendMessage(sender, "Configuration and database reloaded.");
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidUsageException();
|
throw new InvalidUsageException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,18 +5,18 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>SaneEconomy</artifactId>
|
<artifactId>SaneEconomy</artifactId>
|
||||||
<groupId>org.appledash</groupId>
|
<groupId>org.appledash</groupId>
|
||||||
<version>0.12.3-SNAPSHOT</version>
|
<version>0.12.4-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>SaneEconomyMobKills</artifactId>
|
<artifactId>SaneEconomyMobKills</artifactId>
|
||||||
<version>0.1.2-SNAPSHOT</version>
|
<version>0.1.3-SNAPSHOT</version>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.appledash</groupId>
|
<groupId>org.appledash</groupId>
|
||||||
<artifactId>SaneEconomyCore</artifactId>
|
<artifactId>SaneEconomyCore</artifactId>
|
||||||
<version>0.12.3-SNAPSHOT</version>
|
<version>0.12.4-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>SaneEconomy</artifactId>
|
<artifactId>SaneEconomy</artifactId>
|
||||||
<groupId>org.appledash</groupId>
|
<groupId>org.appledash</groupId>
|
||||||
<version>0.12.3-SNAPSHOT</version>
|
<version>0.12.4-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.appledash</groupId>
|
<groupId>org.appledash</groupId>
|
||||||
<artifactId>SaneEconomyCore</artifactId>
|
<artifactId>SaneEconomyCore</artifactId>
|
||||||
<version>0.12.3-SNAPSHOT</version>
|
<version>0.12.4-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
admin-shop-trigger: '[Shop]'
|
admin-shop-trigger: '[Shop]'
|
||||||
admin-shop-title: '&8[&6Shop&8]&r'
|
admin-shop-title: '&8[&6Shop&8]&r'
|
||||||
|
chat:
|
||||||
|
prefix: '&b[&9Shops&b]&r '
|
4
pom.xml
4
pom.xml
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<groupId>org.appledash</groupId>
|
<groupId>org.appledash</groupId>
|
||||||
<artifactId>SaneEconomy</artifactId>
|
<artifactId>SaneEconomy</artifactId>
|
||||||
<version>0.12.3-SNAPSHOT</version>
|
<version>0.12.4-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.appledash</groupId>
|
<groupId>org.appledash</groupId>
|
||||||
<artifactId>sanelib</artifactId>
|
<artifactId>sanelib</artifactId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
Loading…
Reference in New Issue