Minor - make AuthMe.database private

- In favor of AuthMe.getDataSource()
This commit is contained in:
ljacqu
2015-12-29 11:55:57 +01:00
parent 571cb6d36b
commit 531327dd9b
17 changed files with 98 additions and 158 deletions
@@ -33,7 +33,7 @@ public class Management {
@Override
public void run() {
new AsynchronousLogin(player, password, forceLogin, plugin, plugin.database).process();
new AsynchronousLogin(player, password, forceLogin, plugin, plugin.getDataSource()).process();
}
});
}
@@ -43,7 +43,7 @@ public class Management {
@Override
public void run() {
new AsynchronousLogout(player, plugin, plugin.database).process();
new AsynchronousLogout(player, plugin, plugin.getDataSource()).process();
}
});
}
@@ -53,7 +53,7 @@ public class Management {
@Override
public void run() {
new AsyncRegister(player, password, email, plugin, plugin.database).process();
new AsyncRegister(player, password, email, plugin, plugin.getDataSource()).process();
}
});
}
@@ -73,7 +73,7 @@ public class Management {
@Override
public void run() {
new AsynchronousJoin(player, plugin, plugin.database).process();
new AsynchronousJoin(player, plugin, plugin.getDataSource()).process();
}
});
@@ -84,7 +84,7 @@ public class Management {
@Override
public void run() {
new AsynchronousQuit(player, plugin, plugin.database, isKick).process();
new AsynchronousQuit(player, plugin, plugin.getDataSource(), isKick).process();
}
});
@@ -40,7 +40,7 @@ public class AsyncChangeEmail {
if (Settings.getmaxRegPerEmail > 0) {
if (!plugin.getPermissionsManager().hasPermission(player, PlayerPermission.ALLOW_MULTIPLE_ACCOUNTS)
&& plugin.database.getAllAuthsByEmail(newEmail).size() >= Settings.getmaxRegPerEmail) {
&& plugin.getDataSource().getAllAuthsByEmail(newEmail).size() >= Settings.getmaxRegPerEmail) {
m.send(player, MessageKey.MAX_REGISTER_EXCEEDED);
return;
}
@@ -68,7 +68,7 @@ public class AsyncChangeEmail {
}
String old = auth.getEmail();
auth.setEmail(newEmail);
if (!plugin.database.updateEmail(auth)) {
if (!plugin.getDataSource().updateEmail(auth)) {
m.send(player, MessageKey.ERROR);
auth.setEmail(old);
return;
@@ -81,7 +81,7 @@ public class AsyncChangeEmail {
}
m.send(player, MessageKey.EMAIL_CHANGED_SUCCESS);
} else {
if (plugin.database.isAuthAvailable(playerName)) {
if (plugin.getDataSource().isAuthAvailable(playerName)) {
m.send(player, MessageKey.LOGIN_MESSAGE);
} else {
if (Settings.emailRegistration) {
@@ -6,7 +6,6 @@ import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.cache.backup.JsonCache;
import fr.xephi.authme.cache.limbo.LimboCache;
import fr.xephi.authme.cache.limbo.LimboPlayer;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
import fr.xephi.authme.settings.Settings;
@@ -20,16 +19,12 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitTask;
import java.security.NoSuchAlgorithmException;
/**
*/
public class AsynchronousUnregister {
protected final Player player;
protected final String name;
protected final String password;
protected final boolean force;
private final Player player;
private final String name;
private final String password;
private final boolean force;
private final AuthMe plugin;
private final Messages m;
private final JsonCache playerCache;
@@ -52,18 +47,13 @@ public class AsynchronousUnregister {
this.playerCache = new JsonCache();
}
/**
* Method getIp.
*
* @return String
*/
protected String getIp() {
return plugin.getIP(player);
}
public void process() {
if (force || plugin.getPasswordSecurity().comparePassword(password, PlayerCache.getInstance().getAuth(name).getHash(), player.getName())) {
if (!plugin.database.removeAuth(name)) {
if (!plugin.getDataSource().removeAuth(name)) {
m.send(player, MessageKey.ERROR);
return;
}