Refactoring storage - WIP. Towards #32

This commit is contained in:
Luck
2016-10-20 21:55:34 +01:00
Unverified
parent 0d515abadb
commit 37fc00cce8
55 changed files with 1470 additions and 340 deletions
@@ -95,7 +95,7 @@ public class BungeeListener extends AbstractListener implements Listener {
final PendingConnection c = e.getConnection();
if (!cache.isOnlineMode()) {
UUID uuid = plugin.getDatastore().getUUID(c.getName());
UUID uuid = plugin.getDatastore().getUUID(c.getName()).getOrDefault(null);
if (uuid != null) {
cache.addToCache(c.getUniqueId(), uuid);
} else {
@@ -105,7 +105,7 @@ public class BungeeListener extends AbstractListener implements Listener {
plugin.getDatastore().saveUUIDData(c.getName(), c.getUniqueId());
}
} else {
UUID uuid = plugin.getDatastore().getUUID(c.getName());
UUID uuid = plugin.getDatastore().getUUID(c.getName()).getOrDefault(null);
if (uuid == null) {
plugin.getApiProvider().fireEventAsync(new UserFirstLoginEvent(c.getUniqueId(), c.getName()));
}
@@ -268,4 +268,10 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin {
public void doSync(Runnable r) {
r.run();
}
@Override
public void doAsyncRepeating(Runnable r, long interval) {
long millis = interval * 50L; // convert from ticks to milliseconds
getProxy().getScheduler().schedule(this, r, millis, millis, TimeUnit.MILLISECONDS);
}
}