Block badge commands if MySQL is disabled

This commit is contained in:
Ghoti 2020-03-13 02:22:39 -05:00
parent adc0f41a87
commit bfadbc9340
5 changed files with 25 additions and 4 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>FPChatX</groupId>
<artifactId>FPChatX</artifactId>
<version>1.0.5-BETA</version>
<version>1.0.6-BETA</version>
<repositories>
<repository>
<id>spigot-repo</id>

View File

@ -64,7 +64,7 @@ public class FPChat extends JavaPlugin {
private BukkitTask refresh = null;
private PlayerListener listener = null;
private PlayerCache cache;
public void onEnable() {
plugin = this;
VaultUtil vault = new VaultUtil(this);
@ -115,7 +115,10 @@ public class FPChat extends JavaPlugin {
refresh.cancel();
}
sql.disconnect();
if(config.mySQLEnabled()) {
sql.disconnect();
}
for(FPlayer p : FPlayer.getPlayers()) {
p.cleanup();
}
@ -185,7 +188,7 @@ public class FPChat extends JavaPlugin {
public MainConfig getMainConfig() {
return this.config;
}
public PlayerCache getPlayerCache() {
return this.cache;
}

View File

@ -31,6 +31,13 @@ public class BadgeClearCommand extends Commands {
FPlayer.errMsg(null, "This command is for players only.");
return;
}
if(!plugin.getMainConfig().mySQLEnabled()) {
FPlayer.errMsg(null, "MySQL is not enabled.");
return;
}
FPlayer p = FPlayer.getPlayer((Player)sender);
BadgeSet.setBadge(p, 1, 0);
BadgeSet.setBadge(p, 2, 0);

View File

@ -35,6 +35,11 @@ public class BadgeEquipCommand extends Commands {
return;
}
if(!plugin.getMainConfig().mySQLEnabled()) {
FPlayer.errMsg(null, "MySQL is not enabled.");
return;
}
FPlayer p = FPlayer.getPlayer((Player)sender);
if(Util.isDigit(args[0]) && Util.isDigit(args[1])){

View File

@ -32,6 +32,12 @@ public class BadgeListCommand extends Commands {
FPlayer.errMsg(null, "This command is for players only.");
return;
}
if(!plugin.getMainConfig().mySQLEnabled()) {
FPlayer.errMsg(null, "MySQL is not enabled.");
return;
}
FPlayer p = FPlayer.getPlayer((Player)sender);
if(args.length == 0 || !Util.isDigit(args[0])){
BadgeList.badgeList(p, 1);