mirror of
https://github.com/EpicEricEE/ShopChest.git
synced 2024-11-08 11:50:14 +01:00
If a world is not found, only show the error once
This commit is contained in:
parent
8e5b61c7a0
commit
508baf4f6b
@ -21,10 +21,14 @@ import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public abstract class Database {
|
||||
|
||||
private static Set<String> notFoundWorlds = new HashSet<>();
|
||||
|
||||
ShopChest plugin;
|
||||
Connection connection;
|
||||
|
||||
@ -221,8 +225,9 @@ public abstract class Database {
|
||||
/**
|
||||
* Get all shops from the database
|
||||
* @param callback Callback that - if succeeded - returns an array of all shops (as {@code Shop[]})
|
||||
* @param showConsoleMessages Whether console messages (errors or warnings) should be shown
|
||||
*/
|
||||
public void getShops(final Callback callback) {
|
||||
public void getShops(final boolean showConsoleMessages, final Callback callback) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -248,8 +253,8 @@ public abstract class Database {
|
||||
|
||||
if (world == null) {
|
||||
WorldNotFoundException ex = new WorldNotFoundException("Could not find world with name \"" + worldName + "\"");
|
||||
if (callback != null) callback.callSyncError(ex);
|
||||
plugin.getLogger().warning(ex.getMessage());
|
||||
if (showConsoleMessages && !notFoundWorlds.contains(worldName)) plugin.getLogger().warning(ex.getMessage());
|
||||
notFoundWorlds.add(worldName);
|
||||
plugin.debug("Failed to get shop (#" + id + ")");
|
||||
plugin.debug(ex);
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user