Fixed various spelling and grammar issues

This commit is contained in:
Tim Visée 2015-11-23 22:07:32 +01:00
parent c3fa8b272f
commit 47b1d00ccf
24 changed files with 265 additions and 268 deletions

View File

@ -4,4 +4,4 @@
<w>authme</w> <w>authme</w>
</words> </words>
</dictionary> </dictionary>
</component> </component>

View File

@ -246,7 +246,7 @@ public class AuthMe extends JavaPlugin {
// Check Essentials // Check Essentials
checkEssentials(); 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 // inventory protection
checkProtocolLib(); checkProtocolLib();
// End of Hooks // End of Hooks
@ -277,8 +277,8 @@ public class AuthMe extends JavaPlugin {
// Set up the management // Set up the management
management = new Management(this); management = new Management(this);
// Set up the Bungeecord hook // Set up the BungeeCord hook
setupBungeecordHook(); setupBungeeCordHook();
// Reload support hook // Reload support hook
reloadSupportHook(); 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) { if (Settings.bungee) {
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord"); Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
Bukkit.getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeCordMessage(this)); 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() { private void setupAntiBotDelay() {
if (Settings.enableAntiBot) { if (Settings.enableAntiBot) {
@ -652,7 +652,7 @@ public class AuthMe extends JavaPlugin {
try { try {
ess = (Essentials) server.getPluginManager().getPlugin("Essentials"); ess = (Essentials) server.getPluginManager().getPlugin("Essentials");
ConsoleLogger.info("Hooked correctly with Essentials"); ConsoleLogger.info("Hooked correctly with Essentials");
} catch (Exception | NoClassDefFoundError ingnored) { } catch (Exception | NoClassDefFoundError ignored) {
ess = null; ess = null;
} }
} else { } else {
@ -677,7 +677,7 @@ public class AuthMe extends JavaPlugin {
try { try {
combatTagPlus = (CombatTagPlus) server.getPluginManager().getPlugin("CombatTagPlus"); combatTagPlus = (CombatTagPlus) server.getPluginManager().getPlugin("CombatTagPlus");
ConsoleLogger.info("Hooked correctly with CombatTagPlus"); ConsoleLogger.info("Hooked correctly with CombatTagPlus");
} catch (Exception | NoClassDefFoundError ingnored) { } catch (Exception | NoClassDefFoundError ignored) {
combatTagPlus = null; combatTagPlus = null;
} }
} else { } else {
@ -855,7 +855,7 @@ public class AuthMe extends JavaPlugin {
}, 1, 1200 * Settings.delayRecall); }, 1, 1200 * Settings.delayRecall);
} }
public String replaceAllInfos(String message, Player player) { public String replaceAllInfo(String message, Player player) {
int playersOnline = Utils.getOnlinePlayers().size(); int playersOnline = Utils.getOnlinePlayers().size();
message = message.replace("&", "\u00a7"); message = message.replace("&", "\u00a7");
message = message.replace("{PLAYER}", player.getName()); 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()); sUrl = sUrl.replace("%IP%", player.getAddress().getAddress().getHostAddress()).replace("%PORT%", "" + player.getAddress().getPort());
try { try {
URL url = new URL(sUrl); URL url = new URL(sUrl);
URLConnection urlc = url.openConnection(); URLConnection urlCon = url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(urlc.getInputStream())); BufferedReader in = new BufferedReader(new InputStreamReader(urlCon.getInputStream()));
String inputLine = in.readLine(); String inputLine = in.readLine();
if (inputLine != null && !inputLine.isEmpty() && !inputLine.equalsIgnoreCase("error") && !inputLine.contains("error")) { if (inputLine != null && !inputLine.isEmpty() && !inputLine.equalsIgnoreCase("error") && !inputLine.contains("error")) {
realIP = inputLine; realIP = inputLine;

View File

@ -33,10 +33,10 @@ public class NewAPI {
/** /**
* Constructor for NewAPI. * Constructor for NewAPI.
* *
* @param serv Server * @param server Server
*/ */
public NewAPI(Server serv) { public NewAPI(Server server) {
this.plugin = (AuthMe) serv.getPluginManager().getPlugin("AuthMe"); this.plugin = (AuthMe) server.getPluginManager().getPlugin("AuthMe");
} }
/** /**

View File

@ -586,7 +586,7 @@ public class CommandDescription {
* *
* @return True if this command has any child labels. * @return True if this command has any child labels.
*/ */
public boolean hasChilds() { public boolean hasChildren() {
return (this.children.size() != 0); return (this.children.size() != 0);
} }

View File

@ -49,15 +49,15 @@ public class vAuthFileReader {
String password = line.split(": ")[1]; String password = line.split(": ")[1];
PlayerAuth auth; PlayerAuth auth;
if (isUUIDinstance(password)) { if (isUUIDinstance(password)) {
String pname; String playerName;
try { try {
pname = Bukkit.getOfflinePlayer(UUID.fromString(name)).getName(); playerName = Bukkit.getOfflinePlayer(UUID.fromString(name)).getName();
} catch (Exception | NoSuchMethodError e) { } catch (Exception | NoSuchMethodError e) {
pname = getName(UUID.fromString(name)); playerName = getName(UUID.fromString(name));
} }
if (pname == null) if (playerName == null)
continue; 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 { } else {
auth = new PlayerAuth(name.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com", name); auth = new PlayerAuth(name.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com", name);
} }

View File

@ -64,7 +64,7 @@ public class xAuthToFlat {
database.saveAuth(auth); database.saveAuth(auth);
} }
} }
sender.sendMessage("[AuthMe] Successfull convert from xAuth database"); sender.sendMessage("[AuthMe] Successfully convert from xAuth database");
} catch (Exception e) { } 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 "); sender.sendMessage("[AuthMe] An error has been thrown while import xAuth database, the import hadn't fail but can be not complete ");
} }

View File

@ -520,21 +520,21 @@ public class CacheDataSource implements DataSource {
/** /**
* Method updateName. * Method updateName.
* *
* @param oldone String * @param oldOne String
* @param newone String * @param newOne String
* *
* @see fr.xephi.authme.datasource.DataSource#updateName(String, String) * @see fr.xephi.authme.datasource.DataSource#updateName(String, String)
*/ */
@Override @Override
public void updateName(final String oldone, final String newone) { public void updateName(final String oldOne, final String newOne) {
if (cache.containsKey(oldone)) { if (cache.containsKey(oldOne)) {
cache.put(newone, cache.get(oldone)); cache.put(newOne, cache.get(oldOne));
cache.remove(oldone); cache.remove(oldOne);
} }
exec.execute(new Runnable() { exec.execute(new Runnable() {
@Override @Override
public void run() { public void run() {
source.updateName(oldone, newone); source.updateName(oldOne, newOne);
} }
}); });
} }

View File

@ -196,10 +196,10 @@ public interface DataSource {
/** /**
* Method updateName. * Method updateName.
* *
* @param oldone String * @param oldOne String
* @param newone String * @param newOne String
*/ */
void updateName(String oldone, String newone); void updateName(String oldOne, String newOne);
/** /**
* Method getAllAuths. * Method getAllAuths.
@ -215,12 +215,9 @@ public interface DataSource {
*/ */
List<PlayerAuth> getLoggedPlayers(); List<PlayerAuth> getLoggedPlayers();
/**
*/
enum DataSourceType { enum DataSourceType {
MYSQL, MYSQL,
FILE, FILE,
SQLITE SQLITE
} }
} }

View File

@ -460,16 +460,16 @@ public class DatabaseCalls implements DataSource {
/** /**
* Method updateName. * Method updateName.
* *
* @param oldone String * @param oldOne String
* @param newone String * @param newOne String
* *
* @see fr.xephi.authme.datasource.DataSource#updateName(String, String) * @see fr.xephi.authme.datasource.DataSource#updateName(String, String)
*/ */
@Override @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() { exec.execute(new Runnable() {
public synchronized void run() { public synchronized void run() {
database.updateName(oldone, newone); database.updateName(oldOne, newOne);
} }
}); });
} }

View File

@ -851,17 +851,17 @@ public class FlatFile implements DataSource {
/** /**
* Method updateName. * Method updateName.
* *
* @param oldone String * @param oldOne String
* @param newone String * @param newOne String
* *
* @see fr.xephi.authme.datasource.DataSource#updateName(String, String) * @see fr.xephi.authme.datasource.DataSource#updateName(String, String)
*/ */
@Override @Override
public void updateName(String oldone, String newone) { public void updateName(String oldOne, String newOne) {
PlayerAuth auth = this.getAuth(oldone); PlayerAuth auth = this.getAuth(oldOne);
auth.setName(newone); auth.setName(newOne);
this.saveAuth(auth); this.saveAuth(auth);
this.removeAuth(oldone); this.removeAuth(oldOne);
} }
/** /**

View File

@ -1149,21 +1149,21 @@ public class MySQL implements DataSource {
/** /**
* Method updateName. * Method updateName.
* *
* @param oldone String * @param oldOne String
* @param newone String * @param newOne String
* *
* @see fr.xephi.authme.datasource.DataSource#updateName(String, String) * @see fr.xephi.authme.datasource.DataSource#updateName(String, String)
*/ */
@Override @Override
public void updateName(String oldone, String newone) { public void updateName(String oldOne, String newOne) {
Connection con = null; Connection con = null;
PreparedStatement pst = null; PreparedStatement pst = null;
try { try {
if ((con = getConnection()) == null) if ((con = getConnection()) == null)
return; return;
pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnName + "=? WHERE LOWER(" + columnName + ")=?;"); pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnName + "=? WHERE LOWER(" + columnName + ")=?;");
pst.setString(1, newone); pst.setString(1, newOne);
pst.setString(2, oldone); pst.setString(2, oldOne);
pst.executeUpdate(); pst.executeUpdate();
} catch (Exception ex) { } catch (Exception ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());

View File

@ -764,18 +764,18 @@ public class SQLite implements DataSource {
/** /**
* Method updateName. * Method updateName.
* *
* @param oldone String * @param oldOne String
* @param newone String * @param newOne String
* *
* @see fr.xephi.authme.datasource.DataSource#updateName(String, String) * @see fr.xephi.authme.datasource.DataSource#updateName(String, String)
*/ */
@Override @Override
public void updateName(String oldone, String newone) { public void updateName(String oldOne, String newOne) {
PreparedStatement pst = null; PreparedStatement pst = null;
try { try {
pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnName + "=? WHERE " + columnName + "=?;"); pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnName + "=? WHERE " + columnName + "=?;");
pst.setString(1, newone); pst.setString(1, newOne);
pst.setString(2, oldone); pst.setString(2, oldOne);
pst.executeUpdate(); pst.executeUpdate();
} catch (SQLException ex) { } catch (SQLException ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());

View File

@ -1,166 +1,166 @@
package fr.xephi.authme.process; package fr.xephi.authme.process;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.process.email.AsyncChangeEmail; import fr.xephi.authme.process.email.AsyncChangeEmail;
import fr.xephi.authme.process.join.AsyncronousJoin; import fr.xephi.authme.process.join.AsynchronousJoin;
import fr.xephi.authme.process.login.AsyncronousLogin; import fr.xephi.authme.process.login.AsynchronousLogin;
import fr.xephi.authme.process.logout.AsyncronousLogout; import fr.xephi.authme.process.logout.AsynchronousLogout;
import fr.xephi.authme.process.quit.AsyncronousQuit; import fr.xephi.authme.process.quit.AsynchronousQuit;
import fr.xephi.authme.process.register.AsyncRegister; 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.security.RandomString;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitScheduler;
/** /**
* @author Gabriele * @author Gabriele
* @version $Revision: 1.0 $ * @version $Revision: 1.0 $
*/ */
public class Management { public class Management {
public static RandomString rdm = new RandomString(Settings.captchaLength); public static RandomString rdm = new RandomString(Settings.captchaLength);
private final AuthMe plugin; private final AuthMe plugin;
private final BukkitScheduler sched; private final BukkitScheduler sched;
/** /**
* Constructor for Management. * Constructor for Management.
* *
* @param plugin AuthMe * @param plugin AuthMe
*/ */
public Management(AuthMe plugin) { public Management(AuthMe plugin) {
this.plugin = plugin; this.plugin = plugin;
this.sched = this.plugin.getServer().getScheduler(); this.sched = this.plugin.getServer().getScheduler();
} }
/** /**
* Method performLogin. * Method performLogin.
* *
* @param player Player * @param player Player
* @param password String * @param password String
* @param forceLogin boolean * @param forceLogin boolean
*/ */
public void performLogin(final Player player, final String password, final boolean forceLogin) { public void performLogin(final Player player, final String password, final boolean forceLogin) {
sched.runTaskAsynchronously(plugin, new Runnable() { sched.runTaskAsynchronously(plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
new AsyncronousLogin(player, password, forceLogin, plugin, plugin.database).process(); new AsynchronousLogin(player, password, forceLogin, plugin, plugin.database).process();
} }
}); });
} }
/** /**
* Method performLogout. * Method performLogout.
* *
* @param player Player * @param player Player
*/ */
public void performLogout(final Player player) { public void performLogout(final Player player) {
sched.runTaskAsynchronously(plugin, new Runnable() { sched.runTaskAsynchronously(plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
new AsyncronousLogout(player, plugin, plugin.database).process(); new AsynchronousLogout(player, plugin, plugin.database).process();
} }
}); });
} }
/** /**
* Method performRegister. * Method performRegister.
* *
* @param player Player * @param player Player
* @param password String * @param password String
* @param email String * @param email String
*/ */
public void performRegister(final Player player, final String password, final String email) { public void performRegister(final Player player, final String password, final String email) {
sched.runTaskAsynchronously(plugin, new Runnable() { sched.runTaskAsynchronously(plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
new AsyncRegister(player, password, email, plugin, plugin.database).process(); new AsyncRegister(player, password, email, plugin, plugin.database).process();
} }
}); });
} }
/** /**
* Method performUnregister. * Method performUnregister.
* *
* @param player Player * @param player Player
* @param password String * @param password String
* @param force boolean * @param force boolean
*/ */
public void performUnregister(final Player player, final String password, final boolean force) { public void performUnregister(final Player player, final String password, final boolean force) {
sched.runTaskAsynchronously(plugin, new Runnable() { sched.runTaskAsynchronously(plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
new AsyncronousUnregister(player, password, force, plugin).process(); new AsynchronousUnregister(player, password, force, plugin).process();
} }
}); });
} }
/** /**
* Method performJoin. * Method performJoin.
* *
* @param player Player * @param player Player
*/ */
public void performJoin(final Player player) { public void performJoin(final Player player) {
sched.runTaskAsynchronously(plugin, new Runnable() { sched.runTaskAsynchronously(plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
new AsyncronousJoin(player, plugin, plugin.database).process(); new AsynchronousJoin(player, plugin, plugin.database).process();
} }
}); });
} }
/** /**
* Method performQuit. * Method performQuit.
* *
* @param player Player * @param player Player
* @param isKick boolean * @param isKick boolean
*/ */
public void performQuit(final Player player, final boolean isKick) { public void performQuit(final Player player, final boolean isKick) {
sched.runTaskAsynchronously(plugin, new Runnable() { sched.runTaskAsynchronously(plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
new AsyncronousQuit(player, plugin, plugin.database, isKick).process(); new AsynchronousQuit(player, plugin, plugin.database, isKick).process();
} }
}); });
} }
/** /**
* Method performAddEmail. * Method performAddEmail.
* *
* @param player Player * @param player Player
* @param newEmail String * @param newEmail String
* @param newEmailVerify String * @param newEmailVerify String
*/ */
public void performAddEmail(final Player player, final String newEmail, final String newEmailVerify) { public void performAddEmail(final Player player, final String newEmail, final String newEmailVerify) {
sched.runTaskAsynchronously(plugin, new Runnable() { sched.runTaskAsynchronously(plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
new AsyncChangeEmail(player, plugin, null, newEmail, newEmailVerify).process(); new AsyncChangeEmail(player, plugin, null, newEmail, newEmailVerify).process();
} }
}); });
} }
/** /**
* Method performChangeEmail. * Method performChangeEmail.
* *
* @param player Player * @param player Player
* @param oldEmail String * @param oldEmail String
* @param newEmail String * @param newEmail String
*/ */
public void performChangeEmail(final Player player, final String oldEmail, final String newEmail) { public void performChangeEmail(final Player player, final String oldEmail, final String newEmail) {
sched.runTaskAsynchronously(plugin, new Runnable() { sched.runTaskAsynchronously(plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
new AsyncChangeEmail(player, plugin, oldEmail, newEmail).process(); new AsyncChangeEmail(player, plugin, oldEmail, newEmail).process();
} }
}); });
} }
} }

