mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-10-05 01:48:08 +02:00
Fixed various spelling and grammar issues
This commit is contained in:
parent
c3fa8b272f
commit
47b1d00ccf
@ -246,7 +246,7 @@ public class AuthMe extends JavaPlugin {
|
||||
// Check Essentials
|
||||
checkEssentials();
|
||||
|
||||
// Check if the protocollib is available. If so we could listen for
|
||||
// Check if the ProtocolLib is available. If so we could listen for
|
||||
// inventory protection
|
||||
checkProtocolLib();
|
||||
// End of Hooks
|
||||
@ -277,8 +277,8 @@ public class AuthMe extends JavaPlugin {
|
||||
// Set up the management
|
||||
management = new Management(this);
|
||||
|
||||
// Set up the Bungeecord hook
|
||||
setupBungeecordHook();
|
||||
// Set up the BungeeCord hook
|
||||
setupBungeeCordHook();
|
||||
|
||||
// Reload support hook
|
||||
reloadSupportHook();
|
||||
@ -394,9 +394,9 @@ public class AuthMe extends JavaPlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up the Bungecoord hook.
|
||||
* Set up the BungeeCord hook.
|
||||
*/
|
||||
private void setupBungeecordHook() {
|
||||
private void setupBungeeCordHook() {
|
||||
if (Settings.bungee) {
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||
Bukkit.getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeCordMessage(this));
|
||||
@ -443,7 +443,7 @@ public class AuthMe extends JavaPlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up the antibot delay.
|
||||
* Set up the AntiBot delay.
|
||||
*/
|
||||
private void setupAntiBotDelay() {
|
||||
if (Settings.enableAntiBot) {
|
||||
@ -652,7 +652,7 @@ public class AuthMe extends JavaPlugin {
|
||||
try {
|
||||
ess = (Essentials) server.getPluginManager().getPlugin("Essentials");
|
||||
ConsoleLogger.info("Hooked correctly with Essentials");
|
||||
} catch (Exception | NoClassDefFoundError ingnored) {
|
||||
} catch (Exception | NoClassDefFoundError ignored) {
|
||||
ess = null;
|
||||
}
|
||||
} else {
|
||||
@ -677,7 +677,7 @@ public class AuthMe extends JavaPlugin {
|
||||
try {
|
||||
combatTagPlus = (CombatTagPlus) server.getPluginManager().getPlugin("CombatTagPlus");
|
||||
ConsoleLogger.info("Hooked correctly with CombatTagPlus");
|
||||
} catch (Exception | NoClassDefFoundError ingnored) {
|
||||
} catch (Exception | NoClassDefFoundError ignored) {
|
||||
combatTagPlus = null;
|
||||
}
|
||||
} else {
|
||||
@ -855,7 +855,7 @@ public class AuthMe extends JavaPlugin {
|
||||
}, 1, 1200 * Settings.delayRecall);
|
||||
}
|
||||
|
||||
public String replaceAllInfos(String message, Player player) {
|
||||
public String replaceAllInfo(String message, Player player) {
|
||||
int playersOnline = Utils.getOnlinePlayers().size();
|
||||
message = message.replace("&", "\u00a7");
|
||||
message = message.replace("{PLAYER}", player.getName());
|
||||
@ -919,8 +919,8 @@ public class AuthMe extends JavaPlugin {
|
||||
sUrl = sUrl.replace("%IP%", player.getAddress().getAddress().getHostAddress()).replace("%PORT%", "" + player.getAddress().getPort());
|
||||
try {
|
||||
URL url = new URL(sUrl);
|
||||
URLConnection urlc = url.openConnection();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(urlc.getInputStream()));
|
||||
URLConnection urlCon = url.openConnection();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(urlCon.getInputStream()));
|
||||
String inputLine = in.readLine();
|
||||
if (inputLine != null && !inputLine.isEmpty() && !inputLine.equalsIgnoreCase("error") && !inputLine.contains("error")) {
|
||||
realIP = inputLine;
|
||||
|
@ -33,10 +33,10 @@ public class NewAPI {
|
||||
/**
|
||||
* Constructor for NewAPI.
|
||||
*
|
||||
* @param serv Server
|
||||
* @param server Server
|
||||
*/
|
||||
public NewAPI(Server serv) {
|
||||
this.plugin = (AuthMe) serv.getPluginManager().getPlugin("AuthMe");
|
||||
public NewAPI(Server server) {
|
||||
this.plugin = (AuthMe) server.getPluginManager().getPlugin("AuthMe");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -586,7 +586,7 @@ public class CommandDescription {
|
||||
*
|
||||
* @return True if this command has any child labels.
|
||||
*/
|
||||
public boolean hasChilds() {
|
||||
public boolean hasChildren() {
|
||||
return (this.children.size() != 0);
|
||||
}
|
||||
|
||||
|
@ -49,15 +49,15 @@ public class vAuthFileReader {
|
||||
String password = line.split(": ")[1];
|
||||
PlayerAuth auth;
|
||||
if (isUUIDinstance(password)) {
|
||||
String pname;
|
||||
String playerName;
|
||||
try {
|
||||
pname = Bukkit.getOfflinePlayer(UUID.fromString(name)).getName();
|
||||
playerName = Bukkit.getOfflinePlayer(UUID.fromString(name)).getName();
|
||||
} catch (Exception | NoSuchMethodError e) {
|
||||
pname = getName(UUID.fromString(name));
|
||||
playerName = getName(UUID.fromString(name));
|
||||
}
|
||||
if (pname == null)
|
||||
if (playerName == null)
|
||||
continue;
|
||||
auth = new PlayerAuth(pname.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com", pname);
|
||||
auth = new PlayerAuth(playerName.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com", playerName);
|
||||
} else {
|
||||
auth = new PlayerAuth(name.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com", name);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class xAuthToFlat {
|
||||
database.saveAuth(auth);
|
||||
}
|
||||
}
|
||||
sender.sendMessage("[AuthMe] Successfull convert from xAuth database");
|
||||
sender.sendMessage("[AuthMe] Successfully convert from xAuth database");
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage("[AuthMe] An error has been thrown while import xAuth database, the import hadn't fail but can be not complete ");
|
||||
}
|
||||
|
@ -520,21 +520,21 @@ public class CacheDataSource implements DataSource {
|
||||
/**
|
||||
* Method updateName.
|
||||
*
|
||||
* @param oldone String
|
||||
* @param newone String
|
||||
* @param oldOne String
|
||||
* @param newOne String
|
||||
*
|
||||
* @see fr.xephi.authme.datasource.DataSource#updateName(String, String)
|
||||
*/
|
||||
@Override
|
||||
public void updateName(final String oldone, final String newone) {
|
||||
if (cache.containsKey(oldone)) {
|
||||
cache.put(newone, cache.get(oldone));
|
||||
cache.remove(oldone);
|
||||
public void updateName(final String oldOne, final String newOne) {
|
||||
if (cache.containsKey(oldOne)) {
|
||||
cache.put(newOne, cache.get(oldOne));
|
||||
cache.remove(oldOne);
|
||||
}
|
||||
exec.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
source.updateName(oldone, newone);
|
||||
source.updateName(oldOne, newOne);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -196,10 +196,10 @@ public interface DataSource {
|
||||
/**
|
||||
* Method updateName.
|
||||
*
|
||||
* @param oldone String
|
||||
* @param newone String
|
||||
* @param oldOne String
|
||||
* @param newOne String
|
||||
*/
|
||||
void updateName(String oldone, String newone);
|
||||
void updateName(String oldOne, String newOne);
|
||||
|
||||
/**
|
||||
* Method getAllAuths.
|
||||
@ -215,12 +215,9 @@ public interface DataSource {
|
||||
*/
|
||||
List<PlayerAuth> getLoggedPlayers();
|
||||
|
||||
/**
|
||||
*/
|
||||
enum DataSourceType {
|
||||
MYSQL,
|
||||
FILE,
|
||||
SQLITE
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -460,16 +460,16 @@ public class DatabaseCalls implements DataSource {
|
||||
/**
|
||||
* Method updateName.
|
||||
*
|
||||
* @param oldone String
|
||||
* @param newone String
|
||||
* @param oldOne String
|
||||
* @param newOne String
|
||||
*
|
||||
* @see fr.xephi.authme.datasource.DataSource#updateName(String, String)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void updateName(final String oldone, final String newone) {
|
||||
public synchronized void updateName(final String oldOne, final String newOne) {
|
||||
exec.execute(new Runnable() {
|
||||
public synchronized void run() {
|
||||
database.updateName(oldone, newone);
|
||||
database.updateName(oldOne, newOne);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -851,17 +851,17 @@ public class FlatFile implements DataSource {
|
||||
/**
|
||||
* Method updateName.
|
||||
*
|
||||
* @param oldone String
|
||||
* @param newone String
|
||||
* @param oldOne String
|
||||
* @param newOne String
|
||||
*
|
||||
* @see fr.xephi.authme.datasource.DataSource#updateName(String, String)
|
||||
*/
|
||||
@Override
|
||||
public void updateName(String oldone, String newone) {
|
||||
PlayerAuth auth = this.getAuth(oldone);
|
||||
auth.setName(newone);
|
||||
public void updateName(String oldOne, String newOne) {
|
||||
PlayerAuth auth = this.getAuth(oldOne);
|
||||
auth.setName(newOne);
|
||||
this.saveAuth(auth);
|
||||
this.removeAuth(oldone);
|
||||
this.removeAuth(oldOne);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1149,21 +1149,21 @@ public class MySQL implements DataSource {
|
||||
/**
|
||||
* Method updateName.
|
||||
*
|
||||
* @param oldone String
|
||||
* @param newone String
|
||||
* @param oldOne String
|
||||
* @param newOne String
|
||||
*
|
||||
* @see fr.xephi.authme.datasource.DataSource#updateName(String, String)
|
||||
*/
|
||||
@Override
|
||||
public void updateName(String oldone, String newone) {
|
||||
public void updateName(String oldOne, String newOne) {
|
||||
Connection con = null;
|
||||
PreparedStatement pst = null;
|
||||
try {
|
||||
if ((con = getConnection()) == null)
|
||||
return;
|
||||
pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnName + "=? WHERE LOWER(" + columnName + ")=?;");
|
||||
pst.setString(1, newone);
|
||||
pst.setString(2, oldone);
|
||||
pst.setString(1, newOne);
|
||||
pst.setString(2, oldOne);
|
||||
pst.executeUpdate();
|
||||
} catch (Exception ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
|
@ -764,18 +764,18 @@ public class SQLite implements DataSource {
|
||||
/**
|
||||
* Method updateName.
|
||||
*
|
||||
* @param oldone String
|
||||
* @param newone String
|
||||
* @param oldOne String
|
||||
* @param newOne String
|
||||
*
|
||||
* @see fr.xephi.authme.datasource.DataSource#updateName(String, String)
|
||||
*/
|
||||
@Override
|
||||
public void updateName(String oldone, String newone) {
|
||||
public void updateName(String oldOne, String newOne) {
|
||||
PreparedStatement pst = null;
|
||||
try {
|
||||
pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnName + "=? WHERE " + columnName + "=?;");
|
||||
pst.setString(1, newone);
|
||||
pst.setString(2, oldone);
|
||||
pst.setString(1, newOne);
|
||||
pst.setString(2, oldOne);
|
||||
pst.executeUpdate();
|
||||
} catch (SQLException ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
|
@ -2,12 +2,12 @@ package fr.xephi.authme.process;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.process.email.AsyncChangeEmail;
|
||||
import fr.xephi.authme.process.join.AsyncronousJoin;
|
||||
import fr.xephi.authme.process.login.AsyncronousLogin;
|
||||
import fr.xephi.authme.process.logout.AsyncronousLogout;
|
||||
import fr.xephi.authme.process.quit.AsyncronousQuit;
|
||||
import fr.xephi.authme.process.join.AsynchronousJoin;
|
||||
import fr.xephi.authme.process.login.AsynchronousLogin;
|
||||
import fr.xephi.authme.process.logout.AsynchronousLogout;
|
||||
import fr.xephi.authme.process.quit.AsynchronousQuit;
|
||||
import fr.xephi.authme.process.register.AsyncRegister;
|
||||
import fr.xephi.authme.process.unregister.AsyncronousUnregister;
|
||||
import fr.xephi.authme.process.unregister.AsynchronousUnregister;
|
||||
import fr.xephi.authme.security.RandomString;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -45,7 +45,7 @@ public class Management {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousLogin(player, password, forceLogin, plugin, plugin.database).process();
|
||||
new AsynchronousLogin(player, password, forceLogin, plugin, plugin.database).process();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -60,7 +60,7 @@ public class Management {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousLogout(player, plugin, plugin.database).process();
|
||||
new AsynchronousLogout(player, plugin, plugin.database).process();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -94,7 +94,7 @@ public class Management {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousUnregister(player, password, force, plugin).process();
|
||||
new AsynchronousUnregister(player, password, force, plugin).process();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -109,7 +109,7 @@ public class Management {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousJoin(player, plugin, plugin.database).process();
|
||||
new AsynchronousJoin(player, plugin, plugin.database).process();
|
||||
}
|
||||
|
||||
});
|
||||
@ -126,7 +126,7 @@ public class Management {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousQuit(player, plugin, plugin.database, isKick).process();
|
||||
new AsynchronousQuit(player, plugin, plugin.database, isKick).process();
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -29,7 +29,7 @@ import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class AsyncronousJoin {
|
||||
public class AsynchronousJoin {
|
||||
|
||||
private final AuthMe plugin;
|
||||
private final Player player;
|
||||
@ -39,13 +39,13 @@ public class AsyncronousJoin {
|
||||
private final BukkitScheduler sched;
|
||||
|
||||
/**
|
||||
* Constructor for AsyncronousJoin.
|
||||
* Constructor for AsynchronousJoin.
|
||||
*
|
||||
* @param player Player
|
||||
* @param plugin AuthMe
|
||||
* @param database DataSource
|
||||
*/
|
||||
public AsyncronousJoin(Player player, AuthMe plugin, DataSource database) {
|
||||
public AsynchronousJoin(Player player, AuthMe plugin, DataSource database) {
|
||||
this.player = player;
|
||||
this.plugin = plugin;
|
||||
this.sched = plugin.getServer().getScheduler();
|
||||
@ -261,10 +261,10 @@ public class AsyncronousJoin {
|
||||
private boolean needFirstSpawn() {
|
||||
if (player.hasPlayedBefore())
|
||||
return false;
|
||||
Location firstspawn = Spawn.getInstance().getFirstSpawn();
|
||||
if (firstspawn == null || firstspawn.getWorld() == null)
|
||||
Location firstSpawn = Spawn.getInstance().getFirstSpawn();
|
||||
if (firstSpawn == null || firstSpawn.getWorld() == null)
|
||||
return false;
|
||||
FirstSpawnTeleportEvent tpEvent = new FirstSpawnTeleportEvent(player, player.getLocation(), firstspawn);
|
||||
FirstSpawnTeleportEvent tpEvent = new FirstSpawnTeleportEvent(player, player.getLocation(), firstSpawn);
|
||||
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
||||
if (!tpEvent.isCancelled()) {
|
||||
if (player.isOnline() && tpEvent.getTo() != null && tpEvent.getTo().getWorld() != null) {
|
@ -23,7 +23,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class AsyncronousLogin {
|
||||
public class AsynchronousLogin {
|
||||
|
||||
private static RandomString rdm = new RandomString(Settings.captchaLength);
|
||||
protected Player player;
|
||||
@ -36,7 +36,7 @@ public class AsyncronousLogin {
|
||||
private Messages m = Messages.getInstance();
|
||||
|
||||
/**
|
||||
* Constructor for AsyncronousLogin.
|
||||
* Constructor for AsynchronousLogin.
|
||||
*
|
||||
* @param player Player
|
||||
* @param password String
|
||||
@ -44,7 +44,7 @@ public class AsyncronousLogin {
|
||||
* @param plugin AuthMe
|
||||
* @param data DataSource
|
||||
*/
|
||||
public AsyncronousLogin(Player player, String password, boolean forceLogin,
|
||||
public AsynchronousLogin(Player player, String password, boolean forceLogin,
|
||||
AuthMe plugin, DataSource data) {
|
||||
this.player = player;
|
||||
this.password = password;
|
@ -194,11 +194,11 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
|
||||
if (Settings.useWelcomeMessage)
|
||||
if (Settings.broadcastWelcomeMessage) {
|
||||
for (String s : Settings.welcomeMsg) {
|
||||
Bukkit.getServer().broadcastMessage(plugin.replaceAllInfos(s, player));
|
||||
Bukkit.getServer().broadcastMessage(plugin.replaceAllInfo(s, player));
|
||||
}
|
||||
} else {
|
||||
for (String s : Settings.welcomeMsg) {
|
||||
player.sendMessage(plugin.replaceAllInfos(s, player));
|
||||
player.sendMessage(plugin.replaceAllInfo(s, player));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class AsyncronousLogout {
|
||||
public class AsynchronousLogout {
|
||||
|
||||
protected Player player;
|
||||
protected String name;
|
||||
@ -23,13 +23,13 @@ public class AsyncronousLogout {
|
||||
private Messages m = Messages.getInstance();
|
||||
|
||||
/**
|
||||
* Constructor for AsyncronousLogout.
|
||||
* Constructor for AsynchronousLogout.
|
||||
*
|
||||
* @param player Player
|
||||
* @param plugin AuthMe
|
||||
* @param database DataSource
|
||||
*/
|
||||
public AsyncronousLogout(Player player, AuthMe plugin,
|
||||
public AsynchronousLogout(Player player, AuthMe plugin,
|
||||
DataSource database) {
|
||||
this.player = player;
|
||||
this.plugin = plugin;
|
||||
@ -49,7 +49,7 @@ public class AsyncronousLogout {
|
||||
if (!canLogout)
|
||||
return;
|
||||
final Player p = player;
|
||||
BukkitScheduler sched = p.getServer().getScheduler();
|
||||
BukkitScheduler scheduler = p.getServer().getScheduler();
|
||||
PlayerAuth auth = PlayerCache.getInstance().getAuth(name);
|
||||
database.updateSession(auth);
|
||||
auth.setQuitLocX(p.getLocation().getX());
|
||||
@ -60,7 +60,7 @@ public class AsyncronousLogout {
|
||||
|
||||
PlayerCache.getInstance().removePlayer(name);
|
||||
database.setUnlogged(name);
|
||||
sched.scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
scheduler.scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Utils.teleportToSpawn(p);
|
||||
@ -71,6 +71,6 @@ public class AsyncronousLogout {
|
||||
LimboCache.getInstance().addLimboPlayer(player);
|
||||
Utils.setGroup(player, GroupType.NOTLOGGEDIN);
|
||||
|
||||
sched.scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerLogout(p, plugin));
|
||||
scheduler.scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerLogout(p, plugin));
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class AsyncronousQuit {
|
||||
public class AsynchronousQuit {
|
||||
|
||||
protected AuthMe plugin;
|
||||
protected DataSource database;
|
||||
@ -28,14 +28,14 @@ public class AsyncronousQuit {
|
||||
private boolean isKick = false;
|
||||
|
||||
/**
|
||||
* Constructor for AsyncronousQuit.
|
||||
* Constructor for AsynchronousQuit.
|
||||
*
|
||||
* @param p Player
|
||||
* @param plugin AuthMe
|
||||
* @param database DataSource
|
||||
* @param isKick boolean
|
||||
*/
|
||||
public AsyncronousQuit(Player p, AuthMe plugin, DataSource database,
|
||||
public AsynchronousQuit(Player p, AuthMe plugin, DataSource database,
|
||||
boolean isKick) {
|
||||
this.player = p;
|
||||
this.plugin = plugin;
|
@ -59,17 +59,17 @@ public class AsyncRegister {
|
||||
* @return boolean * @throws Exception
|
||||
*/
|
||||
protected boolean preRegisterCheck() throws Exception {
|
||||
String lowpass = password.toLowerCase();
|
||||
String passLow = password.toLowerCase();
|
||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
m.send(player, "logged_in");
|
||||
return false;
|
||||
} else if (!Settings.isRegistrationEnabled) {
|
||||
m.send(player, "reg_disabled");
|
||||
return false;
|
||||
} else if (lowpass.contains("delete") || lowpass.contains("where") || lowpass.contains("insert") || lowpass.contains("modify") || lowpass.contains("from") || lowpass.contains("select") || lowpass.contains(";") || lowpass.contains("null") || !lowpass.matches(Settings.getPassRegex)) {
|
||||
} else if (passLow.contains("delete") || passLow.contains("where") || passLow.contains("insert") || passLow.contains("modify") || passLow.contains("from") || passLow.contains("select") || passLow.contains(";") || passLow.contains("null") || !passLow.matches(Settings.getPassRegex)) {
|
||||
m.send(player, "password_error");
|
||||
return false;
|
||||
} else if (lowpass.equalsIgnoreCase(player.getName())) {
|
||||
} else if (passLow.equalsIgnoreCase(player.getName())) {
|
||||
m.send(player, "password_error_nick");
|
||||
return false;
|
||||
} else if (password.length() < Settings.getPasswordMinLen || password.length() > Settings.passwordMaxLength) {
|
||||
@ -125,8 +125,8 @@ public class AsyncRegister {
|
||||
}
|
||||
}
|
||||
PlayerAuth auth;
|
||||
final String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, password, name);
|
||||
auth = new PlayerAuth(name, hashnew, getIp(), 0, (int) player.getLocation().getX(), (int) player.getLocation().getY(), (int) player.getLocation().getZ(), player.getLocation().getWorld().getName(), email, player.getName());
|
||||
final String hashNew = PasswordSecurity.getHash(Settings.getPasswordHash, password, name);
|
||||
auth = new PlayerAuth(name, hashNew, getIp(), 0, (int) player.getLocation().getX(), (int) player.getLocation().getY(), (int) player.getLocation().getZ(), player.getLocation().getWorld().getName(), email, player.getName());
|
||||
if (PasswordSecurity.userSalt.containsKey(name)) {
|
||||
auth.setSalt(PasswordSecurity.userSalt.get(name));
|
||||
}
|
||||
@ -134,8 +134,8 @@ public class AsyncRegister {
|
||||
database.updateEmail(auth);
|
||||
database.updateSession(auth);
|
||||
plugin.mail.main(auth, password);
|
||||
ProcessSyncEmailRegister syncronous = new ProcessSyncEmailRegister(player, plugin);
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, syncronous);
|
||||
ProcessSyncEmailRegister sync = new ProcessSyncEmailRegister(player, plugin);
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, sync);
|
||||
|
||||
}
|
||||
|
||||
@ -163,7 +163,7 @@ public class AsyncRegister {
|
||||
database.setLogged(name);
|
||||
}
|
||||
plugin.otherAccounts.addPlayer(player.getUniqueId());
|
||||
ProcessSyncronousPasswordRegister syncronous = new ProcessSyncronousPasswordRegister(player, plugin);
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, syncronous);
|
||||
ProcessSyncronousPasswordRegister sync = new ProcessSyncronousPasswordRegister(player, plugin);
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, sync);
|
||||
}
|
||||
}
|
||||
|
@ -139,11 +139,11 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
|
||||
if (Settings.useWelcomeMessage)
|
||||
if (Settings.broadcastWelcomeMessage) {
|
||||
for (String s : Settings.welcomeMsg) {
|
||||
plugin.getServer().broadcastMessage(plugin.replaceAllInfos(s, player));
|
||||
plugin.getServer().broadcastMessage(plugin.replaceAllInfo(s, player));
|
||||
}
|
||||
} else {
|
||||
for (String s : Settings.welcomeMsg) {
|
||||
player.sendMessage(plugin.replaceAllInfos(s, player));
|
||||
player.sendMessage(plugin.replaceAllInfo(s, player));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ import java.security.NoSuchAlgorithmException;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class AsyncronousUnregister {
|
||||
public class AsynchronousUnregister {
|
||||
|
||||
protected Player player;
|
||||
protected String name;
|
||||
@ -33,14 +33,14 @@ public class AsyncronousUnregister {
|
||||
private JsonCache playerCache;
|
||||
|
||||
/**
|
||||
* Constructor for AsyncronousUnregister.
|
||||
* Constructor for AsynchronousUnregister.
|
||||
*
|
||||
* @param player Player
|
||||
* @param password String
|
||||
* @param force boolean
|
||||
* @param plugin AuthMe
|
||||
*/
|
||||
public AsyncronousUnregister(Player player, String password,
|
||||
public AsynchronousUnregister(Player player, String password,
|
||||
boolean force, AuthMe plugin) {
|
||||
this.player = player;
|
||||
this.password = password;
|
||||
@ -75,12 +75,12 @@ public class AsyncronousUnregister {
|
||||
LimboCache.getInstance().addLimboPlayer(player);
|
||||
int delay = Settings.getRegistrationTimeout * 20;
|
||||
int interval = Settings.getWarnMessageInterval;
|
||||
BukkitScheduler sched = plugin.getServer().getScheduler();
|
||||
BukkitScheduler scheduler = plugin.getServer().getScheduler();
|
||||
if (delay != 0) {
|
||||
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), delay);
|
||||
BukkitTask id = scheduler.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), delay);
|
||||
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
|
||||
}
|
||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval)));
|
||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(scheduler.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval)));
|
||||
m.send(player, "unregistered");
|
||||
ConsoleLogger.info(player.getDisplayName() + " unregistered himself");
|
||||
return;
|
@ -153,11 +153,11 @@ public class PasswordSecurity {
|
||||
*/
|
||||
public static boolean comparePasswordWithHash(String password, String hash,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
HashAlgorithm algo = Settings.getPasswordHash;
|
||||
HashAlgorithm algorithm = Settings.getPasswordHash;
|
||||
EncryptionMethod method;
|
||||
try {
|
||||
if (algo != HashAlgorithm.CUSTOM)
|
||||
method = (EncryptionMethod) algo.getclasse().newInstance();
|
||||
if (algorithm != HashAlgorithm.CUSTOM)
|
||||
method = (EncryptionMethod) algorithm.getclasse().newInstance();
|
||||
else
|
||||
method = null;
|
||||
|
||||
|
@ -45,10 +45,10 @@ public class ChangePasswordTask implements Runnable {
|
||||
Messages m = Messages.getInstance();
|
||||
try {
|
||||
String name = player.getName().toLowerCase();
|
||||
String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, newPassword, name);
|
||||
String hashNew = PasswordSecurity.getHash(Settings.getPasswordHash, newPassword, name);
|
||||
PlayerAuth auth = PlayerCache.getInstance().getAuth(name);
|
||||
if (PasswordSecurity.comparePasswordWithHash(oldPassword, auth.getHash(), player.getName())) {
|
||||
auth.setHash(hashnew);
|
||||
auth.setHash(hashNew);
|
||||
if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null) {
|
||||
auth.setSalt(PasswordSecurity.userSalt.get(name));
|
||||
} else {
|
||||
|
@ -45,7 +45,7 @@ public class UtilsTest {
|
||||
.thenReturn(mock(BukkitTask.class));
|
||||
}
|
||||
|
||||
// TODO ljacques 20151122: The tests for Utils.forceGM somehow can't be set up with the mocks correctly
|
||||
// TODO ljacqu 20151122: The tests for Utils.forceGM somehow can't be set up with the mocks correctly
|
||||
/*@Test
|
||||
public void shouldForceSurvivalGameMode() {
|
||||
// given
|
||||
|
Loading…
Reference in New Issue
Block a user