mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2025-07-03 08:15:42 +00:00
Fix SQL cooldown table generation (#177)
This commit is contained in:
parent
c3602ee5e1
commit
9042fbf6d1
@ -25,12 +25,25 @@ public class DatabaseCooldowns extends SQLite {
|
|||||||
@Override
|
@Override
|
||||||
public List<String> getTables() {
|
public List<String> getTables() {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
if (BetterRTP.getInstance().getCooldowns().isEnabled())
|
|
||||||
|
// Ignore loaded world names if cooldowns are disabled
|
||||||
|
if (!BetterRTP.getInstance().getCooldowns().isEnabled())
|
||||||
return list;
|
return list;
|
||||||
for (World world : Bukkit.getWorlds()) {
|
|
||||||
if (!BetterRTP.getInstance().getRTP().getDisabledWorlds().contains(world.getName()))
|
// Get list of disabled worlds and ensure list isn't null
|
||||||
|
List<String> disabledWorlds = BetterRTP.getInstance().getRTP().getDisabledWorlds();
|
||||||
|
if (disabledWorlds == null) disabledWorlds = new ArrayList<>();
|
||||||
|
|
||||||
|
// If there are disabled worlds, iterate through the loaded worlds on the server and
|
||||||
|
// add the world name to the list of table names if they aren't marked as disabled
|
||||||
|
List<World> worlds = Bukkit.getWorlds();
|
||||||
|
if (!disabledWorlds.isEmpty()) {
|
||||||
|
for (World world : worlds) {
|
||||||
|
if (!disabledWorlds.contains(world.getName()))
|
||||||
list.add(world.getName());
|
list.add(world.getName());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,10 +57,13 @@ public abstract class SQLite {
|
|||||||
public void load() {
|
public void load() {
|
||||||
loaded = false;
|
loaded = false;
|
||||||
tables = getTables();
|
tables = getTables();
|
||||||
if (tables.isEmpty()) { //Dont do anything is no colums to generate
|
|
||||||
|
// Don't do anything is no columns to generate
|
||||||
|
if (tables.isEmpty()) {
|
||||||
loaded = true;
|
loaded = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsyncHandler.async(() -> {
|
AsyncHandler.async(() -> {
|
||||||
Connection connection = getSQLConnection();
|
Connection connection = getSQLConnection();
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user