View File

@ -29,7 +29,7 @@ import org.bukkit.scheduler.BukkitTask;
/** /**
*/ */
public class AsyncronousJoin { public class AsynchronousJoin {
private final AuthMe plugin; private final AuthMe plugin;
private final Player player; private final Player player;
@ -39,13 +39,13 @@ public class AsyncronousJoin {
private final BukkitScheduler sched; private final BukkitScheduler sched;
/** /**
* Constructor for AsyncronousJoin. * Constructor for AsynchronousJoin.
* *
* @param player Player * @param player Player
* @param plugin AuthMe * @param plugin AuthMe
* @param database DataSource * @param database DataSource
*/ */
public AsyncronousJoin(Player player, AuthMe plugin, DataSource database) { public AsynchronousJoin(Player player, AuthMe plugin, DataSource database) {
this.player = player; this.player = player;
this.plugin = plugin; this.plugin = plugin;
this.sched = plugin.getServer().getScheduler(); this.sched = plugin.getServer().getScheduler();
@ -261,10 +261,10 @@ public class AsyncronousJoin {
private boolean needFirstSpawn() { private boolean needFirstSpawn() {
if (player.hasPlayedBefore()) if (player.hasPlayedBefore())
return false; return false;
Location firstspawn = Spawn.getInstance().getFirstSpawn(); Location firstSpawn = Spawn.getInstance().getFirstSpawn();
if (firstspawn == null || firstspawn.getWorld() == null) if (firstSpawn == null || firstSpawn.getWorld() == null)
return false; return false;
FirstSpawnTeleportEvent tpEvent = new FirstSpawnTeleportEvent(player, player.getLocation(), firstspawn); FirstSpawnTeleportEvent tpEvent = new FirstSpawnTeleportEvent(player, player.getLocation(), firstSpawn);
plugin.getServer().getPluginManager().callEvent(tpEvent); plugin.getServer().getPluginManager().callEvent(tpEvent);
if (!tpEvent.isCancelled()) { if (!tpEvent.isCancelled()) {
if (player.isOnline() && tpEvent.getTo() != null && tpEvent.getTo().getWorld() != null) { if (player.isOnline() && tpEvent.getTo() != null && tpEvent.getTo().getWorld() != null) {

View File

@ -23,7 +23,7 @@ import java.util.List;
/** /**
*/ */
public class AsyncronousLogin { public class AsynchronousLogin {
private static RandomString rdm = new RandomString(Settings.captchaLength); private static RandomString rdm = new RandomString(Settings.captchaLength);
protected Player player; protected Player player;
@ -36,7 +36,7 @@ public class AsyncronousLogin {
private Messages m = Messages.getInstance(); private Messages m = Messages.getInstance();
/** /**
* Constructor for AsyncronousLogin. * Constructor for AsynchronousLogin.
* *
* @param player Player * @param player Player
* @param password String * @param password String
@ -44,8 +44,8 @@ public class AsyncronousLogin {
* @param plugin AuthMe * @param plugin AuthMe
* @param data DataSource * @param data DataSource
*/ */
public AsyncronousLogin(Player player, String password, boolean forceLogin, public AsynchronousLogin(Player player, String password, boolean forceLogin,
AuthMe plugin, DataSource data) { AuthMe plugin, DataSource data) {
this.player = player; this.player = player;
this.password = password; this.password = password;
name = player.getName().toLowerCase(); name = player.getName().toLowerCase();

View File

@ -194,11 +194,11 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
if (Settings.useWelcomeMessage) if (Settings.useWelcomeMessage)
if (Settings.broadcastWelcomeMessage) { if (Settings.broadcastWelcomeMessage) {
for (String s : Settings.welcomeMsg) { for (String s : Settings.welcomeMsg) {
Bukkit.getServer().broadcastMessage(plugin.replaceAllInfos(s, player)); Bukkit.getServer().broadcastMessage(plugin.replaceAllInfo(s, player));
} }
} else { } else {
for (String s : Settings.welcomeMsg) { for (String s : Settings.welcomeMsg) {
player.sendMessage(plugin.replaceAllInfos(s, player)); player.sendMessage(plugin.replaceAllInfo(s, player));
} }
} }

View File

@ -13,7 +13,7 @@ import org.bukkit.scheduler.BukkitScheduler;
/** /**
*/ */
public class AsyncronousLogout { public class AsynchronousLogout {
protected Player player; protected Player player;
protected String name; protected String name;
@ -23,14 +23,14 @@ public class AsyncronousLogout {
private Messages m = Messages.getInstance(); private Messages m = Messages.getInstance();
/** /**
* Constructor for AsyncronousLogout. * Constructor for AsynchronousLogout.
* *
* @param player Player * @param player Player
* @param plugin AuthMe * @param plugin AuthMe
* @param database DataSource * @param database DataSource
*/ */
public AsyncronousLogout(Player player, AuthMe plugin, public AsynchronousLogout(Player player, AuthMe plugin,
DataSource database) { DataSource database) {
this.player = player; this.player = player;
this.plugin = plugin; this.plugin = plugin;
this.database = database; this.database = database;
@ -49,7 +49,7 @@ public class AsyncronousLogout {
if (!canLogout) if (!canLogout)
return; return;
final Player p = player; final Player p = player;
BukkitScheduler sched = p.getServer().getScheduler(); BukkitScheduler scheduler = p.getServer().getScheduler();
PlayerAuth auth = PlayerCache.getInstance().getAuth(name); PlayerAuth auth = PlayerCache.getInstance().getAuth(name);
database.updateSession(auth); database.updateSession(auth);
auth.setQuitLocX(p.getLocation().getX()); auth.setQuitLocX(p.getLocation().getX());
@ -60,7 +60,7 @@ public class AsyncronousLogout {
PlayerCache.getInstance().removePlayer(name); PlayerCache.getInstance().removePlayer(name);
database.setUnlogged(name); database.setUnlogged(name);
sched.scheduleSyncDelayedTask(plugin, new Runnable() { scheduler.scheduleSyncDelayedTask(plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
Utils.teleportToSpawn(p); Utils.teleportToSpawn(p);
@ -71,6 +71,6 @@ public class AsyncronousLogout {
LimboCache.getInstance().addLimboPlayer(player); LimboCache.getInstance().addLimboPlayer(player);
Utils.setGroup(player, GroupType.NOTLOGGEDIN); Utils.setGroup(player, GroupType.NOTLOGGEDIN);
sched.scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerLogout(p, plugin)); scheduler.scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerLogout(p, plugin));
} }
} }

View File

@ -16,7 +16,7 @@ import org.bukkit.scheduler.BukkitTask;
/** /**
*/ */
public class AsyncronousQuit { public class AsynchronousQuit {
protected AuthMe plugin; protected AuthMe plugin;
protected DataSource database; protected DataSource database;
@ -28,15 +28,15 @@ public class AsyncronousQuit {
private boolean isKick = false; private boolean isKick = false;
/** /**
* Constructor for AsyncronousQuit. * Constructor for AsynchronousQuit.
* *
* @param p Player * @param p Player
* @param plugin AuthMe * @param plugin AuthMe
* @param database DataSource * @param database DataSource
* @param isKick boolean * @param isKick boolean
*/ */
public AsyncronousQuit(Player p, AuthMe plugin, DataSource database, public AsynchronousQuit(Player p, AuthMe plugin, DataSource database,
boolean isKick) { boolean isKick) {
this.player = p; this.player = p;
this.plugin = plugin; this.plugin = plugin;
this.database = database; this.database = database;

View File

@ -59,17 +59,17 @@ public class AsyncRegister {
* @return boolean * @throws Exception * @return boolean * @throws Exception
*/ */
protected boolean preRegisterCheck() throws Exception { protected boolean preRegisterCheck() throws Exception {
String lowpass = password.toLowerCase(); String passLow = password.toLowerCase();
if (PlayerCache.getInstance().isAuthenticated(name)) { if (PlayerCache.getInstance().isAuthenticated(name)) {
m.send(player, "logged_in"); m.send(player, "logged_in");
return false; return false;
} else if (!Settings.isRegistrationEnabled) { } else if (!Settings.isRegistrationEnabled) {
m.send(player, "reg_disabled"); m.send(player, "reg_disabled");
return false; 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"); m.send(player, "password_error");
return false; return false;
} else if (lowpass.equalsIgnoreCase(player.getName())) { } else if (passLow.equalsIgnoreCase(player.getName())) {
m.send(player, "password_error_nick"); m.send(player, "password_error_nick");
return false; return false;
} else if (password.length() < Settings.getPasswordMinLen || password.length() > Settings.passwordMaxLength) { } else if (password.length() < Settings.getPasswordMinLen || password.length() > Settings.passwordMaxLength) {
@ -125,8 +125,8 @@ public class AsyncRegister {
} }
} }
PlayerAuth auth; PlayerAuth auth;
final String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, password, name); 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()); 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)) { if (PasswordSecurity.userSalt.containsKey(name)) {
auth.setSalt(PasswordSecurity.userSalt.get(name)); auth.setSalt(PasswordSecurity.userSalt.get(name));
} }
@ -134,8 +134,8 @@ public class AsyncRegister {
database.updateEmail(auth); database.updateEmail(auth);
database.updateSession(auth); database.updateSession(auth);
plugin.mail.main(auth, password); plugin.mail.main(auth, password);
ProcessSyncEmailRegister syncronous = new ProcessSyncEmailRegister(player, plugin); ProcessSyncEmailRegister sync = new ProcessSyncEmailRegister(player, plugin);
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, syncronous); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, sync);
} }
@ -163,7 +163,7 @@ public class AsyncRegister {
database.setLogged(name); database.setLogged(name);
} }
plugin.otherAccounts.addPlayer(player.getUniqueId()); plugin.otherAccounts.addPlayer(player.getUniqueId());
ProcessSyncronousPasswordRegister syncronous = new ProcessSyncronousPasswordRegister(player, plugin); ProcessSyncronousPasswordRegister sync = new ProcessSyncronousPasswordRegister(player, plugin);
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, syncronous); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, sync);
} }
} }

View File

@ -139,11 +139,11 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
if (Settings.useWelcomeMessage) if (Settings.useWelcomeMessage)
if (Settings.broadcastWelcomeMessage) { if (Settings.broadcastWelcomeMessage) {
for (String s : Settings.welcomeMsg) { for (String s : Settings.welcomeMsg) {
plugin.getServer().broadcastMessage(plugin.replaceAllInfos(s, player)); plugin.getServer().broadcastMessage(plugin.replaceAllInfo(s, player));
} }
} else { } else {
for (String s : Settings.welcomeMsg) { for (String s : Settings.welcomeMsg) {
player.sendMessage(plugin.replaceAllInfos(s, player)); player.sendMessage(plugin.replaceAllInfo(s, player));
} }
} }

View File

@ -22,7 +22,7 @@ import java.security.NoSuchAlgorithmException;
/** /**
*/ */
public class AsyncronousUnregister { public class AsynchronousUnregister {
protected Player player; protected Player player;
protected String name; protected String name;
@ -33,15 +33,15 @@ public class AsyncronousUnregister {
private JsonCache playerCache; private JsonCache playerCache;
/** /**
* Constructor for AsyncronousUnregister. * Constructor for AsynchronousUnregister.
* *
* @param player Player * @param player Player
* @param password String * @param password String
* @param force boolean * @param force boolean
* @param plugin AuthMe * @param plugin AuthMe
*/ */
public AsyncronousUnregister(Player player, String password, public AsynchronousUnregister(Player player, String password,
boolean force, AuthMe plugin) { boolean force, AuthMe plugin) {
this.player = player; this.player = player;
this.password = password; this.password = password;
this.force = force; this.force = force;
@ -75,12 +75,12 @@ public class AsyncronousUnregister {
LimboCache.getInstance().addLimboPlayer(player); LimboCache.getInstance().addLimboPlayer(player);
int delay = Settings.getRegistrationTimeout * 20; int delay = Settings.getRegistrationTimeout * 20;
int interval = Settings.getWarnMessageInterval; int interval = Settings.getWarnMessageInterval;
BukkitScheduler sched = plugin.getServer().getScheduler(); BukkitScheduler scheduler = plugin.getServer().getScheduler();
if (delay != 0) { 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).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"); m.send(player, "unregistered");
ConsoleLogger.info(player.getDisplayName() + " unregistered himself"); ConsoleLogger.info(player.getDisplayName() + " unregistered himself");
return; return;

View File

@ -153,11 +153,11 @@ public class PasswordSecurity {
*/ */
public static boolean comparePasswordWithHash(String password, String hash, public static boolean comparePasswordWithHash(String password, String hash,
String playerName) throws NoSuchAlgorithmException { String playerName) throws NoSuchAlgorithmException {
HashAlgorithm algo = Settings.getPasswordHash; HashAlgorithm algorithm = Settings.getPasswordHash;
EncryptionMethod method; EncryptionMethod method;
try { try {
if (algo != HashAlgorithm.CUSTOM) if (algorithm != HashAlgorithm.CUSTOM)
method = (EncryptionMethod) algo.getclasse().newInstance(); method = (EncryptionMethod) algorithm.getclasse().newInstance();
else else
method = null; method = null;

View File

@ -45,10 +45,10 @@ public class ChangePasswordTask implements Runnable {
Messages m = Messages.getInstance(); Messages m = Messages.getInstance();
try { try {
String name = player.getName().toLowerCase(); 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); PlayerAuth auth = PlayerCache.getInstance().getAuth(name);
if (PasswordSecurity.comparePasswordWithHash(oldPassword, auth.getHash(), player.getName())) { if (PasswordSecurity.comparePasswordWithHash(oldPassword, auth.getHash(), player.getName())) {
auth.setHash(hashnew); auth.setHash(hashNew);
if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null) { if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null) {
auth.setSalt(PasswordSecurity.userSalt.get(name)); auth.setSalt(PasswordSecurity.userSalt.get(name));
} else { } else {

View File

@ -45,7 +45,7 @@ public class UtilsTest {
.thenReturn(mock(BukkitTask.class)); .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 /*@Test
public void shouldForceSurvivalGameMode() { public void shouldForceSurvivalGameMode() {
// given // given