Fixed user not being loaded in from the database if it was loaded before
This commit is contained in:
@@ -66,8 +66,6 @@ public class PluginMessageListener implements org.bukkit.plugin.messaging.Plugin
|
|||||||
.collect(Collectors.joining("\n")));
|
.collect(Collectors.joining("\n")));
|
||||||
int minutes = Queries.getMinutesSinceUpdated(uuid);
|
int minutes = Queries.getMinutesSinceUpdated(uuid);
|
||||||
user.removePoints(minutes * 2);
|
user.removePoints(minutes * 2);
|
||||||
|
|
||||||
EconUser.removeQueriedUser(uuid);
|
|
||||||
}
|
}
|
||||||
}.runTaskAsynchronously(VillagerUI.getInstance());
|
}.runTaskAsynchronously(VillagerUI.getInstance());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,14 +12,11 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
import org.jetbrains.annotations.Unmodifiable;
|
import org.jetbrains.annotations.Unmodifiable;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class EconUser {
|
public class EconUser {
|
||||||
|
|
||||||
private static Object2ObjectOpenHashMap<UUID, EconUser> users = new Object2ObjectOpenHashMap<>();
|
private static Object2ObjectOpenHashMap<UUID, EconUser> users = new Object2ObjectOpenHashMap<>();
|
||||||
// private final static Queue<EconUser> addQueue = new LinkedBlockingQueue<>();
|
|
||||||
// private final static Queue<EconUser> removeQueue = new LinkedBlockingQueue<>();
|
|
||||||
|
|
||||||
private final UUID uuid;
|
private final UUID uuid;
|
||||||
private final Object2ObjectOpenHashMap<String, Integer> pointsMap;
|
private final Object2ObjectOpenHashMap<String, Integer> pointsMap;
|
||||||
@@ -48,10 +45,6 @@ public class EconUser {
|
|||||||
users.remove(uuid);
|
users.remove(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeQueriedUser(UUID uuid) {
|
|
||||||
queriedUsers.remove(uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID getUuid() {
|
public UUID getUuid() {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
@@ -127,11 +120,7 @@ public class EconUser {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HashSet<UUID> queriedUsers = new HashSet<>();
|
|
||||||
public static void tryLoadUser(UUID uuid) {
|
public static void tryLoadUser(UUID uuid) {
|
||||||
if (queriedUsers.contains(uuid) || containsUser(uuid))
|
|
||||||
return;
|
|
||||||
queriedUsers.add(uuid);
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -146,7 +135,6 @@ public class EconUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void removeUser(UUID uuid) {
|
public static void removeUser(UUID uuid) {
|
||||||
queriedUsers.remove(uuid);
|
|
||||||
if (Config.DEBUG)
|
if (Config.DEBUG)
|
||||||
Logger.info("Unloading EconUser %", uuid.toString());
|
Logger.info("Unloading EconUser %", uuid.toString());
|
||||||
// EconUser user = getUser(uuid);
|
// EconUser user = getUser(uuid);
|
||||||
|
|||||||
Reference in New Issue
Block a user