Fixed double adding user and check if user is loaded
This commit is contained in:
parent
534978cef3
commit
23c0ed066d
|
|
@ -65,7 +65,6 @@ public class PluginMessageListener implements org.bukkit.plugin.messaging.Plugin
|
||||||
Logger.info("Loaded EconUser for % and removed % points",
|
Logger.info("Loaded EconUser for % and removed % points",
|
||||||
uuid.toString(), String.valueOf(minutes * 2));
|
uuid.toString(), String.valueOf(minutes * 2));
|
||||||
|
|
||||||
EconUser.addUser(uuid, user);
|
|
||||||
EconUser.removeQueriedUser(uuid);
|
EconUser.removeQueriedUser(uuid);
|
||||||
}
|
}
|
||||||
}.runTaskAsynchronously(VillagerUI.getInstance());
|
}.runTaskAsynchronously(VillagerUI.getInstance());
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,6 @@ public class EconUser {
|
||||||
Logger.info("Created EconUser for: %", uuid.toString());
|
Logger.info("Created EconUser for: %", uuid.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addUser(UUID uuid, EconUser user) {
|
|
||||||
users.put(uuid, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void removeQueriedUser(UUID uuid) {
|
public static void removeQueriedUser(UUID uuid) {
|
||||||
queriedUsers.remove(uuid);
|
queriedUsers.remove(uuid);
|
||||||
}
|
}
|
||||||
|
|
@ -114,7 +110,7 @@ public class EconUser {
|
||||||
|
|
||||||
private static HashSet<UUID> queriedUsers = new HashSet<>();
|
private static HashSet<UUID> queriedUsers = new HashSet<>();
|
||||||
public static void tryLoadUser(UUID uuid) {
|
public static void tryLoadUser(UUID uuid) {
|
||||||
if (queriedUsers.contains(uuid) && !users.containsKey(uuid))
|
if (queriedUsers.contains(uuid) || users.containsKey(uuid))
|
||||||
return;
|
return;
|
||||||
queriedUsers.add(uuid);
|
queriedUsers.add(uuid);
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user