Merge pull request #9 from Xephi/master

Up
This commit is contained in:
Gabriele C. 2015-07-20 09:48:30 +02:00
commit bbff450225
22 changed files with 98 additions and 129 deletions

View File

@ -39,7 +39,7 @@ public class SendMailSSL {
public void main(final PlayerAuth auth, final String newPass) {
String sendername;
if (Settings.getmailSenderName.isEmpty() || Settings.getmailSenderName == null) {
if (Settings.getmailSenderName == null || Settings.getmailSenderName.isEmpty()) {
sendername = Settings.getmailAccount;
} else {
sendername = Settings.getmailSenderName;

View File

@ -31,11 +31,14 @@ public class API {
* @return AuthMe instance
*/
public static AuthMe hookAuthMe() {
if (instance != null)
return instance;
Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("AuthMe");
if (plugin == null || !(plugin instanceof AuthMe)) {
return null;
}
return (AuthMe) plugin;
instance = (AuthMe) plugin;
return instance;
}
public AuthMe getPlugin() {

View File

@ -4,7 +4,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class PlayerCache {
private static PlayerCache singleton = null;
private volatile static PlayerCache singleton = null;
private ConcurrentHashMap<String, PlayerAuth> cache;
private PlayerCache() {

View File

@ -546,9 +546,9 @@ public class FileCache {
file = new File("cache/" + player.getName().toLowerCase() + ".cache");
}
if (file.exists()) {
if (file.isDirectory()) {
if (file.isDirectory() && file.listFiles() != null) {
for (File f : file.listFiles()) {
if (f.isDirectory()) {
if (f.isDirectory() && f.listFiles() != null) {
for (File a : f.listFiles()) {
a.delete();
}

View File

@ -17,7 +17,7 @@ import fr.xephi.authme.settings.Settings;
public class LimboCache {
private static LimboCache singleton = null;
private volatile static LimboCache singleton = null;
public ConcurrentHashMap<String, LimboPlayer> cache;
private FileCache playerData;
public AuthMe plugin;

View File

@ -8,8 +8,6 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -20,7 +18,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitScheduler;
@ -85,13 +82,13 @@ public class AdminCommand implements CommandExecutor {
if ((sender instanceof ConsoleCommandSender) && args[0].equalsIgnoreCase("passpartutoken")) {
if (args.length > 1) {
System.out.println("[AuthMe] command usage: /authme passpartutoken");
ConsoleLogger.info("[AuthMe] command usage: /authme passpartutoken");
return true;
}
if (Utils.getInstance().obtainToken()) {
System.out.println("[AuthMe] You have 30s to insert this token ingame with /passpartu <token>");
ConsoleLogger.info("[AuthMe] You have 30s to insert this token ingame with /passpartu <token>");
} else {
System.out.println("[AuthMe] Security error on passpartu token, please redo the command.");
ConsoleLogger.info("[AuthMe] Security error on passpartu token, please redo the command.");
}
return true;
}
@ -144,7 +141,7 @@ public class AdminCommand implements CommandExecutor {
fos.write(buf, 0, i);
}
} catch (Exception e) {
Logger.getLogger(JavaPlugin.class.getName()).log(Level.SEVERE, "Failed to load config from JAR");
ConsoleLogger.showError("Failed to load config from JAR");
} finally {
try {
if (fis != null) {
@ -213,7 +210,7 @@ public class AdminCommand implements CommandExecutor {
return;
}
List<String> accountList = plugin.database.getAllAuthsByName(auth);
if (accountList.isEmpty() || accountList == null) {
if (accountList == null || accountList.isEmpty()) {
m.send(fSender, "user_unknown");
return;
}
@ -249,7 +246,7 @@ public class AdminCommand implements CommandExecutor {
return;
}
List<String> accountList = plugin.database.getAllAuthsByIp(arguments[1]);
if (accountList.isEmpty() || accountList == null) {
if (accountList == null || accountList.isEmpty()) {
fSender.sendMessage("[AuthMe] This IP does not exist in the database");
return;
}

View File

@ -121,7 +121,7 @@ public class EmailCommand implements CommandExecutor {
}
PlayerCache.getInstance().updatePlayer(auth);
m.send(player, "email_changed");
player.sendMessage(m.send("email_defined") + auth.getEmail());
player.sendMessage(m.send("email_defined").toString() + auth.getEmail());
} else if (PlayerCache.getInstance().isAuthenticated(name)) {
m.send(player, "email_confirm");
} else {

View File

@ -73,7 +73,7 @@ public class FlatToSql implements Converter {
else if (args.length == 9)
newline = "INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + "," + columnIp + "," + columnLastLogin + "," + lastlocX + "," + lastlocY + "," + lastlocZ + "," + lastlocWorld + "," + columnEmail + "," + columnLogged + ") VALUES ('" + args[0] + "', '" + args[1] + "', '" + args[2] + "', " + args[3] + ", " + args[4] + ", " + args[5] + ", " + args[6] + ", '" + args[7] + "', '" + args[8] + "', 0);";
else newline = "";
if (newline != "")
if (!newline.equals(""))
sql.write(newline);
}
sql.close();

View File

@ -86,7 +86,7 @@ public class FlatToSqlite implements Converter {
else if (args.length == 9)
newline = "INSERT INTO " + tableName + " VALUES (" + i + ", '" + args[0] + "', '" + args[1] + "', '" + args[2] + "', " + args[3] + ", " + args[4] + ", " + args[5] + ", " + args[6] + ", '" + args[7] + "', '" + args[8] + "');";
else newline = "";
if (newline != "")
if (!newline.equals(""))
saveAuth(newline);
i = i + 1;
}
@ -104,8 +104,8 @@ public class FlatToSqlite implements Converter {
return;
}
private synchronized static void connect() throws ClassNotFoundException,
SQLException {
private synchronized static void connect()
throws ClassNotFoundException, SQLException {
Class.forName("org.sqlite.JDBC");
ConsoleLogger.info("SQLite driver loaded");
con = DriverManager.getConnection("jdbc:sqlite:plugins/AuthMe/" + database + ".db");

View File

@ -152,8 +152,10 @@ public class FlatFile implements DataSource {
}
}
}
removeAuth(auth.getNickname());
saveAuth(newAuth);
if (newAuth != null) {
removeAuth(auth.getNickname());
saveAuth(newAuth);
}
return true;
}
@ -209,8 +211,10 @@ public class FlatFile implements DataSource {
}
}
}
removeAuth(auth.getNickname());
saveAuth(newAuth);
if (newAuth != null) {
removeAuth(auth.getNickname());
saveAuth(newAuth);
}
return true;
}
@ -245,8 +249,10 @@ public class FlatFile implements DataSource {
}
}
}
removeAuth(auth.getNickname());
saveAuth(newAuth);
if (newAuth != null) {
removeAuth(auth.getNickname());
saveAuth(newAuth);
}
return true;
}
@ -497,8 +503,10 @@ public class FlatFile implements DataSource {
}
}
}
removeAuth(auth.getNickname());
saveAuth(newAuth);
if (newAuth != null) {
removeAuth(auth.getNickname());
saveAuth(newAuth);
}
return true;
}

View File

@ -1,6 +1,5 @@
package fr.xephi.authme.events;
import org.bukkit.Server;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@ -13,7 +12,6 @@ public class CustomEvent extends Event implements Cancellable {
private boolean isCancelled;
private static final HandlerList handlers = new HandlerList();
private static Server s;
public HandlerList getHandlers() {
return handlers;
@ -31,8 +29,4 @@ public class CustomEvent extends Event implements Cancellable {
this.isCancelled = cancelled;
}
public static Server getServer() {
return s;
}
}

View File

@ -20,9 +20,9 @@ public class AuthMeBlockListener implements Listener {
this.instance = instance;
}
@EventHandler
@EventHandler(ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent event) {
if (event.isCancelled() || event.getPlayer() == null) {
if (event.getPlayer() == null) {
return;
}
@ -45,9 +45,9 @@ public class AuthMeBlockListener implements Listener {
event.setCancelled(true);
}
@EventHandler
@EventHandler(ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
if (event.isCancelled() || event.getPlayer() == null) {
if (event.getPlayer() == null) {
return;
}

View File

@ -21,9 +21,9 @@ public class AuthMeChestShopListener implements Listener {
this.plugin = plugin;
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPreTransaction(PreTransactionEvent event) {
if (event.isCancelled() || event.getClient() == null || event == null) {
if (event.getClient() == null) {
return;
}

View File

@ -26,11 +26,8 @@ public class AuthMeEntityListener implements Listener {
this.instance = instance;
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onEntityDamage(EntityDamageEvent event) {
if (event.isCancelled()) {
return;
}
Entity entity = event.getEntity();
if (!(entity instanceof Player)) {
@ -64,11 +61,8 @@ public class AuthMeEntityListener implements Listener {
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onEntityTarget(EntityTargetEvent event) {
if (event.isCancelled()) {
return;
}
if (event.getTarget() == null)
return;
Entity entity = event.getTarget();
@ -95,12 +89,8 @@ public class AuthMeEntityListener implements Listener {
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onDmg(EntityDamageByEntityEvent event) {
if (event.isCancelled()) {
return;
}
Entity entity = event.getDamager();
if (entity == null || !(entity instanceof Player)) {
@ -123,12 +113,8 @@ public class AuthMeEntityListener implements Listener {
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onFoodLevelChange(FoodLevelChangeEvent event) {
if (event.isCancelled()) {
return;
}
Entity entity = event.getEntity();
if (!(entity instanceof Player)) {
return;
@ -154,12 +140,8 @@ public class AuthMeEntityListener implements Listener {
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void EntityRegainHealthEvent(EntityRegainHealthEvent event) {
if (event.isCancelled()) {
return;
}
Entity entity = event.getEntity();
if (!(entity instanceof Player)) {
return;
@ -185,12 +167,8 @@ public class AuthMeEntityListener implements Listener {
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.HIGHEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onEntityInteract(EntityInteractEvent event) {
if (event.isCancelled() || event == null) {
return;
}
if (!(event.getEntity() instanceof Player)) {
return;
}
@ -217,12 +195,8 @@ public class AuthMeEntityListener implements Listener {
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onLowestEntityInteract(EntityInteractEvent event) {
if (event.isCancelled() || event == null) {
return;
}
if (!(event.getEntity() instanceof Player)) {
return;
}

View File

@ -60,9 +60,9 @@ public class AuthMePlayerListener implements Listener {
this.plugin = plugin;
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
if (event.isCancelled() || event.getPlayer() == null)
if (event.getPlayer() == null)
return;
Player player = event.getPlayer();
@ -94,9 +94,9 @@ public class AuthMePlayerListener implements Listener {
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.NORMAL)
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
public void onPlayerNormalChat(AsyncPlayerChatEvent event) {
if (event.isCancelled() || event.getPlayer() == null)
if (event.getPlayer() == null)
return;
final Player player = event.getPlayer();
@ -131,9 +131,9 @@ public class AuthMePlayerListener implements Listener {
}
}
@EventHandler(priority = EventPriority.HIGH)
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onPlayerHighChat(AsyncPlayerChatEvent event) {
if (event.isCancelled() || event.getPlayer() == null)
if (event.getPlayer() == null)
return;
final Player player = event.getPlayer();
@ -168,9 +168,9 @@ public class AuthMePlayerListener implements Listener {
}
}
@EventHandler(priority = EventPriority.MONITOR)
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerChat(AsyncPlayerChatEvent event) {
if (event.isCancelled() || event.getPlayer() == null)
if (event.getPlayer() == null)
return;
final Player player = event.getPlayer();
@ -205,9 +205,9 @@ public class AuthMePlayerListener implements Listener {
}
}
@EventHandler(priority = EventPriority.HIGHEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onPlayerHighestChat(AsyncPlayerChatEvent event) {
if (event.isCancelled() || event.getPlayer() == null)
if (event.getPlayer() == null)
return;
final Player player = event.getPlayer();
@ -242,9 +242,9 @@ public class AuthMePlayerListener implements Listener {
}
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPlayerEarlyChat(final AsyncPlayerChatEvent event) {
if (event.isCancelled() || event.getPlayer() == null)
if (event.getPlayer() == null)
return;
final Player player = event.getPlayer();
@ -280,9 +280,9 @@ public class AuthMePlayerListener implements Listener {
}
}
@EventHandler(priority = EventPriority.LOW)
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
public void onPlayerLowChat(AsyncPlayerChatEvent event) {
if (event.isCancelled() || event.getPlayer() == null)
if (event.getPlayer() == null)
return;
final Player player = event.getPlayer();
@ -315,9 +315,9 @@ public class AuthMePlayerListener implements Listener {
}
}
@EventHandler(priority = EventPriority.MONITOR)
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerMove(PlayerMoveEvent event) {
if (event.isCancelled() || event.getPlayer() == null) {
if (event.getPlayer() == null) {
return;
}
@ -574,14 +574,11 @@ public class AuthMePlayerListener implements Listener {
event.setQuitMessage(null);
}
@EventHandler(priority = EventPriority.MONITOR)
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerKick(PlayerKickEvent event) {
if (event.getPlayer() == null) {
return;
}
if (event.isCancelled()) {
return;
}
Player player = event.getPlayer();
@ -593,9 +590,9 @@ public class AuthMePlayerListener implements Listener {
plugin.management.performQuit(player, true);
}
@EventHandler(priority = EventPriority.HIGHEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
if (event.isCancelled() || event.getPlayer() == null) {
if (event.getPlayer() == null) {
return;
}
@ -622,9 +619,9 @@ public class AuthMePlayerListener implements Listener {
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.isCancelled() || event.getPlayer() == null)
if (event.getPlayer() == null)
return;
Player player = event.getPlayer();
@ -652,9 +649,9 @@ public class AuthMePlayerListener implements Listener {
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPlayerInventoryOpen(InventoryOpenEvent event) {
if (event.isCancelled() || event.getPlayer() == null)
if (event.getPlayer() == null)
return;
Player player = (Player) event.getPlayer();
String name = player.getName().toLowerCase();
@ -679,9 +676,9 @@ public class AuthMePlayerListener implements Listener {
player.closeInventory();
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPlayerInventoryClick(InventoryClickEvent event) {
if (event.isCancelled() || event.getWhoClicked() == null)
if (event.getWhoClicked() == null)
return;
if (!(event.getWhoClicked() instanceof Player))
return;
@ -708,9 +705,9 @@ public class AuthMePlayerListener implements Listener {
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
if (event.isCancelled() || event.getPlayer() == null) {
if (event.getPlayer() == null) {
return;
}
@ -733,9 +730,9 @@ public class AuthMePlayerListener implements Listener {
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPlayerDropItem(PlayerDropItemEvent event) {
if (event.isCancelled() || event.getPlayer() == null) {
if (event.getPlayer() == null) {
return;
}
Player player = event.getPlayer();
@ -760,9 +757,9 @@ public class AuthMePlayerListener implements Listener {
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPlayerBedEnter(PlayerBedEnterEvent event) {
if (event.isCancelled() || event.getPlayer() == null) {
if (event.getPlayer() == null) {
return;
}
Player player = event.getPlayer();
@ -784,9 +781,9 @@ public class AuthMePlayerListener implements Listener {
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onSignChange(SignChangeEvent event) {
if (event.isCancelled() || event.getPlayer() == null || event == null) {
if (event.getPlayer() == null) {
return;
}
Player player = event.getPlayer();
@ -807,7 +804,7 @@ public class AuthMePlayerListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerRespawn(PlayerRespawnEvent event) {
if (event.getPlayer() == null || event == null) {
if (event.getPlayer() == null) {
return;
}
@ -839,11 +836,9 @@ public class AuthMePlayerListener implements Listener {
event.setRespawnLocation(spawn);
}
@EventHandler(priority = EventPriority.HIGHEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {
if (event.isCancelled())
return;
if (event.getPlayer() == null || event == null)
if (event.getPlayer() == null)
return;
Player player = event.getPlayer();

View File

@ -28,7 +28,7 @@ public class EssSpawn extends CustomConfiguration {
try {
if (!this.contains("spawns.default.world"))
return null;
if (this.getString("spawns.default.world").isEmpty() || this.getString("spawns.default.world") == "")
if (this.getString("spawns.default.world").isEmpty() || this.getString("spawns.default.world").equals(""))
return null;
Location location = new Location(Bukkit.getWorld(this.getString("spawns.default.world")), this.getDouble("spawns.default.x"), this.getDouble("spawns.default.y"), this.getDouble("spawns.default.z"), Float.parseFloat(this.getString("spawns.default.yaw")), Float.parseFloat(this.getString("spawns.default.pitch")));
return location;

View File

@ -209,7 +209,7 @@ public class AsyncronousLogin {
List<String> auths = this.database.getAllAuthsByName(auth);
// List<String> uuidlist =
// plugin.otherAccounts.getAllPlayersByUUID(player.getUniqueId());
if (auths.isEmpty() || auths == null) {
if (auths.isEmpty()) {
return;
}
if (auths.size() == 1) {

View File

@ -94,7 +94,7 @@ public class AsyncronousRegister {
preRegister();
if (!allowRegister)
return;
if (!email.isEmpty() && email != "") {
if (!email.isEmpty() && !email.equals("")) {
if (Settings.getmaxRegPerEmail > 0) {
if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) {
m.send(player, "max_reg");

View File

@ -14,7 +14,6 @@
package fr.xephi.authme.security.crypts;
import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
@ -141,7 +140,7 @@ public class BCRYPT implements EncryptionMethod {
* @return the decoded value of x
*/
private static byte char64(char x) {
if ((int) x < 0 || (int) x > index_64.length)
if ((int) x > index_64.length)
return -1;
return index_64[(int) x];
}

View File

@ -14,7 +14,7 @@ public class CryptPBKDF2 implements EncryptionMethod {
PBKDF2Parameters params = new PBKDF2Parameters("HmacSHA256", "ASCII", salt.getBytes(), 10000);
PBKDF2Engine engine = new PBKDF2Engine(params);
return result + engine.deriveKey(password, 64).toString();
return result + String.valueOf(engine.deriveKey(password, 64));
}
@Override

View File

@ -60,9 +60,9 @@ import java.security.SecureRandom;
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* </p>
* <p>
* For Details, see <a
* href="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html"
* >http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html</a>.
* For Details, see
* <a href="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html" >http://www.
* gnu.org/licenses/old-licenses/lgpl-2.1.html</a>.
* </p>
*
* @see <a href="http://tools.ietf.org/html/rfc2898">RFC 2898</a>
@ -319,8 +319,8 @@ public class PBKDF2Engine implements PBKDF2 {
* @throws IOException
* @throws NoSuchAlgorithmException
*/
public static void main(String[] args) throws IOException,
NoSuchAlgorithmException {
public static void main(String[] args)
throws IOException, NoSuchAlgorithmException {
String password = "password";
String candidate = null;
PBKDF2Formatter formatter = new PBKDF2HexFormatter();
@ -341,7 +341,6 @@ public class PBKDF2Engine implements PBKDF2 {
PBKDF2Engine e = new PBKDF2Engine(p);
p.setDerivedKey(e.deriveKey(password));
candidate = formatter.toString(p);
System.out.println(candidate);
} else {
// Verification mode
PBKDF2Parameters p = new PBKDF2Parameters();
@ -352,7 +351,6 @@ public class PBKDF2Engine implements PBKDF2 {
}
PBKDF2Engine e = new PBKDF2Engine(p);
boolean verifyOK = e.verifyKey(password);
System.out.println(verifyOK ? "OK" : "FAIL");
System.exit(verifyOK ? 0 : 1);
}
}

View File

@ -1,6 +1,7 @@
package fr.xephi.authme.settings;
import java.io.File;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -85,7 +86,7 @@ public class Spawn extends CustomConfiguration {
public Location getSpawn() {
try {
if (this.getString("spawn.world").isEmpty() || this.getString("spawn.world") == "")
if (this.getString("spawn.world").isEmpty() || this.getString("spawn.world").equals(""))
return null;
Location location = new Location(Bukkit.getWorld(this.getString("spawn.world")), this.getDouble("spawn.x"), this.getDouble("spawn.y"), this.getDouble("spawn.z"), Float.parseFloat(this.getString("spawn.yaw")), Float.parseFloat(this.getString("spawn.pitch")));
return location;
@ -98,7 +99,7 @@ public class Spawn extends CustomConfiguration {
public Location getFirstSpawn() {
try {
if (this.getString("firstspawn.world").isEmpty() || this.getString("firstspawn.world") == "")
if (this.getString("firstspawn.world").isEmpty() || this.getString("firstspawn.world").equals(""))
return null;
Location location = new Location(Bukkit.getWorld(this.getString("firstspawn.world")), this.getDouble("firstspawn.x"), this.getDouble("firstspawn.y"), this.getDouble("firstspawn.z"), Float.parseFloat(this.getString("firstspawn.yaw")), Float.parseFloat(this.getString("firstspawn.pitch")));
return location;