Update 3.2
//Changes 3.2:// * Fix Password showed in console ( support for Log4J ) * Quit Location will be more precise ( now double instead of int ) * Force command after the /register too * Close inventory when player try to open one unlogged * Fix old password supports * Remove some Magic Values ( 1.7.2+ ) * Fix threads not start correctly * Add a recall email adding message * Fix catpcha messages * Add multilines messages ( add &n ) * Fix some inventory problem * Fix some events problem * Call login event after /register
This commit is contained in:
parent
93a320c8ae
commit
5127d5e70a
4
pom.xml
4
pom.xml
@ -24,11 +24,11 @@
|
|||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<version>3.1.2-DEV-3</version>
|
<version>3.2</version>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>craftbukkit</artifactId>
|
||||||
<version>1.7.2-R0.2</version>
|
<version>1.7.2-R0.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@ -11,10 +11,12 @@ import java.util.Date;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.logging.Logger;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
import com.earth2me.essentials.Essentials;
|
import com.earth2me.essentials.Essentials;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@ -81,6 +83,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
private Messages m;
|
private Messages m;
|
||||||
private PlayersLogs pllog;
|
private PlayersLogs pllog;
|
||||||
public static Server server;
|
public static Server server;
|
||||||
|
public static Logger authmeLogger = Logger.getLogger("AuthMe");
|
||||||
public static Plugin authme;
|
public static Plugin authme;
|
||||||
public static Permission permission;
|
public static Permission permission;
|
||||||
private static AuthMe instance;
|
private static AuthMe instance;
|
||||||
@ -107,11 +110,17 @@ public class AuthMe extends JavaPlugin {
|
|||||||
public boolean antibotMod = false;
|
public boolean antibotMod = false;
|
||||||
public boolean delayedAntiBot = true;
|
public boolean delayedAntiBot = true;
|
||||||
|
|
||||||
|
public Settings getSettings() {
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
instance = this;
|
instance = this;
|
||||||
authme = instance;
|
authme = instance;
|
||||||
|
|
||||||
|
authmeLogger.setParent(this.getLogger());
|
||||||
|
|
||||||
citizens = new CitizensCommunicator(this);
|
citizens = new CitizensCommunicator(this);
|
||||||
|
|
||||||
settings = new Settings(this);
|
settings = new Settings(this);
|
||||||
@ -135,14 +144,15 @@ public class AuthMe extends JavaPlugin {
|
|||||||
|
|
||||||
//Set Console Filter
|
//Set Console Filter
|
||||||
if (Settings.removePassword) {
|
if (Settings.removePassword) {
|
||||||
|
this.getLogger().setFilter(new ConsoleFilter());
|
||||||
Bukkit.getLogger().setFilter(new ConsoleFilter());
|
Bukkit.getLogger().setFilter(new ConsoleFilter());
|
||||||
/*// Check the log4j usage and apply a filter
|
Logger.getLogger("Minecraft").setFilter(new ConsoleFilter());
|
||||||
|
Logger.getLogger("AuthMe").setFilter(new ConsoleFilter());
|
||||||
try {
|
try {
|
||||||
if (Class.forName("org.apache.logging.log4j.LogManager") != null) {
|
org.apache.logging.log4j.core.Logger coreLogger = (org.apache.logging.log4j.core.Logger) LogManager.getRootLogger();
|
||||||
|
coreLogger.addFilter(new Log4JFilter());
|
||||||
}
|
} catch (Exception e) {
|
||||||
} catch (Exception e) {}
|
} catch (NoClassDefFoundError e) {}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Load MailApi
|
//Load MailApi
|
||||||
|
|||||||
@ -15,11 +15,11 @@ import fr.xephi.authme.settings.Settings;
|
|||||||
|
|
||||||
public class ConsoleLogger {
|
public class ConsoleLogger {
|
||||||
|
|
||||||
private static final Logger log = Logger.getLogger("Minecraft");
|
private static final Logger log = Logger.getLogger("AuthMe");
|
||||||
|
|
||||||
public static void info(String message) {
|
public static void info(String message) {
|
||||||
if (AuthMe.getInstance().isEnabled()) {
|
if (AuthMe.getInstance().isEnabled()) {
|
||||||
log.info("[AuthMe] " + message);
|
log.info(message);
|
||||||
if (Settings.useLogging) {
|
if (Settings.useLogging) {
|
||||||
Calendar date = Calendar.getInstance();
|
Calendar date = Calendar.getInstance();
|
||||||
final String actually = "[" + DateFormat.getDateInstance().format(date.getTime()) + ", " + date.get(Calendar.HOUR_OF_DAY) + ":" + date.get(Calendar.MINUTE) + ":" + date.get(Calendar.SECOND) + "] " + message;
|
final String actually = "[" + DateFormat.getDateInstance().format(date.getTime()) + ", " + date.get(Calendar.HOUR_OF_DAY) + ":" + date.get(Calendar.MINUTE) + ":" + date.get(Calendar.SECOND) + "] " + message;
|
||||||
@ -35,7 +35,7 @@ public class ConsoleLogger {
|
|||||||
|
|
||||||
public static void showError(String message) {
|
public static void showError(String message) {
|
||||||
if (AuthMe.getInstance().isEnabled()) {
|
if (AuthMe.getInstance().isEnabled()) {
|
||||||
log.severe("[AuthMe] ERROR: " + message);
|
log.severe(" ERROR: " + message);
|
||||||
if (Settings.useLogging) {
|
if (Settings.useLogging) {
|
||||||
Calendar date = Calendar.getInstance();
|
Calendar date = Calendar.getInstance();
|
||||||
final String actually = "[" + DateFormat.getDateInstance().format(date.getTime()) + ", " + date.get(Calendar.HOUR_OF_DAY) + ":" + date.get(Calendar.MINUTE) + ":" + date.get(Calendar.SECOND) + "] ERROR : " + message;
|
final String actually = "[" + DateFormat.getDateInstance().format(date.getTime()) + ", " + date.get(Calendar.HOUR_OF_DAY) + ":" + date.get(Calendar.MINUTE) + ":" + date.get(Calendar.SECOND) + "] ERROR : " + message;
|
||||||
|
|||||||
104
src/main/java/fr/xephi/authme/Log4JFilter.java
Normal file
104
src/main/java/fr/xephi/authme/Log4JFilter.java
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
package fr.xephi.authme;
|
||||||
|
|
||||||
|
import java.util.logging.LogRecord;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.Level;
|
||||||
|
import org.apache.logging.log4j.Marker;
|
||||||
|
import org.apache.logging.log4j.core.LogEvent;
|
||||||
|
import org.apache.logging.log4j.core.Logger;
|
||||||
|
import org.apache.logging.log4j.message.Message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Xephi59
|
||||||
|
*/
|
||||||
|
public class Log4JFilter implements java.util.logging.Filter, org.apache.logging.log4j.core.Filter {
|
||||||
|
|
||||||
|
public Log4JFilter() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isLoggable(LogRecord record) {
|
||||||
|
try {
|
||||||
|
if (record == null || record.getMessage() == null) return true;
|
||||||
|
String logM = record.getMessage().toLowerCase();
|
||||||
|
if (!logM.contains("issued server command:")) return true;
|
||||||
|
if (!logM.contains("/login ") && !logM.contains("/l ") && !logM.contains("/reg ") && !logM.contains("/changepassword ") && !logM.contains("/unregister ")
|
||||||
|
&& !logM.contains("/authme register ") && !logM.contains("/authme changepassword ")&& !logM.contains("/authme reg ")&& !logM.contains("/authme cp ") && !logM.contains("/register ")) return true;
|
||||||
|
String playername = record.getMessage().split(" ")[0];
|
||||||
|
record.setMessage(playername + " issued an AuthMe command!");
|
||||||
|
return true;
|
||||||
|
} catch (NullPointerException npe) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result filter(LogEvent record) {
|
||||||
|
try {
|
||||||
|
if (record == null || record.getMessage() == null) return Result.NEUTRAL;
|
||||||
|
String logM = record.getMessage().getFormattedMessage().toLowerCase();
|
||||||
|
if (!logM.contains("issued server command:")) return Result.NEUTRAL;
|
||||||
|
if (!logM.contains("/login ") && !logM.contains("/l ") && !logM.contains("/reg ") && !logM.contains("/changepassword ") && !logM.contains("/unregister ")
|
||||||
|
&& !logM.contains("/authme register ") && !logM.contains("/authme changepassword ")&& !logM.contains("/authme reg ")&& !logM.contains("/authme cp ") && !logM.contains("/register ")) return Result.NEUTRAL;
|
||||||
|
return Result.DENY;
|
||||||
|
} catch (NullPointerException npe) {
|
||||||
|
return Result.NEUTRAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result filter(Logger arg0, Level arg1, Marker arg2, String message,
|
||||||
|
Object... arg4) {
|
||||||
|
try {
|
||||||
|
if (message == null) return Result.NEUTRAL;
|
||||||
|
String logM = message.toLowerCase();
|
||||||
|
if (!logM.contains("issued server command:")) return Result.NEUTRAL;
|
||||||
|
if (!logM.contains("/login ") && !logM.contains("/l ") && !logM.contains("/reg ") && !logM.contains("/changepassword ") && !logM.contains("/unregister ")
|
||||||
|
&& !logM.contains("/authme register ") && !logM.contains("/authme changepassword ")&& !logM.contains("/authme reg ")&& !logM.contains("/authme cp ") && !logM.contains("/register ")) return Result.NEUTRAL;
|
||||||
|
return Result.DENY;
|
||||||
|
} catch (NullPointerException npe) {
|
||||||
|
return Result.NEUTRAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result filter(Logger arg0, Level arg1, Marker arg2, Object message,
|
||||||
|
Throwable arg4) {
|
||||||
|
try {
|
||||||
|
if (message == null) return Result.NEUTRAL;
|
||||||
|
String logM = message.toString().toLowerCase();
|
||||||
|
if (!logM.contains("issued server command:")) return Result.NEUTRAL;
|
||||||
|
if (!logM.contains("/login ") && !logM.contains("/l ") && !logM.contains("/reg ") && !logM.contains("/changepassword ") && !logM.contains("/unregister ")
|
||||||
|
&& !logM.contains("/authme register ") && !logM.contains("/authme changepassword ")&& !logM.contains("/authme reg ")&& !logM.contains("/authme cp ") && !logM.contains("/register ")) return Result.NEUTRAL;
|
||||||
|
return Result.DENY;
|
||||||
|
} catch (NullPointerException npe) {
|
||||||
|
return Result.NEUTRAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result filter(Logger arg0, Level arg1, Marker arg2, Message message,
|
||||||
|
Throwable arg4) {
|
||||||
|
try {
|
||||||
|
if (message == null) return Result.NEUTRAL;
|
||||||
|
String logM = message.getFormattedMessage().toLowerCase();
|
||||||
|
if (!logM.contains("issued server command:")) return Result.NEUTRAL;
|
||||||
|
if (!logM.contains("/login ") && !logM.contains("/l ") && !logM.contains("/reg ") && !logM.contains("/changepassword ") && !logM.contains("/unregister ")
|
||||||
|
&& !logM.contains("/authme register ") && !logM.contains("/authme changepassword ")&& !logM.contains("/authme reg ")&& !logM.contains("/authme cp ") && !logM.contains("/register ")) return Result.NEUTRAL;
|
||||||
|
return Result.DENY;
|
||||||
|
} catch (NullPointerException npe) {
|
||||||
|
return Result.NEUTRAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result getOnMatch() {
|
||||||
|
return Result.NEUTRAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result getOnMismatch() {
|
||||||
|
return Result.NEUTRAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -13,7 +13,6 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import fr.xephi.authme.api.API;
|
import fr.xephi.authme.api.API;
|
||||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
|
||||||
import fr.xephi.authme.events.AuthMeTeleportEvent;
|
import fr.xephi.authme.events.AuthMeTeleportEvent;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
|
|
||||||
@ -100,7 +99,7 @@ public class Utils {
|
|||||||
} return false;
|
} return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void packCoords(int x, int y, int z, String w, final Player pl)
|
public void packCoords(double x, double y, double z, String w, final Player pl)
|
||||||
{
|
{
|
||||||
World theWorld;
|
World theWorld;
|
||||||
if (w.equals("unavailableworld")) {
|
if (w.equals("unavailableworld")) {
|
||||||
@ -111,14 +110,12 @@ public class Utils {
|
|||||||
if (theWorld == null)
|
if (theWorld == null)
|
||||||
theWorld = pl.getWorld();
|
theWorld = pl.getWorld();
|
||||||
final World world = theWorld;
|
final World world = theWorld;
|
||||||
final int fY = y;
|
final Location locat = new Location(world, x, y, z);
|
||||||
final Location locat = new Location(world, x, y + 0.4D, z);
|
|
||||||
final Location loc = locat.getBlock().getLocation();
|
|
||||||
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(AuthMe.getInstance(), new Runnable() {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(AuthMe.getInstance(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(pl, loc);
|
AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(pl, locat);
|
||||||
AuthMe.getInstance().getServer().getPluginManager().callEvent(tpEvent);
|
AuthMe.getInstance().getServer().getPluginManager().callEvent(tpEvent);
|
||||||
if(!tpEvent.isCancelled()) {
|
if(!tpEvent.isCancelled()) {
|
||||||
if (!tpEvent.getTo().getChunk().isLoaded())
|
if (!tpEvent.getTo().getChunk().isLoaded())
|
||||||
@ -127,29 +124,6 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!PlayerCache.getInstance().isAuthenticated(pl.getName().toLowerCase())) {
|
|
||||||
id = Bukkit.getScheduler().scheduleSyncRepeatingTask(AuthMe.getInstance(), new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (!PlayerCache.getInstance().isAuthenticated(pl.getName().toLowerCase())) {
|
|
||||||
int current = (int)pl.getLocation().getY();
|
|
||||||
World currentWorld = pl.getWorld();
|
|
||||||
if (current != fY && world.getName() == currentWorld.getName()) {
|
|
||||||
pl.teleport(loc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 1L, 20L);
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(AuthMe.getInstance(), new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Bukkit.getScheduler().cancelTask(id);
|
|
||||||
}
|
|
||||||
}, 60L);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -9,9 +9,9 @@ public class PlayerAuth {
|
|||||||
private String hash = "";
|
private String hash = "";
|
||||||
private String ip = "198.18.0.1";
|
private String ip = "198.18.0.1";
|
||||||
private long lastLogin = 0;
|
private long lastLogin = 0;
|
||||||
private int x = 0;
|
private double x = 0;
|
||||||
private int y = 0;
|
private double y = 0;
|
||||||
private int z = 0;
|
private double z = 0;
|
||||||
private String world = "world";
|
private String world = "world";
|
||||||
private String salt = "";
|
private String salt = "";
|
||||||
private String vBhash = null;
|
private String vBhash = null;
|
||||||
@ -28,7 +28,7 @@ public class PlayerAuth {
|
|||||||
this.realName = realName;
|
this.realName = realName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerAuth(String nickname, int x, int y, int z, String world) {
|
public PlayerAuth(String nickname, double x, double y, double z, String world) {
|
||||||
this.nickname = nickname;
|
this.nickname = nickname;
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
@ -36,7 +36,7 @@ public class PlayerAuth {
|
|||||||
this.world = world;
|
this.world = world;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerAuth(String nickname, String hash, String ip, long lastLogin, int x, int y, int z, String world, String email, String realName) {
|
public PlayerAuth(String nickname, String hash, String ip, long lastLogin, double x, double y, double z, String world, String email, String realName) {
|
||||||
this.nickname = nickname;
|
this.nickname = nickname;
|
||||||
this.hash = hash;
|
this.hash = hash;
|
||||||
this.ip = ip;
|
this.ip = ip;
|
||||||
@ -49,7 +49,7 @@ public class PlayerAuth {
|
|||||||
this.realName = realName;
|
this.realName = realName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerAuth(String nickname, String hash, String salt, int groupId, String ip, long lastLogin, int x, int y, int z, String world, String email, String realName) {
|
public PlayerAuth(String nickname, String hash, String salt, int groupId, String ip, long lastLogin, double x, double y, double z, String world, String email, String realName) {
|
||||||
this.nickname = nickname;
|
this.nickname = nickname;
|
||||||
this.hash = hash;
|
this.hash = hash;
|
||||||
this.ip = ip;
|
this.ip = ip;
|
||||||
@ -83,7 +83,7 @@ public class PlayerAuth {
|
|||||||
this.realName = realName;
|
this.realName = realName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerAuth(String nickname, String hash, String salt, String ip, long lastLogin, int x, int y, int z, String world, String email, String realName) {
|
public PlayerAuth(String nickname, String hash, String salt, String ip, long lastLogin, double x, double y, double z, String world, String email, String realName) {
|
||||||
this.nickname = nickname;
|
this.nickname = nickname;
|
||||||
this.hash = hash;
|
this.hash = hash;
|
||||||
this.ip = ip;
|
this.ip = ip;
|
||||||
@ -123,26 +123,26 @@ public class PlayerAuth {
|
|||||||
return groupId;
|
return groupId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getQuitLocX() {
|
public double getQuitLocX() {
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
public int getQuitLocY() {
|
public double getQuitLocY() {
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
public int getQuitLocZ() {
|
public double getQuitLocZ() {
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
public String getEmail() {
|
public String getEmail() {
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
public void setQuitLocX(int x) {
|
public void setQuitLocX(double d) {
|
||||||
this.x = x;
|
this.x = d;
|
||||||
}
|
}
|
||||||
public void setQuitLocY(int y) {
|
public void setQuitLocY(double d) {
|
||||||
this.y = y;
|
this.y = d;
|
||||||
}
|
}
|
||||||
public void setQuitLocZ(int z) {
|
public void setQuitLocZ(double d) {
|
||||||
this.z = z;
|
this.z = d;
|
||||||
}
|
}
|
||||||
public long getLastLogin() {
|
public long getLastLogin() {
|
||||||
return lastLogin;
|
return lastLogin;
|
||||||
|
|||||||
@ -49,12 +49,12 @@ public class FileCache {
|
|||||||
|
|
||||||
for (int i = 0; i < invstack.length; i++) {
|
for (int i = 0; i < invstack.length; i++) {
|
||||||
|
|
||||||
int itemid = 0;
|
String itemid = "AIR";
|
||||||
int amount = 0;
|
int amount = 0;
|
||||||
int durability = 0;
|
int durability = 0;
|
||||||
String enchList = "";
|
String enchList = "";
|
||||||
if (invstack[i] != null) {
|
if (invstack[i] != null) {
|
||||||
itemid = invstack[i].getTypeId();
|
itemid = invstack[i].getType().name();
|
||||||
amount = invstack[i].getAmount();
|
amount = invstack[i].getAmount();
|
||||||
durability = invstack[i].getDurability();
|
durability = invstack[i].getDurability();
|
||||||
for(Enchantment e : invstack[i].getEnchantments().keySet()) {
|
for(Enchantment e : invstack[i].getEnchantments().keySet()) {
|
||||||
@ -69,12 +69,12 @@ public class FileCache {
|
|||||||
ItemStack[] armorstack = playerData.getArmour();
|
ItemStack[] armorstack = playerData.getArmour();
|
||||||
|
|
||||||
for (int i = 0; i < armorstack.length; i++) {
|
for (int i = 0; i < armorstack.length; i++) {
|
||||||
int itemid = 0;
|
String itemid = "AIR";
|
||||||
int amount = 0;
|
int amount = 0;
|
||||||
int durability = 0;
|
int durability = 0;
|
||||||
String enchList = "";
|
String enchList = "";
|
||||||
if (armorstack[i] != null) {
|
if (armorstack[i] != null) {
|
||||||
itemid = armorstack[i].getTypeId();
|
itemid = armorstack[i].getType().name();
|
||||||
amount = armorstack[i].getAmount();
|
amount = armorstack[i].getAmount();
|
||||||
durability = armorstack[i].getDurability();
|
durability = armorstack[i].getDurability();
|
||||||
for(Enchantment e : armorstack[i].getEnchantments().keySet()) {
|
for(Enchantment e : armorstack[i].getEnchantments().keySet()) {
|
||||||
@ -136,7 +136,7 @@ public class FileCache {
|
|||||||
}
|
}
|
||||||
// can enchant item? size ofstring in file - 4 all / 2 = number of enchant
|
// can enchant item? size ofstring in file - 4 all / 2 = number of enchant
|
||||||
if (in[0].equals("i")) {
|
if (in[0].equals("i")) {
|
||||||
stacki[i] = new ItemStack(Material.getMaterial(Integer.parseInt(in[1])),
|
stacki[i] = new ItemStack(Material.getMaterial(in[1]),
|
||||||
Integer.parseInt(in[2]), Short.parseShort((in[3])));
|
Integer.parseInt(in[2]), Short.parseShort((in[3])));
|
||||||
if(in.length > 4 && !in[4].isEmpty()) {
|
if(in.length > 4 && !in[4].isEmpty()) {
|
||||||
for(int k=4;k<in.length-1;k++) {
|
for(int k=4;k<in.length-1;k++) {
|
||||||
@ -146,7 +146,7 @@ public class FileCache {
|
|||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
} else {
|
} else {
|
||||||
stacka[a] = new ItemStack(Material.getMaterial(Integer.parseInt(in[1])),
|
stacka[a] = new ItemStack(Material.getMaterial(in[1]),
|
||||||
Integer.parseInt(in[2]), Short.parseShort((in[3])));
|
Integer.parseInt(in[2]), Short.parseShort((in[3])));
|
||||||
if(in.length > 4 && !in[4].isEmpty()) {
|
if(in.length > 4 && !in[4].isEmpty()) {
|
||||||
for(int k=4;k<in.length-1;k++) {
|
for(int k=4;k<in.length-1;k++) {
|
||||||
|
|||||||
@ -64,9 +64,9 @@ public class LogoutCommand implements CommandExecutor {
|
|||||||
PlayerAuth auth = PlayerCache.getInstance().getAuth(name);
|
PlayerAuth auth = PlayerCache.getInstance().getAuth(name);
|
||||||
auth.setIp("198.18.0.1");
|
auth.setIp("198.18.0.1");
|
||||||
database.updateSession(auth);
|
database.updateSession(auth);
|
||||||
auth.setQuitLocX(player.getLocation().getBlockX());
|
auth.setQuitLocX(player.getLocation().getX());
|
||||||
auth.setQuitLocY(player.getLocation().getBlockY());
|
auth.setQuitLocY(player.getLocation().getY());
|
||||||
auth.setQuitLocZ(player.getLocation().getBlockZ());
|
auth.setQuitLocZ(player.getLocation().getZ());
|
||||||
auth.setWorld(player.getWorld().getName());
|
auth.setWorld(player.getWorld().getName());
|
||||||
database.updateQuitLoc(auth);
|
database.updateQuitLoc(auth);
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import fr.xephi.authme.cache.auth.PlayerCache;
|
|||||||
import fr.xephi.authme.cache.limbo.LimboCache;
|
import fr.xephi.authme.cache.limbo.LimboCache;
|
||||||
import fr.xephi.authme.cache.limbo.LimboPlayer;
|
import fr.xephi.authme.cache.limbo.LimboPlayer;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
|
import fr.xephi.authme.events.LoginEvent;
|
||||||
import fr.xephi.authme.events.RegisterTeleportEvent;
|
import fr.xephi.authme.events.RegisterTeleportEvent;
|
||||||
import fr.xephi.authme.security.PasswordSecurity;
|
import fr.xephi.authme.security.PasswordSecurity;
|
||||||
import fr.xephi.authme.security.RandomString;
|
import fr.xephi.authme.security.RandomString;
|
||||||
@ -158,13 +159,13 @@ public class RegisterCommand implements CommandExecutor {
|
|||||||
int msgInterval = Settings.getWarnMessageInterval;
|
int msgInterval = Settings.getWarnMessageInterval;
|
||||||
if (time != 0) {
|
if (time != 0) {
|
||||||
Bukkit.getScheduler().cancelTask(LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId());
|
Bukkit.getScheduler().cancelTask(LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId());
|
||||||
BukkitTask id = Bukkit.getScheduler().runTaskLater(plugin, new TimeoutTask(plugin, name), time);
|
int id = Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new TimeoutTask(plugin, name), time);
|
||||||
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id.getTaskId());
|
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.getScheduler().cancelTask(LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId());
|
Bukkit.getScheduler().cancelTask(LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId());
|
||||||
BukkitTask nwMsg = Bukkit.getScheduler().runTask(plugin, new MessageTask(plugin, name, msg, msgInterval));
|
int nwMsg = Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new MessageTask(plugin, name, msg, msgInterval));
|
||||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(nwMsg.getTaskId());
|
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(nwMsg);
|
||||||
|
|
||||||
LimboCache.getInstance().deleteLimboPlayer(name);
|
LimboCache.getInstance().deleteLimboPlayer(name);
|
||||||
if (Settings.isTeleportToSpawnEnabled) {
|
if (Settings.isTeleportToSpawnEnabled) {
|
||||||
@ -256,7 +257,12 @@ public class RegisterCommand implements CommandExecutor {
|
|||||||
player.setAllowFlight(false);
|
player.setAllowFlight(false);
|
||||||
player.setFlying(false);
|
player.setFlying(false);
|
||||||
}
|
}
|
||||||
|
// The Loginevent now fires (as intended) after everything is processed
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player, true));
|
||||||
player.saveData();
|
player.saveData();
|
||||||
|
|
||||||
|
// Register is now finish , we can force all commands
|
||||||
|
forceCommands(player);
|
||||||
if (!Settings.noConsoleSpam)
|
if (!Settings.noConsoleSpam)
|
||||||
ConsoleLogger.info(player.getName() + " registered "+player.getAddress().getAddress().getHostAddress());
|
ConsoleLogger.info(player.getName() + " registered "+player.getAddress().getAddress().getHostAddress());
|
||||||
if(plugin.notifications != null) {
|
if(plugin.notifications != null) {
|
||||||
@ -268,4 +274,12 @@ public class RegisterCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void forceCommands(Player player) {
|
||||||
|
for (String command : Settings.forceCommands) {
|
||||||
|
try {
|
||||||
|
player.performCommand(command.replace("%p", player.getName()));
|
||||||
|
} catch (Exception e) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -107,19 +107,19 @@ public class FileDataSource implements DataSource {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 7: {
|
case 7: {
|
||||||
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), Integer.parseInt(args[4]), Integer.parseInt(args[5]), Integer.parseInt(args[6]), "world", "your@email.com", API.getPlayerRealName(args[0]));
|
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), "world", "your@email.com", API.getPlayerRealName(args[0]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 8: {
|
case 8: {
|
||||||
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), Integer.parseInt(args[4]), Integer.parseInt(args[5]), Integer.parseInt(args[6]), args[7], "your@email.com", API.getPlayerRealName(args[0]));
|
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], "your@email.com", API.getPlayerRealName(args[0]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 9: {
|
case 9: {
|
||||||
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), Integer.parseInt(args[4]), Integer.parseInt(args[5]), Integer.parseInt(args[6]), args[7], args[8], API.getPlayerRealName(args[0]));
|
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], args[8], API.getPlayerRealName(args[0]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], 0, 0, 0, 0, "world", "your@email.com", API.getPlayerRealName(args[0]));
|
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], 0, 0.0, 0.0, 0.0, "world", "your@email.com", API.getPlayerRealName(args[0]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -164,19 +164,19 @@ public class FileDataSource implements DataSource {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 7: {
|
case 7: {
|
||||||
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), Integer.parseInt(args[4]), Integer.parseInt(args[5]), Integer.parseInt(args[6]), "world", "your@email.com", API.getPlayerRealName(args[0]));
|
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), "world", "your@email.com", API.getPlayerRealName(args[0]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 8: {
|
case 8: {
|
||||||
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), Integer.parseInt(args[4]), Integer.parseInt(args[5]), Integer.parseInt(args[6]), args[7], "your@email.com", API.getPlayerRealName(args[0]));
|
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], "your@email.com", API.getPlayerRealName(args[0]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 9: {
|
case 9: {
|
||||||
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), Integer.parseInt(args[4]), Integer.parseInt(args[5]), Integer.parseInt(args[6]), args[7], args[8], API.getPlayerRealName(args[0]));
|
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], args[8], API.getPlayerRealName(args[0]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), 0, 0, 0, "world", "your@email.com", API.getPlayerRealName(args[0]));
|
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), 0.0, 0.0, 0.0, "world", "your@email.com", API.getPlayerRealName(args[0]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -423,11 +423,11 @@ public class FileDataSource implements DataSource {
|
|||||||
case 4:
|
case 4:
|
||||||
return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), "your@email.com", API.getPlayerRealName(args[0]));
|
return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), "your@email.com", API.getPlayerRealName(args[0]));
|
||||||
case 7:
|
case 7:
|
||||||
return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Integer.parseInt(args[4]), Integer.parseInt(args[5]), Integer.parseInt(args[6]), "unavailableworld", "your@email.com", API.getPlayerRealName(args[0]));
|
return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), "unavailableworld", "your@email.com", API.getPlayerRealName(args[0]));
|
||||||
case 8:
|
case 8:
|
||||||
return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Integer.parseInt(args[4]), Integer.parseInt(args[5]), Integer.parseInt(args[6]), args[7], "your@email.com", API.getPlayerRealName(args[0]));
|
return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], "your@email.com", API.getPlayerRealName(args[0]));
|
||||||
case 9:
|
case 9:
|
||||||
return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Integer.parseInt(args[4]), Integer.parseInt(args[5]), Integer.parseInt(args[6]), args[7], args[8], API.getPlayerRealName(args[0]));
|
return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], args[8], API.getPlayerRealName(args[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -469,7 +469,7 @@ public class FileDataSource implements DataSource {
|
|||||||
while ((line = br.readLine()) != null) {
|
while ((line = br.readLine()) != null) {
|
||||||
String[] args = line.split(":");
|
String[] args = line.split(":");
|
||||||
if (args[0].equals(auth.getNickname())) {
|
if (args[0].equals(auth.getNickname())) {
|
||||||
newAuth = new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Integer.parseInt(args[4]), Integer.parseInt(args[5]), Integer.parseInt(args[6]), args[7], auth.getEmail(), API.getPlayerRealName(args[0]));
|
newAuth = new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], auth.getEmail(), API.getPlayerRealName(args[0]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,9 +93,9 @@ public class MySQLDataSource implements DataSource {
|
|||||||
+ columnPassword + " VARCHAR(255) NOT NULL,"
|
+ columnPassword + " VARCHAR(255) NOT NULL,"
|
||||||
+ columnIp + " VARCHAR(40) NOT NULL,"
|
+ columnIp + " VARCHAR(40) NOT NULL,"
|
||||||
+ columnLastLogin + " BIGINT,"
|
+ columnLastLogin + " BIGINT,"
|
||||||
+ lastlocX + " smallint(6) DEFAULT '0',"
|
+ lastlocX + " DOUBLE NOT NULL DEFAULT '0.0',"
|
||||||
+ lastlocY + " smallint(6) DEFAULT '0',"
|
+ lastlocY + " DOUBLE NOT NULL DEFAULT '0.0',"
|
||||||
+ lastlocZ + " smallint(6) DEFAULT '0',"
|
+ lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0',"
|
||||||
+ lastlocWorld + " VARCHAR(255) DEFAULT 'world',"
|
+ lastlocWorld + " VARCHAR(255) DEFAULT 'world',"
|
||||||
+ columnEmail + " VARCHAR(255) DEFAULT 'your@email.com',"
|
+ columnEmail + " VARCHAR(255) DEFAULT 'your@email.com',"
|
||||||
+ "CONSTRAINT table_const_prim PRIMARY KEY (" + columnID + "));");
|
+ "CONSTRAINT table_const_prim PRIMARY KEY (" + columnID + "));");
|
||||||
@ -119,8 +119,8 @@ public class MySQLDataSource implements DataSource {
|
|||||||
rs.close();
|
rs.close();
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, lastlocX);
|
rs = con.getMetaData().getColumns(null, null, tableName, lastlocX);
|
||||||
if (!rs.next()) {
|
if (!rs.next()) {
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + lastlocX + " smallint(6) NOT NULL DEFAULT '0' AFTER "
|
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + lastlocX + " DOUBLE NOT NULL DEFAULT '0.0' AFTER "
|
||||||
+ columnLastLogin +" , ADD " + lastlocY + " smallint(6) NOT NULL DEFAULT '0' AFTER " + lastlocX + " , ADD " + lastlocZ + " smallint(6) NOT NULL DEFAULT '0' AFTER " + lastlocY + ";");
|
+ columnLastLogin +" , ADD " + lastlocY + " DOUBLE NOT NULL DEFAULT '0.0' AFTER " + lastlocX + " , ADD " + lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0' AFTER " + lastlocY + ";");
|
||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, lastlocWorld);
|
rs = con.getMetaData().getColumns(null, null, tableName, lastlocWorld);
|
||||||
@ -132,6 +132,11 @@ public class MySQLDataSource implements DataSource {
|
|||||||
if (!rs.next()) {
|
if (!rs.next()) {
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com' AFTER " + lastlocZ +";");
|
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com' AFTER " + lastlocZ +";");
|
||||||
}
|
}
|
||||||
|
rs.close();
|
||||||
|
rs = con.getMetaData().getColumns(null, null, tableName, lastlocX);
|
||||||
|
if (rs.next()) {
|
||||||
|
st.executeUpdate("ALTER TABLE " + tableName + " MODIFY " + lastlocX + " DOUBLE NOT NULL DEFAULT '0.0', MODIFY " + lastlocY + " DOUBLE NOT NULL DEFAULT '0.0', MODIFY " + lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0';");
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
close(rs);
|
close(rs);
|
||||||
close(st);
|
close(st);
|
||||||
@ -178,14 +183,14 @@ public class MySQLDataSource implements DataSource {
|
|||||||
rs = pst.executeQuery();
|
rs = pst.executeQuery();
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
if (rs.getString(columnIp).isEmpty() ) {
|
if (rs.getString(columnIp).isEmpty() ) {
|
||||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "198.18.0.1", rs.getLong(columnLastLogin), rs.getInt(lastlocX), rs.getInt(lastlocY), rs.getInt(lastlocZ), rs.getString(lastlocWorld),rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "198.18.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld),rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
||||||
} else {
|
} else {
|
||||||
if(!columnSalt.isEmpty()){
|
if(!columnSalt.isEmpty()){
|
||||||
if(!columnGroup.isEmpty())
|
if(!columnGroup.isEmpty())
|
||||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword),rs.getString(columnSalt), rs.getInt(columnGroup), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getInt(lastlocX), rs.getInt(lastlocY), rs.getInt(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword),rs.getString(columnSalt), rs.getInt(columnGroup), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
||||||
else return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword),rs.getString(columnSalt), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getInt(lastlocX), rs.getInt(lastlocY), rs.getInt(lastlocZ), rs.getString(lastlocWorld),rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
else return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword),rs.getString(columnSalt), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld),rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
||||||
} else {
|
} else {
|
||||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getInt(lastlocX), rs.getInt(lastlocY), rs.getInt(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -491,9 +496,9 @@ public class MySQLDataSource implements DataSource {
|
|||||||
try {
|
try {
|
||||||
con = makeSureConnectionIsReady();
|
con = makeSureConnectionIsReady();
|
||||||
pst = con.prepareStatement("UPDATE " + tableName + " SET "+ lastlocX + " =?, "+ lastlocY +"=?, "+ lastlocZ +"=?, " + lastlocWorld + "=? WHERE " + columnName + "=?;");
|
pst = con.prepareStatement("UPDATE " + tableName + " SET "+ lastlocX + " =?, "+ lastlocY +"=?, "+ lastlocZ +"=?, " + lastlocWorld + "=? WHERE " + columnName + "=?;");
|
||||||
pst.setLong(1, auth.getQuitLocX());
|
pst.setDouble(1, auth.getQuitLocX());
|
||||||
pst.setLong(2, auth.getQuitLocY());
|
pst.setDouble(2, auth.getQuitLocY());
|
||||||
pst.setLong(3, auth.getQuitLocZ());
|
pst.setDouble(3, auth.getQuitLocZ());
|
||||||
pst.setString(4, auth.getWorld());
|
pst.setString(4, auth.getWorld());
|
||||||
pst.setString(5, auth.getNickname());
|
pst.setString(5, auth.getNickname());
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
|
|||||||
@ -72,9 +72,9 @@ public class SqliteDataSource implements DataSource {
|
|||||||
+ columnPassword + " VARCHAR(255) NOT NULL,"
|
+ columnPassword + " VARCHAR(255) NOT NULL,"
|
||||||
+ columnIp + " VARCHAR(40) NOT NULL,"
|
+ columnIp + " VARCHAR(40) NOT NULL,"
|
||||||
+ columnLastLogin + " BIGINT,"
|
+ columnLastLogin + " BIGINT,"
|
||||||
+ lastlocX + " smallint(6) DEFAULT '0',"
|
+ lastlocX + " DOUBLE NOT NULL DEFAULT '0.0',"
|
||||||
+ lastlocY + " smallint(6) DEFAULT '0',"
|
+ lastlocY + " DOUBLE NOT NULL DEFAULT '0.0',"
|
||||||
+ lastlocZ + " smallint(6) DEFAULT '0',"
|
+ lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0',"
|
||||||
+ lastlocWorld + " VARCHAR(255) DEFAULT 'world',"
|
+ lastlocWorld + " VARCHAR(255) DEFAULT 'world',"
|
||||||
+ columnEmail + " VARCHAR(255) DEFAULT 'your@email.com',"
|
+ columnEmail + " VARCHAR(255) DEFAULT 'your@email.com',"
|
||||||
+ "CONSTRAINT table_const_prim PRIMARY KEY (" + columnID + "));");
|
+ "CONSTRAINT table_const_prim PRIMARY KEY (" + columnID + "));");
|
||||||
@ -98,9 +98,9 @@ public class SqliteDataSource implements DataSource {
|
|||||||
rs.close();
|
rs.close();
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, lastlocX);
|
rs = con.getMetaData().getColumns(null, null, tableName, lastlocX);
|
||||||
if (!rs.next()) {
|
if (!rs.next()) {
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + lastlocX + " smallint(6) NOT NULL DEFAULT '0'; "
|
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + lastlocX + " DOUBLE NOT NULL DEFAULT '0.0';");
|
||||||
+ "ALTER TABLE " + tableName + " ADD COLUMN " + lastlocY + " smallint(6) NOT NULL DEFAULT '0'; "
|
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + lastlocY + " DOUBLE NOT NULL DEFAULT '0.0';");
|
||||||
+ "ALTER TABLE " + tableName + " ADD COLUMN " + lastlocZ + " smallint(6) NOT NULL DEFAULT '0';");
|
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0';");
|
||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, lastlocWorld);
|
rs = con.getMetaData().getColumns(null, null, tableName, lastlocWorld);
|
||||||
@ -112,6 +112,13 @@ public class SqliteDataSource implements DataSource {
|
|||||||
if (!rs.next()) {
|
if (!rs.next()) {
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com';");
|
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com';");
|
||||||
}
|
}
|
||||||
|
rs.close();
|
||||||
|
rs = con.getMetaData().getColumns(null, null, tableName, lastlocX);
|
||||||
|
if (rs.next()) {
|
||||||
|
st.executeUpdate("ALTER TABLE " + tableName + " MODIFY " + lastlocX + " DOUBLE NOT NULL DEFAULT '0.0';");
|
||||||
|
st.executeUpdate("ALTER TABLE " + tableName + " MODIFY " + lastlocY + " DOUBLE NOT NULL DEFAULT '0.0';");
|
||||||
|
st.executeUpdate("ALTER TABLE " + tableName + " MODIFY " + lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0';");
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
close(rs);
|
close(rs);
|
||||||
close(st);
|
close(st);
|
||||||
@ -148,12 +155,12 @@ public class SqliteDataSource implements DataSource {
|
|||||||
rs = pst.executeQuery();
|
rs = pst.executeQuery();
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
if (rs.getString(columnIp).isEmpty() ) {
|
if (rs.getString(columnIp).isEmpty() ) {
|
||||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "198.18.0.1", rs.getLong(columnLastLogin), rs.getInt(lastlocX), rs.getInt(lastlocY), rs.getInt(lastlocZ), rs.getString(lastlocWorld) , rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "198.18.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld) , rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
||||||
} else {
|
} else {
|
||||||
if(!columnSalt.isEmpty()){
|
if(!columnSalt.isEmpty()){
|
||||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword),rs.getString(columnSalt), rs.getInt(columnGroup), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getInt(lastlocX), rs.getInt(lastlocY), rs.getInt(lastlocZ), rs.getString(lastlocWorld) , rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword),rs.getString(columnSalt), rs.getInt(columnGroup), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld) , rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
||||||
} else {
|
} else {
|
||||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getInt(lastlocX), rs.getInt(lastlocY), rs.getInt(lastlocZ), rs.getString(lastlocWorld) , rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld) , rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -291,9 +298,9 @@ public class SqliteDataSource implements DataSource {
|
|||||||
PreparedStatement pst = null;
|
PreparedStatement pst = null;
|
||||||
try {
|
try {
|
||||||
pst = con.prepareStatement("UPDATE " + tableName + " SET " + lastlocX + "=?, "+ lastlocY +"=?, "+ lastlocZ +"=?, " + lastlocWorld + "=? WHERE " + columnName + "=?;");
|
pst = con.prepareStatement("UPDATE " + tableName + " SET " + lastlocX + "=?, "+ lastlocY +"=?, "+ lastlocZ +"=?, " + lastlocWorld + "=? WHERE " + columnName + "=?;");
|
||||||
pst.setLong(1, auth.getQuitLocX());
|
pst.setDouble(1, auth.getQuitLocX());
|
||||||
pst.setLong(2, auth.getQuitLocY());
|
pst.setDouble(2, auth.getQuitLocY());
|
||||||
pst.setLong(3, auth.getQuitLocZ());
|
pst.setDouble(3, auth.getQuitLocZ());
|
||||||
pst.setString(4, auth.getWorld());
|
pst.setString(4, auth.getWorld());
|
||||||
pst.setString(5, auth.getNickname());
|
pst.setString(5, auth.getNickname());
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
|
|||||||
@ -36,7 +36,6 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
|
|||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.scheduler.BukkitScheduler;
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
@ -669,10 +668,10 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
int time = Settings.getRegistrationTimeout * 20;
|
int time = Settings.getRegistrationTimeout * 20;
|
||||||
int msgInterval = Settings.getWarnMessageInterval;
|
int msgInterval = Settings.getWarnMessageInterval;
|
||||||
if (time != 0) {
|
if (time != 0) {
|
||||||
BukkitTask id = sched.runTaskLater(plugin, new TimeoutTask(plugin, name), time);
|
int id = sched.scheduleSyncDelayedTask(plugin, new TimeoutTask(plugin, name), time);
|
||||||
if(!LimboCache.getInstance().hasLimboPlayer(name))
|
if(!LimboCache.getInstance().hasLimboPlayer(name))
|
||||||
LimboCache.getInstance().addLimboPlayer(player);
|
LimboCache.getInstance().addLimboPlayer(player);
|
||||||
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id.getTaskId());
|
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
|
||||||
}
|
}
|
||||||
if(!LimboCache.getInstance().hasLimboPlayer(name))
|
if(!LimboCache.getInstance().hasLimboPlayer(name))
|
||||||
LimboCache.getInstance().addLimboPlayer(player);
|
LimboCache.getInstance().addLimboPlayer(player);
|
||||||
@ -682,8 +681,8 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
player.setAllowFlight(true);
|
player.setAllowFlight(true);
|
||||||
player.setFlying(true);
|
player.setFlying(true);
|
||||||
}
|
}
|
||||||
BukkitTask msgT = sched.runTask(plugin, new MessageTask(plugin, name, msg, msgInterval));
|
int msgT = sched.scheduleSyncDelayedTask(plugin, new MessageTask(plugin, name, msg, msgInterval));
|
||||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT.getTaskId());
|
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT);
|
||||||
player.setNoDamageTicks(Settings.getRegistrationTimeout * 20);
|
player.setNoDamageTicks(Settings.getRegistrationTimeout * 20);
|
||||||
if (Settings.useEssentialsMotd)
|
if (Settings.useEssentialsMotd)
|
||||||
player.performCommand("motd");
|
player.performCommand("motd");
|
||||||
@ -722,7 +721,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
|
|
||||||
if (PlayerCache.getInstance().isAuthenticated(name) && !player.isDead()) {
|
if (PlayerCache.getInstance().isAuthenticated(name) && !player.isDead()) {
|
||||||
if(Settings.isSaveQuitLocationEnabled && data.isAuthAvailable(name)) {
|
if(Settings.isSaveQuitLocationEnabled && data.isAuthAvailable(name)) {
|
||||||
final PlayerAuth auth = new PlayerAuth(name,loc.getBlockX(),loc.getBlockY(),loc.getBlockZ(),loc.getWorld().getName());
|
final PlayerAuth auth = new PlayerAuth(name,loc.getX(),loc.getY(),loc.getZ(),loc.getWorld().getName());
|
||||||
try {
|
try {
|
||||||
if (data instanceof Thread) {
|
if (data instanceof Thread) {
|
||||||
data.updateQuitLoc(auth);
|
data.updateQuitLoc(auth);
|
||||||
@ -799,7 +798,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
String name = player.getName().toLowerCase();
|
String name = player.getName().toLowerCase();
|
||||||
if ((PlayerCache.getInstance().isAuthenticated(name)) && (!player.isDead()) &&
|
if ((PlayerCache.getInstance().isAuthenticated(name)) && (!player.isDead()) &&
|
||||||
(Settings.isSaveQuitLocationEnabled) && data.isAuthAvailable(name)) {
|
(Settings.isSaveQuitLocationEnabled) && data.isAuthAvailable(name)) {
|
||||||
final PlayerAuth auth = new PlayerAuth(name, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(),loc.getWorld().getName());
|
final PlayerAuth auth = new PlayerAuth(name, loc.getX(), loc.getY(), loc.getZ(),loc.getWorld().getName());
|
||||||
try {
|
try {
|
||||||
if (data instanceof Thread) {
|
if (data instanceof Thread) {
|
||||||
data.updateQuitLoc(auth);
|
data.updateQuitLoc(auth);
|
||||||
@ -924,7 +923,6 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerInventoryOpen(InventoryOpenEvent event) {
|
public void onPlayerInventoryOpen(InventoryOpenEvent event) {
|
||||||
if (event.isCancelled() || event.getPlayer() == null) return;
|
if (event.isCancelled() || event.getPlayer() == null) return;
|
||||||
if (!(event.getPlayer() instanceof Player)) return;
|
|
||||||
Player player = (Player) event.getPlayer();
|
Player player = (Player) event.getPlayer();
|
||||||
String name = player.getName().toLowerCase();
|
String name = player.getName().toLowerCase();
|
||||||
|
|
||||||
@ -945,6 +943,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
player.closeInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
@ -1095,7 +1094,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
|
|
||||||
Location spawn = plugin.getSpawnLocation(player.getWorld());
|
Location spawn = plugin.getSpawnLocation(player.getWorld());
|
||||||
if(Settings.isSaveQuitLocationEnabled && data.isAuthAvailable(name)) {
|
if(Settings.isSaveQuitLocationEnabled && data.isAuthAvailable(name)) {
|
||||||
final PlayerAuth auth = new PlayerAuth(name,spawn.getBlockX(),spawn.getBlockY(),spawn.getBlockZ(),spawn.getWorld().getName());
|
final PlayerAuth auth = new PlayerAuth(name,spawn.getX(),spawn.getY(),spawn.getZ(),spawn.getWorld().getName());
|
||||||
try {
|
try {
|
||||||
data.updateQuitLoc(auth);
|
data.updateQuitLoc(auth);
|
||||||
} catch (NullPointerException npe) { }
|
} catch (NullPointerException npe) { }
|
||||||
|
|||||||
@ -129,8 +129,11 @@ public class PasswordSecurity {
|
|||||||
if (method == null)
|
if (method == null)
|
||||||
throw new NoSuchAlgorithmException("Unknown hash algorithm");
|
throw new NoSuchAlgorithmException("Unknown hash algorithm");
|
||||||
|
|
||||||
|
try {
|
||||||
if (method.comparePassword(hash, password, playerName))
|
if (method.comparePassword(hash, password, playerName))
|
||||||
return true;
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
if (Settings.supportOldPassword) {
|
if (Settings.supportOldPassword) {
|
||||||
try {
|
try {
|
||||||
if (compareWithAllEncryptionMethod(password, hash, playerName))
|
if (compareWithAllEncryptionMethod(password, hash, playerName))
|
||||||
@ -142,9 +145,9 @@ public class PasswordSecurity {
|
|||||||
|
|
||||||
private static boolean compareWithAllEncryptionMethod(String password, String hash, String playerName) throws NoSuchAlgorithmException {
|
private static boolean compareWithAllEncryptionMethod(String password, String hash, String playerName) throws NoSuchAlgorithmException {
|
||||||
for (HashAlgorithm algo : HashAlgorithm.values()) {
|
for (HashAlgorithm algo : HashAlgorithm.values()) {
|
||||||
|
if (algo != HashAlgorithm.CUSTOM)
|
||||||
try {
|
try {
|
||||||
EncryptionMethod method = (EncryptionMethod) algo.getclass().newInstance();
|
EncryptionMethod method = (EncryptionMethod) algo.getclass().newInstance();
|
||||||
if (algo != HashAlgorithm.CUSTOM) {
|
|
||||||
if (method.comparePassword(hash, password, playerName)) {
|
if (method.comparePassword(hash, password, playerName)) {
|
||||||
PlayerAuth nAuth = AuthMe.getInstance().database.getAuth(playerName);
|
PlayerAuth nAuth = AuthMe.getInstance().database.getAuth(playerName);
|
||||||
if (nAuth != null) {
|
if (nAuth != null) {
|
||||||
@ -155,7 +158,6 @@ public class PasswordSecurity {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -18,7 +18,7 @@ public class DOUBLEMD5 implements EncryptionMethod {
|
|||||||
return hash.equals(getHash(password, ""));
|
return hash.equals(getHash(password, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getMD5(String message) throws NoSuchAlgorithmException {
|
private static String getMD5(String message) throws NoSuchAlgorithmException {
|
||||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||||
md5.reset();
|
md5.reset();
|
||||||
md5.update(message.getBytes());
|
md5.update(message.getBytes());
|
||||||
|
|||||||
@ -22,7 +22,7 @@ public class IPB3 implements EncryptionMethod {
|
|||||||
return hash.equals(getHash(password, salt));
|
return hash.equals(getHash(password, salt));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getMD5(String message) throws NoSuchAlgorithmException {
|
private static String getMD5(String message) throws NoSuchAlgorithmException {
|
||||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||||
md5.reset();
|
md5.reset();
|
||||||
md5.update(message.getBytes());
|
md5.update(message.getBytes());
|
||||||
|
|||||||
@ -19,7 +19,7 @@ public class JOOMLA implements EncryptionMethod {
|
|||||||
return hash.equals(getMD5(password + salt) + ":" + salt);
|
return hash.equals(getMD5(password + salt) + ":" + salt);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getMD5(String message) throws NoSuchAlgorithmException {
|
private static String getMD5(String message) throws NoSuchAlgorithmException {
|
||||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||||
md5.reset();
|
md5.reset();
|
||||||
md5.update(message.getBytes());
|
md5.update(message.getBytes());
|
||||||
|
|||||||
@ -8,11 +8,7 @@ public class MD5 implements EncryptionMethod {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHash(String password, String salt) throws NoSuchAlgorithmException {
|
public String getHash(String password, String salt) throws NoSuchAlgorithmException {
|
||||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
return getMD5(password);
|
||||||
md5.reset();
|
|
||||||
md5.update(password.getBytes());
|
|
||||||
byte[] digest = md5.digest();
|
|
||||||
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1,digest));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -20,4 +16,11 @@ public class MD5 implements EncryptionMethod {
|
|||||||
return hash.equals(getHash(password, ""));
|
return hash.equals(getHash(password, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getMD5(String message) throws NoSuchAlgorithmException {
|
||||||
|
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||||
|
md5.reset();
|
||||||
|
md5.update(message.getBytes());
|
||||||
|
byte[] digest = md5.digest();
|
||||||
|
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1,digest));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,10 +19,10 @@ public class MD5VB implements EncryptionMethod {
|
|||||||
return hash.equals(getHash(password, line[2]));
|
return hash.equals(getHash(password, line[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getMD5(String password) throws NoSuchAlgorithmException {
|
private static String getMD5(String message) throws NoSuchAlgorithmException {
|
||||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||||
md5.reset();
|
md5.reset();
|
||||||
md5.update(password.getBytes());
|
md5.update(message.getBytes());
|
||||||
byte[] digest = md5.digest();
|
byte[] digest = md5.digest();
|
||||||
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1,digest));
|
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1,digest));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,7 @@ public class MYBB implements EncryptionMethod {
|
|||||||
return hash.equals(getHash(password, salt));
|
return hash.equals(getHash(password, salt));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getMD5(String message) throws NoSuchAlgorithmException {
|
private static String getMD5(String message) throws NoSuchAlgorithmException {
|
||||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||||
md5.reset();
|
md5.reset();
|
||||||
md5.update(message.getBytes());
|
md5.update(message.getBytes());
|
||||||
|
|||||||
@ -48,7 +48,7 @@ public class PHPFUSION implements EncryptionMethod {
|
|||||||
return hash.equals(getHash(password, salt));
|
return hash.equals(getHash(password, salt));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSHA1(String message) throws NoSuchAlgorithmException {
|
private static String getSHA1(String message) throws NoSuchAlgorithmException {
|
||||||
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
|
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
|
||||||
sha1.reset();
|
sha1.reset();
|
||||||
sha1.update(message.getBytes());
|
sha1.update(message.getBytes());
|
||||||
|
|||||||
@ -22,7 +22,7 @@ public class SALTED2MD5 implements EncryptionMethod {
|
|||||||
return hash.equals(getMD5(getMD5(password) + salt));
|
return hash.equals(getMD5(getMD5(password) + salt));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getMD5(String message) throws NoSuchAlgorithmException {
|
private static String getMD5(String message) throws NoSuchAlgorithmException {
|
||||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||||
md5.reset();
|
md5.reset();
|
||||||
md5.update(message.getBytes());
|
md5.update(message.getBytes());
|
||||||
|
|||||||
@ -8,11 +8,7 @@ public class SHA1 implements EncryptionMethod {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHash(String password, String salt) throws NoSuchAlgorithmException {
|
public String getHash(String password, String salt) throws NoSuchAlgorithmException {
|
||||||
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
|
return getSHA1(password);
|
||||||
sha1.reset();
|
|
||||||
sha1.update(password.getBytes());
|
|
||||||
byte[] digest = sha1.digest();
|
|
||||||
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1,digest));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -21,4 +17,12 @@ public class SHA1 implements EncryptionMethod {
|
|||||||
return hash.equals(getHash(password, ""));
|
return hash.equals(getHash(password, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getSHA1(String message) throws NoSuchAlgorithmException {
|
||||||
|
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
|
||||||
|
sha1.reset();
|
||||||
|
sha1.update(message.getBytes());
|
||||||
|
byte[] digest = sha1.digest();
|
||||||
|
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1,digest));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@ public class SHA256 implements EncryptionMethod {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHash(String password, String salt) throws NoSuchAlgorithmException {
|
public String getHash(String password, String salt) throws NoSuchAlgorithmException {
|
||||||
return "$SHA$" + salt + "$" + getSha256(getSha256(password) + salt);
|
return "$SHA$" + salt + "$" + getSHA256(getSHA256(password) + salt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -18,10 +18,10 @@ public class SHA256 implements EncryptionMethod {
|
|||||||
return hash.equals(getHash(password, line[2]));
|
return hash.equals(getHash(password, line[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSha256(String password) throws NoSuchAlgorithmException {
|
private static String getSHA256(String message) throws NoSuchAlgorithmException {
|
||||||
MessageDigest sha256 = MessageDigest.getInstance("SHA-256");
|
MessageDigest sha256 = MessageDigest.getInstance("SHA-256");
|
||||||
sha256.reset();
|
sha256.reset();
|
||||||
sha256.update(password.getBytes());
|
sha256.update(message.getBytes());
|
||||||
byte[] digest = sha256.digest();
|
byte[] digest = sha256.digest();
|
||||||
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1,digest));
|
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1,digest));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,11 +9,7 @@ public class SHA512 implements EncryptionMethod {
|
|||||||
@Override
|
@Override
|
||||||
public String getHash(String password, String salt)
|
public String getHash(String password, String salt)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
MessageDigest sha512 = MessageDigest.getInstance("SHA-512");
|
return getSHA512(password);
|
||||||
sha512.reset();
|
|
||||||
sha512.update(password.getBytes());
|
|
||||||
byte[] digest = sha512.digest();
|
|
||||||
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1,digest));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -22,4 +18,11 @@ public class SHA512 implements EncryptionMethod {
|
|||||||
return hash.equals(getHash(password, ""));
|
return hash.equals(getHash(password, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getSHA512(String message) throws NoSuchAlgorithmException {
|
||||||
|
MessageDigest sha512 = MessageDigest.getInstance("SHA-512");
|
||||||
|
sha512.reset();
|
||||||
|
sha512.update(message.getBytes());
|
||||||
|
byte[] digest = sha512.digest();
|
||||||
|
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1,digest));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@ public class SMF implements EncryptionMethod {
|
|||||||
return hash.equals(getHash(password, playerName.toLowerCase()));
|
return hash.equals(getHash(password, playerName.toLowerCase()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSHA1(String message) throws NoSuchAlgorithmException {
|
private static String getSHA1(String message) throws NoSuchAlgorithmException {
|
||||||
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
|
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
|
||||||
sha1.reset();
|
sha1.reset();
|
||||||
sha1.update(message.getBytes());
|
sha1.update(message.getBytes());
|
||||||
|
|||||||
@ -22,7 +22,7 @@ public class WBB3 implements EncryptionMethod {
|
|||||||
return hash.equals(getHash(password, salt));
|
return hash.equals(getHash(password, salt));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSHA1(String message) throws NoSuchAlgorithmException {
|
private static String getSHA1(String message) throws NoSuchAlgorithmException {
|
||||||
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
|
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
|
||||||
sha1.reset();
|
sha1.reset();
|
||||||
sha1.update(message.getBytes());
|
sha1.update(message.getBytes());
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package fr.xephi.authme.task;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitScheduler;
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||||
@ -34,9 +33,9 @@ public class MessageTask implements Runnable {
|
|||||||
player.sendMessage(ms);
|
player.sendMessage(ms);
|
||||||
}
|
}
|
||||||
BukkitScheduler sched = plugin.getServer().getScheduler();
|
BukkitScheduler sched = plugin.getServer().getScheduler();
|
||||||
BukkitTask late = sched.runTaskLater(plugin, this, interval * 20);
|
int late = sched.scheduleSyncDelayedTask(plugin, this, interval * 20);
|
||||||
if(LimboCache.getInstance().hasLimboPlayer(name)) {
|
if(LimboCache.getInstance().hasLimboPlayer(name)) {
|
||||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(late.getTaskId());
|
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(late);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -120,15 +120,15 @@ public class FlatFileThread extends Thread implements DataSource {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 7: {
|
case 7: {
|
||||||
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), Integer.parseInt(args[4]), Integer.parseInt(args[5]), Integer.parseInt(args[6]), "world", "your@email.com", API.getPlayerRealName(args[0]));
|
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), "world", "your@email.com", API.getPlayerRealName(args[0]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 8: {
|
case 8: {
|
||||||
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), Integer.parseInt(args[4]), Integer.parseInt(args[5]), Integer.parseInt(args[6]), args[7], "your@email.com", API.getPlayerRealName(args[0]));
|
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], "your@email.com", API.getPlayerRealName(args[0]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 9: {
|
case 9: {
|
||||||
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), Integer.parseInt(args[4]), Integer.parseInt(args[5]), Integer.parseInt(args[6]), args[7], args[8], API.getPlayerRealName(args[0]));
|
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], args[8], API.getPlayerRealName(args[0]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@ -177,15 +177,15 @@ public class FlatFileThread extends Thread implements DataSource {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 7: {
|
case 7: {
|
||||||
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), Integer.parseInt(args[4]), Integer.parseInt(args[5]), Integer.parseInt(args[6]), "world", "your@email.com", API.getPlayerRealName(args[0]));
|
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), "world", "your@email.com", API.getPlayerRealName(args[0]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 8: {
|
case 8: {
|
||||||
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), Integer.parseInt(args[4]), Integer.parseInt(args[5]), Integer.parseInt(args[6]), args[7], "your@email.com", API.getPlayerRealName(args[0]));
|
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], "your@email.com", API.getPlayerRealName(args[0]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 9: {
|
case 9: {
|
||||||
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), Integer.parseInt(args[4]), Integer.parseInt(args[5]), Integer.parseInt(args[6]), args[7], args[8], API.getPlayerRealName(args[0]));
|
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], args[8], API.getPlayerRealName(args[0]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@ -436,11 +436,11 @@ public class FlatFileThread extends Thread implements DataSource {
|
|||||||
case 4:
|
case 4:
|
||||||
return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), "your@email.com", API.getPlayerRealName(args[0]));
|
return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), "your@email.com", API.getPlayerRealName(args[0]));
|
||||||
case 7:
|
case 7:
|
||||||
return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Integer.parseInt(args[4]), Integer.parseInt(args[5]), Integer.parseInt(args[6]), "unavailableworld", "your@email.com", API.getPlayerRealName(args[0]));
|
return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), "unavailableworld", "your@email.com", API.getPlayerRealName(args[0]));
|
||||||
case 8:
|
case 8:
|
||||||
return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Integer.parseInt(args[4]), Integer.parseInt(args[5]), Integer.parseInt(args[6]), args[7], "your@email.com", API.getPlayerRealName(args[0]));
|
return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], "your@email.com", API.getPlayerRealName(args[0]));
|
||||||
case 9:
|
case 9:
|
||||||
return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Integer.parseInt(args[4]), Integer.parseInt(args[5]), Integer.parseInt(args[6]), args[7], args[8], API.getPlayerRealName(args[0]));
|
return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], args[8], API.getPlayerRealName(args[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -482,7 +482,7 @@ public class FlatFileThread extends Thread implements DataSource {
|
|||||||
while ((line = br.readLine()) != null) {
|
while ((line = br.readLine()) != null) {
|
||||||
String[] args = line.split(":");
|
String[] args = line.split(":");
|
||||||
if (args[0].equals(auth.getNickname())) {
|
if (args[0].equals(auth.getNickname())) {
|
||||||
newAuth = new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Integer.parseInt(args[4]), Integer.parseInt(args[5]), Integer.parseInt(args[6]), args[7], auth.getEmail(), API.getPlayerRealName(args[0]));
|
newAuth = new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), Double.parseDouble(args[4]), Double.parseDouble(args[5]), Double.parseDouble(args[6]), args[7], auth.getEmail(), API.getPlayerRealName(args[0]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -124,9 +124,9 @@ public class MySQLThread extends Thread implements DataSource {
|
|||||||
+ columnPassword + " VARCHAR(255) NOT NULL,"
|
+ columnPassword + " VARCHAR(255) NOT NULL,"
|
||||||
+ columnIp + " VARCHAR(40) NOT NULL,"
|
+ columnIp + " VARCHAR(40) NOT NULL,"
|
||||||
+ columnLastLogin + " BIGINT,"
|
+ columnLastLogin + " BIGINT,"
|
||||||
+ lastlocX + " smallint(6) DEFAULT '0',"
|
+ lastlocX + " DOUBLE NOT NULL DEFAULT '0.0',"
|
||||||
+ lastlocY + " smallint(6) DEFAULT '0',"
|
+ lastlocY + " DOUBLE NOT NULL DEFAULT '0.0',"
|
||||||
+ lastlocZ + " smallint(6) DEFAULT '0',"
|
+ lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0',"
|
||||||
+ lastlocWorld + " VARCHAR(255) DEFAULT 'world',"
|
+ lastlocWorld + " VARCHAR(255) DEFAULT 'world',"
|
||||||
+ columnEmail + " VARCHAR(255) DEFAULT 'your@email.com',"
|
+ columnEmail + " VARCHAR(255) DEFAULT 'your@email.com',"
|
||||||
+ "CONSTRAINT table_const_prim PRIMARY KEY (" + columnID + "));");
|
+ "CONSTRAINT table_const_prim PRIMARY KEY (" + columnID + "));");
|
||||||
@ -150,8 +150,8 @@ public class MySQLThread extends Thread implements DataSource {
|
|||||||
rs.close();
|
rs.close();
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, lastlocX);
|
rs = con.getMetaData().getColumns(null, null, tableName, lastlocX);
|
||||||
if (!rs.next()) {
|
if (!rs.next()) {
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + lastlocX + " smallint(6) NOT NULL DEFAULT '0' AFTER "
|
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + lastlocX + " DOUBLE NOT NULL DEFAULT '0.0' AFTER "
|
||||||
+ columnLastLogin +" , ADD " + lastlocY + " smallint(6) NOT NULL DEFAULT '0' AFTER " + lastlocX + " , ADD " + lastlocZ + " smallint(6) NOT NULL DEFAULT '0' AFTER " + lastlocY + ";");
|
+ columnLastLogin +" , ADD " + lastlocY + " DOUBLE NOT NULL DEFAULT '0.0' AFTER " + lastlocX + " , ADD " + lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0' AFTER " + lastlocY + ";");
|
||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, lastlocWorld);
|
rs = con.getMetaData().getColumns(null, null, tableName, lastlocWorld);
|
||||||
@ -163,6 +163,11 @@ public class MySQLThread extends Thread implements DataSource {
|
|||||||
if (!rs.next()) {
|
if (!rs.next()) {
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com' AFTER " + lastlocZ +";");
|
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com' AFTER " + lastlocZ +";");
|
||||||
}
|
}
|
||||||
|
rs.close();
|
||||||
|
rs = con.getMetaData().getColumns(null, null, tableName, lastlocX);
|
||||||
|
if (rs.next()) {
|
||||||
|
st.executeUpdate("ALTER TABLE " + tableName + " MODIFY " + lastlocX + " DOUBLE NOT NULL DEFAULT '0.0', MODIFY " + lastlocY + " DOUBLE NOT NULL DEFAULT '0.0', MODIFY " + lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0';");
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
close(rs);
|
close(rs);
|
||||||
close(st);
|
close(st);
|
||||||
@ -209,14 +214,14 @@ public class MySQLThread extends Thread implements DataSource {
|
|||||||
rs = pst.executeQuery();
|
rs = pst.executeQuery();
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
if (rs.getString(columnIp).isEmpty() ) {
|
if (rs.getString(columnIp).isEmpty() ) {
|
||||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "198.18.0.1", rs.getLong(columnLastLogin), rs.getInt(lastlocX), rs.getInt(lastlocY), rs.getInt(lastlocZ), rs.getString(lastlocWorld),rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "198.18.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld),rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
||||||
} else {
|
} else {
|
||||||
if(!columnSalt.isEmpty()){
|
if(!columnSalt.isEmpty()){
|
||||||
if(!columnGroup.isEmpty())
|
if(!columnGroup.isEmpty())
|
||||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword),rs.getString(columnSalt), rs.getInt(columnGroup), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getInt(lastlocX), rs.getInt(lastlocY), rs.getInt(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword),rs.getString(columnSalt), rs.getInt(columnGroup), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
||||||
else return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword),rs.getString(columnSalt), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getInt(lastlocX), rs.getInt(lastlocY), rs.getInt(lastlocZ), rs.getString(lastlocWorld),rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
else return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword),rs.getString(columnSalt), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld),rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
||||||
} else {
|
} else {
|
||||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getInt(lastlocX), rs.getInt(lastlocY), rs.getInt(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -522,9 +527,9 @@ public class MySQLThread extends Thread implements DataSource {
|
|||||||
try {
|
try {
|
||||||
con = makeSureConnectionIsReady();
|
con = makeSureConnectionIsReady();
|
||||||
pst = con.prepareStatement("UPDATE " + tableName + " SET "+ lastlocX + " =?, "+ lastlocY +"=?, "+ lastlocZ +"=?, " + lastlocWorld + "=? WHERE " + columnName + "=?;");
|
pst = con.prepareStatement("UPDATE " + tableName + " SET "+ lastlocX + " =?, "+ lastlocY +"=?, "+ lastlocZ +"=?, " + lastlocWorld + "=? WHERE " + columnName + "=?;");
|
||||||
pst.setLong(1, auth.getQuitLocX());
|
pst.setDouble(1, auth.getQuitLocX());
|
||||||
pst.setLong(2, auth.getQuitLocY());
|
pst.setDouble(2, auth.getQuitLocY());
|
||||||
pst.setLong(3, auth.getQuitLocZ());
|
pst.setDouble(3, auth.getQuitLocZ());
|
||||||
pst.setString(4, auth.getWorld());
|
pst.setString(4, auth.getWorld());
|
||||||
pst.setString(5, auth.getNickname());
|
pst.setString(5, auth.getNickname());
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
|
|||||||
@ -94,9 +94,9 @@ public class SQLiteThread extends Thread implements DataSource {
|
|||||||
+ columnPassword + " VARCHAR(255) NOT NULL,"
|
+ columnPassword + " VARCHAR(255) NOT NULL,"
|
||||||
+ columnIp + " VARCHAR(40) NOT NULL,"
|
+ columnIp + " VARCHAR(40) NOT NULL,"
|
||||||
+ columnLastLogin + " BIGINT,"
|
+ columnLastLogin + " BIGINT,"
|
||||||
+ lastlocX + " smallint(6) DEFAULT '0',"
|
+ lastlocX + " DOUBLE NOT NULL DEFAULT '0.0',"
|
||||||
+ lastlocY + " smallint(6) DEFAULT '0',"
|
+ lastlocY + " DOUBLE NOT NULL DEFAULT '0.0',"
|
||||||
+ lastlocZ + " smallint(6) DEFAULT '0',"
|
+ lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0',"
|
||||||
+ lastlocWorld + " VARCHAR(255) DEFAULT 'world',"
|
+ lastlocWorld + " VARCHAR(255) DEFAULT 'world',"
|
||||||
+ columnEmail + " VARCHAR(255) DEFAULT 'your@email.com',"
|
+ columnEmail + " VARCHAR(255) DEFAULT 'your@email.com',"
|
||||||
+ "CONSTRAINT table_const_prim PRIMARY KEY (" + columnID + "));");
|
+ "CONSTRAINT table_const_prim PRIMARY KEY (" + columnID + "));");
|
||||||
@ -120,9 +120,9 @@ public class SQLiteThread extends Thread implements DataSource {
|
|||||||
rs.close();
|
rs.close();
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, lastlocX);
|
rs = con.getMetaData().getColumns(null, null, tableName, lastlocX);
|
||||||
if (!rs.next()) {
|
if (!rs.next()) {
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + lastlocX + " smallint(6) NOT NULL DEFAULT '0'; "
|
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + lastlocX + " DOUBLE NOT NULL DEFAULT '0.0';");
|
||||||
+ "ALTER TABLE " + tableName + " ADD COLUMN " + lastlocY + " smallint(6) NOT NULL DEFAULT '0'; "
|
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + lastlocY + " DOUBLE NOT NULL DEFAULT '0.0';");
|
||||||
+ "ALTER TABLE " + tableName + " ADD COLUMN " + lastlocZ + " smallint(6) NOT NULL DEFAULT '0';");
|
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0';");
|
||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, lastlocWorld);
|
rs = con.getMetaData().getColumns(null, null, tableName, lastlocWorld);
|
||||||
@ -134,6 +134,13 @@ public class SQLiteThread extends Thread implements DataSource {
|
|||||||
if (!rs.next()) {
|
if (!rs.next()) {
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com';");
|
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com';");
|
||||||
}
|
}
|
||||||
|
rs.close();
|
||||||
|
rs = con.getMetaData().getColumns(null, null, tableName, lastlocX);
|
||||||
|
if (rs.next()) {
|
||||||
|
st.executeUpdate("ALTER TABLE " + tableName + " MODIFY " + lastlocX + " DOUBLE NOT NULL DEFAULT '0.0';");
|
||||||
|
st.executeUpdate("ALTER TABLE " + tableName + " MODIFY " + lastlocY + " DOUBLE NOT NULL DEFAULT '0.0';");
|
||||||
|
st.executeUpdate("ALTER TABLE " + tableName + " MODIFY " + lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0';");
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
close(rs);
|
close(rs);
|
||||||
close(st);
|
close(st);
|
||||||
@ -170,12 +177,12 @@ public class SQLiteThread extends Thread implements DataSource {
|
|||||||
rs = pst.executeQuery();
|
rs = pst.executeQuery();
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
if (rs.getString(columnIp).isEmpty() ) {
|
if (rs.getString(columnIp).isEmpty() ) {
|
||||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "198.18.0.1", rs.getLong(columnLastLogin), rs.getInt(lastlocX), rs.getInt(lastlocY), rs.getInt(lastlocZ), rs.getString(lastlocWorld) , rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "198.18.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld) , rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
||||||
} else {
|
} else {
|
||||||
if(!columnSalt.isEmpty()){
|
if(!columnSalt.isEmpty()){
|
||||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword),rs.getString(columnSalt), rs.getInt(columnGroup), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getInt(lastlocX), rs.getInt(lastlocY), rs.getInt(lastlocZ), rs.getString(lastlocWorld) , rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword),rs.getString(columnSalt), rs.getInt(columnGroup), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld) , rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
||||||
} else {
|
} else {
|
||||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getInt(lastlocX), rs.getInt(lastlocY), rs.getInt(lastlocZ), rs.getString(lastlocWorld) , rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld) , rs.getString(columnEmail), API.getPlayerRealName(rs.getString(columnName)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -313,9 +320,9 @@ public class SQLiteThread extends Thread implements DataSource {
|
|||||||
PreparedStatement pst = null;
|
PreparedStatement pst = null;
|
||||||
try {
|
try {
|
||||||
pst = con.prepareStatement("UPDATE " + tableName + " SET " + lastlocX + "=?, "+ lastlocY +"=?, "+ lastlocZ +"=?, " + lastlocWorld + "=? WHERE " + columnName + "=?;");
|
pst = con.prepareStatement("UPDATE " + tableName + " SET " + lastlocX + "=?, "+ lastlocY +"=?, "+ lastlocZ +"=?, " + lastlocWorld + "=? WHERE " + columnName + "=?;");
|
||||||
pst.setLong(1, auth.getQuitLocX());
|
pst.setDouble(1, auth.getQuitLocX());
|
||||||
pst.setLong(2, auth.getQuitLocY());
|
pst.setDouble(2, auth.getQuitLocY());
|
||||||
pst.setLong(3, auth.getQuitLocZ());
|
pst.setDouble(3, auth.getQuitLocZ());
|
||||||
pst.setString(4, auth.getWorld());
|
pst.setString(4, auth.getWorld());
|
||||||
pst.setString(5, auth.getNickname());
|
pst.setString(5, auth.getNickname());
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
|
|||||||
@ -3,7 +3,7 @@ author: Xephi59
|
|||||||
website: http://dev.bukkit.org/bukkit-plugins/authme-recoded/
|
website: http://dev.bukkit.org/bukkit-plugins/authme-recoded/
|
||||||
description: AuthMe prevents people, which aren't logged in, from doing stuff like placing blocks, moving, typing commands or seeing the inventory of the current player.
|
description: AuthMe prevents people, which aren't logged in, from doing stuff like placing blocks, moving, typing commands or seeing the inventory of the current player.
|
||||||
main: fr.xephi.authme.AuthMe
|
main: fr.xephi.authme.AuthMe
|
||||||
version: 3.1.2-DEV-3
|
version: 3.2
|
||||||
softdepend: [Vault, ChestShop, Spout, Multiverse-Core, Notifications, Citizens, CombatTag, Essentials, EssentialsSpawn]
|
softdepend: [Vault, ChestShop, Spout, Multiverse-Core, Notifications, Citizens, CombatTag, Essentials, EssentialsSpawn]
|
||||||
commands:
|
commands:
|
||||||
register:
|
register:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user