Update 3.1.1

//Changes 3.1.1://
* Do /login correctly in the correct thread
* Add a way to force some commands after /login
* Try a fix for bungeecord , let's see ...
* Fix Logout command ( pos + inventory )
* Fix PHPBB support + random salt
* Add a bypass antibot perm : authme.bypassantibot
* Translation file will automatically update now
* Some other fixes
This commit is contained in:
Xephi 2013-12-12 05:34:44 +01:00
parent 10b4eaeca7
commit bc8d11ebd6
63 changed files with 1424 additions and 501 deletions

Binary file not shown.

BIN
lib/bungeecord-api.jar Normal file

Binary file not shown.

BIN
lib/xAuth-2.4.4.jar Normal file

Binary file not shown.

15
pom.xml
View File

@ -24,12 +24,12 @@
</plugin>
</plugins>
</build>
<version>3.0</version>
<version>3.1.1</version>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.6.4-R0.1-SNAPSHOT</version>
<version>1.7.2-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.milkbowl.vault</groupId>
@ -107,6 +107,13 @@
<version>2.0.26</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/xAuth.jar</systemPath>
</dependency>
<dependency>
<groupId>de.luricos.bukkit</groupId>
<artifactId>xAuth</artifactId>
<version>2.4.4</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/xAuth-2.4.4.jar</systemPath>
</dependency>
<dependency>
<groupId>com.onarandombox</groupId>
@ -125,9 +132,9 @@
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.6.4-SNAPSHOT</version>
<version>1.7.2-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/BungeeCord.jar</systemPath>
<systemPath>${project.basedir}/lib/bungeecord-api.jar</systemPath>
</dependency>
</dependencies>
</project>

View File

@ -1,10 +1,17 @@
package fr.xephi.authme;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.URL;
import java.net.URLConnection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
import java.util.zip.GZIPInputStream;
import com.earth2me.essentials.Essentials;
@ -25,6 +32,7 @@ import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.World;
import com.maxmind.geoip.LookupService;
import com.onarandombox.MultiverseCore.MultiverseCore;
import fr.xephi.authme.api.API;
@ -48,6 +56,7 @@ import fr.xephi.authme.datasource.FileDataSource;
import fr.xephi.authme.datasource.MySQLDataSource;
import fr.xephi.authme.datasource.SqliteDataSource;
import fr.xephi.authme.listener.AuthMeBlockListener;
import fr.xephi.authme.listener.AuthMeBungeeCordListener;
import fr.xephi.authme.listener.AuthMeChestShopListener;
import fr.xephi.authme.listener.AuthMeEntityListener;
import fr.xephi.authme.listener.AuthMePlayerListener;
@ -94,6 +103,9 @@ public class AuthMe extends JavaPlugin {
public MultiverseCore multiverse = null;
public Location essentialsSpawn;
public Thread databaseThread = null;
public LookupService ls = null;
public boolean antibotMod = false;
public boolean delayedAntiBot = true;
@Override
public void onEnable() {
@ -105,14 +117,34 @@ public class AuthMe extends JavaPlugin {
settings = new Settings(this);
settings.loadConfigOptions();
if (Settings.enableAntiBot) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
@Override
public void run() {
delayedAntiBot = false;
}
}, 2400);
}
m = Messages.getInstance();
setMessages(Messages.getInstance());
pllog = PlayersLogs.getInstance();
server = getServer();
//Set Console Filter
if (Settings.removePassword)
Bukkit.getLogger().setFilter(new ConsoleFilter());
if (Settings.removePassword) {
Bukkit.getLogger().setFilter(new ConsoleFilter());
/*// Check the log4j usage and apply a filter
try {
if (Class.forName("org.apache.logging.log4j.LogManager") != null) {
}
} catch (Exception e) {}
*/
}
//Load MailApi
if(!Settings.getmailAccount.isEmpty() && !Settings.getmailPassword.isEmpty())
@ -137,7 +169,7 @@ public class AuthMe extends JavaPlugin {
checkEssentials();
/*
* Back style on start if avaible
* Back style on start if avalaible
*/
if(Settings.isBackupActivated && Settings.isBackupOnStart) {
Boolean Backup = new PerformBackup(this).DoBackup();
@ -164,7 +196,7 @@ public class AuthMe extends JavaPlugin {
if (Settings.isStopEnabled) {
ConsoleLogger.showError("Can't use FLAT FILE... SHUTDOWN...");
server.shutdown();
}
}
if (!Settings.isStopEnabled)
this.getServer().getPluginManager().disablePlugin(this);
return;
@ -185,7 +217,7 @@ public class AuthMe extends JavaPlugin {
if (Settings.isStopEnabled) {
ConsoleLogger.showError("Can't use MySQL... Please input correct MySQL informations ! SHUTDOWN...");
server.shutdown();
}
}
if (!Settings.isStopEnabled)
this.getServer().getPluginManager().disablePlugin(this);
return;
@ -225,6 +257,16 @@ public class AuthMe extends JavaPlugin {
management = new Management(database, this);
PluginManager pm = getServer().getPluginManager();
if (Settings.bungee) {
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
Bukkit.getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeCordMessage(this));
try {
if (Class.forName("net.md_5.bungee.api.event.ChatEvent") != null)
pm.registerEvents(new AuthMeBungeeCordListener(database, this), this);
} catch (ClassNotFoundException e) {
}
ConsoleLogger.info("Successfully hook with BungeeCord!");
}
if (pm.isPluginEnabled("Spout")) {
pm.registerEvents(new AuthMeSpoutListener(database), this);
ConsoleLogger.info("Successfully hook with Spout!");
@ -236,10 +278,6 @@ public class AuthMe extends JavaPlugin {
pm.registerEvents(new AuthMeChestShopListener(database, this), this);
ConsoleLogger.info("Successfully hook with ChestShop!");
}
if (Settings.bungee) {
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
Bukkit.getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeCordMessage(this));
}
//Find Permissions
if (pm.getPlugin("Vault") != null) {
@ -283,6 +321,8 @@ public class AuthMe extends JavaPlugin {
}
} catch (NullPointerException ex) {
}
if (Settings.enableProtection)
enableProtection();
if (Settings.usePurge)
autoPurge();
ConsoleLogger.info("Authme " + this.getDescription().getVersion() + " enabled");
@ -338,7 +378,7 @@ public class AuthMe extends JavaPlugin {
}
}
}
private void checkEssentials() {
if (this.getServer().getPluginManager().getPlugin("Essentials") != null && this.getServer().getPluginManager().getPlugin("Essentials").isEnabled()) {
try {
@ -405,7 +445,7 @@ public class AuthMe extends JavaPlugin {
if (database != null) {
database.close();
}
if (databaseThread != null) {
databaseThread.interrupt();
}
@ -414,7 +454,7 @@ public class AuthMe extends JavaPlugin {
Boolean Backup = new PerformBackup(this).DoBackup();
if(Backup) ConsoleLogger.info("Backup Complete");
else ConsoleLogger.showError("Error while making Backup");
}
}
ConsoleLogger.info("Authme " + this.getDescription().getVersion() + " disabled");
}
@ -427,7 +467,7 @@ public class AuthMe extends JavaPlugin {
PlayerAuth pAuth = database.getAuth(name);
if(pAuth == null)
break;
PlayerAuth auth = new PlayerAuth(name, pAuth.getHash(), pAuth.getIp(), new Date().getTime());
PlayerAuth auth = new PlayerAuth(name, pAuth.getHash(), pAuth.getIp(), new Date().getTime(), pAuth.getEmail(), player.getName());
database.updateSession(auth);
PlayerCache.getInstance().addPlayer(auth);
}
@ -519,7 +559,7 @@ public class AuthMe extends JavaPlugin {
}
return player;
}
public boolean authmePermissible(Player player, String perm) {
if (player.hasPermission(perm))
return true;
@ -536,7 +576,7 @@ public class AuthMe extends JavaPlugin {
}
return false;
}
private void autoPurge() {
if (!Settings.usePurge) {
return;
@ -551,9 +591,68 @@ public class AuthMe extends JavaPlugin {
purgeEssentials(cleared);
if (Settings.purgePlayerDat)
purgeDat(cleared);
if (Settings.purgeLimitedCreative)
purgeLimitedCreative(cleared);
if (Settings.purgeAntiXray)
purgeAntiXray(cleared);
//if (Settings.purgePermissions && permission != null)
//purgePerms(cleared);
}
private void purgeDat(List<String> cleared) {
/* private void purgePerms(List<String> cleared) {
int i = 0;
for (String name : cleared) {
org.bukkit.OfflinePlayer player = Bukkit.getOfflinePlayer(name);
if (player == null) continue;
String playerName = player.getName();
for (String group : permission.getPlayerGroups((String) null, playerName)) {
permission.playerRemoveGroup((String) null, playerName, group);
}
}
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " players permissions");
} */
public void purgeAntiXray(List<String> cleared) {
int i = 0;
for (String name : cleared) {
org.bukkit.OfflinePlayer player = Bukkit.getOfflinePlayer(name);
if (player == null) continue;
String playerName = player.getName();
File playerFile = new File("." + File.separator + "plugins" + File.separator + "AntiXRayData" + File.separator + "PlayerData" + File.separator + playerName);
if (playerFile.exists()) {
playerFile.delete();
i++;
}
}
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " AntiXRayData Files");
}
public void purgeLimitedCreative(List<String> cleared) {
int i = 0;
for (String name : cleared) {
org.bukkit.OfflinePlayer player = Bukkit.getOfflinePlayer(name);
if (player == null) continue;
String playerName = player.getName();
File playerFile = new File("." + File.separator + "plugins" + File.separator + "LimitedCreative" + File.separator + "inventories" + File.separator + playerName + ".yml");
if (playerFile.exists()) {
playerFile.delete();
i++;
}
playerFile = new File("." + File.separator + "plugins" + File.separator + "LimitedCreative" + File.separator + "inventories" + File.separator + playerName + "_creative.yml");
if (playerFile.exists()) {
playerFile.delete();
i++;
}
playerFile = new File("." + File.separator + "plugins" + File.separator + "LimitedCreative" + File.separator + "inventories" + File.separator + playerName + "_adventure.yml");
if (playerFile.exists()) {
playerFile.delete();
i++;
}
}
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " LimitedCreative Survival, Creative and Adventure files");
}
public void purgeDat(List<String> cleared) {
int i = 0;
for (String name : cleared) {
org.bukkit.OfflinePlayer player = Bukkit.getOfflinePlayer(name);
@ -568,7 +667,7 @@ public class AuthMe extends JavaPlugin {
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " .dat Files");
}
private void purgeEssentials(List<String> cleared) {
public void purgeEssentials(List<String> cleared) {
int i = 0;
for (String name : cleared) {
File playerFile = new File(this.ess.getDataFolder() + File.separator + "userdata" + File.separator + name + ".yml");
@ -582,7 +681,7 @@ public class AuthMe extends JavaPlugin {
public Location getSpawnLocation(World world) {
Location spawnLoc = world.getSpawnLocation();
if (multiverse != null) {
if (multiverse != null && Settings.multiverse) {
try {
spawnLoc = multiverse.getMVWorldManager().getMVWorld(world).getSpawnLocation();
} catch (NullPointerException npe) {
@ -597,4 +696,47 @@ public class AuthMe extends JavaPlugin {
spawnLoc = Spawn.getInstance().getLocation();
return spawnLoc;
}
private void enableProtection() {
ConsoleLogger.info(" This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com");
File file = new File(getDataFolder(), "GeoIP.dat");
if (!file.exists()) {
try {
String url = "http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz";
URL downloadUrl = new URL(url);
URLConnection conn = downloadUrl.openConnection();
conn.setConnectTimeout(10000);
conn.connect();
InputStream input = conn.getInputStream();
if (url.endsWith(".gz"))
input = new GZIPInputStream(input);
OutputStream output = new FileOutputStream(file);
byte[] buffer = new byte[2048];
int length = input.read(buffer);
while (length >= 0) {
output.write(buffer, 0, length);
length = input.read(buffer);
}
output.close();
input.close();
} catch (Exception e) {}
}
}
public String getCountryCode(InetAddress ip) {
try {
if (ls == null)
ls = new LookupService(new File(getDataFolder(), "GeoIP.dat"));
String code = ls.getCountry(ip).getCode();
if (code != null && !code.isEmpty())
return code;
} catch (Exception e) {}
return null;
}
public void switchAntiBotMod(boolean mode) {
this.antibotMod = mode;
Settings.switchAntiBotMod(mode);
}
}

View File

@ -50,24 +50,28 @@ public class Management {
this.pm = plugin.getServer().getPluginManager();
}
public void performLogin(final Player player, final String password, final boolean passpartu) {
public void performLogin(final Player player, final String password, final boolean passpartu, final boolean forceLogin) {
if (passpartu) {
// Passpartu-Login Bypasses Password-Authentication.
Bukkit.getScheduler().runTaskAsynchronously(plugin, new AsyncronousPasspartuLogin(player));
new AsyncronousPasspartuLogin(player).pass();
} else {
Bukkit.getScheduler().runTaskAsynchronously(plugin, new AsyncronousLogin(player, password));
new AsyncronousLogin(player, password, forceLogin).process();
}
}
class AsyncronousLogin implements Runnable {
class AsyncronousLogin {
protected Player player;
protected String name;
protected String password;
protected String realName;
protected boolean forceLogin;
public AsyncronousLogin(Player player, String password) {
public AsyncronousLogin(Player player, String password, boolean forceLogin) {
this.player = player;
this.password = password;
name = player.getName().toLowerCase();
realName = player.getName();
this.forceLogin = forceLogin;
}
protected String getIP() {
@ -87,12 +91,11 @@ public class Management {
plugin.captcha.remove(name);
plugin.captcha.put(name, i);
}
if (plugin.captcha.containsKey(name) && plugin.captcha.get(name) > Settings.maxLoginTry) {
player.sendMessage(m._("need_captcha"));
if (plugin.captcha.containsKey(name) && plugin.captcha.get(name) >= Settings.maxLoginTry) {
plugin.cap.put(name, rdm.nextString());
player.sendMessage("Type : /captcha " + plugin.cap.get(name));
player.sendMessage(m._("need_captcha").replace("THE_CAPTCHA", plugin.cap.get(name)).replace("<theCaptcha>", plugin.cap.get(name)));
return true;
} else if (plugin.captcha.containsKey(name) && plugin.captcha.get(name) > Settings.maxLoginTry) {
} else if (plugin.captcha.containsKey(name) && plugin.captcha.get(name) >= Settings.maxLoginTry) {
try {
plugin.captcha.remove(name);
plugin.cap.remove(name);
@ -127,8 +130,7 @@ public class Management {
return pAuth;
}
@Override
public void run() {
protected void process() {
PlayerAuth pAuth = preAuth();
if (pAuth == null || needsCaptcha())
return;
@ -136,15 +138,16 @@ public class Management {
String hash = pAuth.getHash();
String email = pAuth.getEmail();
boolean passwordVerified = true;
try {
passwordVerified = PasswordSecurity.comparePasswordWithHash(password, hash, name);
} catch (Exception ex) {
ConsoleLogger.showError(ex.getMessage());
player.sendMessage(m._("error"));
return;
}
if (!forceLogin)
try {
passwordVerified = PasswordSecurity.comparePasswordWithHash(password, hash, name);
} catch (Exception ex) {
ConsoleLogger.showError(ex.getMessage());
player.sendMessage(m._("error"));
return;
}
if (passwordVerified && player.isOnline()) {
PlayerAuth auth = new PlayerAuth(name, hash, getIP(), new Date().getTime(), email);
PlayerAuth auth = new PlayerAuth(name, hash, getIP(), new Date().getTime(), email, realName);
database.updateSession(auth);
/*
@ -216,13 +219,12 @@ public class Management {
}
}
class AsyncronousPasspartuLogin extends AsyncronousLogin implements Runnable {
class AsyncronousPasspartuLogin extends AsyncronousLogin {
public AsyncronousPasspartuLogin(Player player) {
super(player, null);
super(player, null, false);
}
@Override
public void run() {
public void pass() {
PlayerAuth pAuth = preAuth();
if (pAuth == null)
return;
@ -230,7 +232,7 @@ public class Management {
String hash = pAuth.getHash();
String email = pAuth.getEmail();
PlayerAuth auth = new PlayerAuth(name, hash, getIP(), new Date().getTime(), email);
PlayerAuth auth = new PlayerAuth(name, hash, getIP(), new Date().getTime(), email, realName);
database.updateSession(auth);
/*
@ -338,6 +340,13 @@ public class Management {
API.setPlayerInventory(player, event.getInventory(), event.getArmor());
}
}
protected void forceCommands() {
for (String command : Settings.forceCommands) {
try {
player.performCommand(command.replace("%p", player.getName()));
} catch (Exception e) {}
}
}
@Override
public void run() {
@ -386,7 +395,7 @@ public class Management {
// Re-Force Survival GameMode if we need due to world change specification
if (Settings.isForceSurvivalModeEnabled)
player.setGameMode(GameMode.SURVIVAL);
Utils.forceGM(player);
// Cleanup no longer used temporary data
LimboCache.getInstance().deleteLimboPlayer(name);
@ -394,9 +403,21 @@ public class Management {
playerCache.removeCache(name);
}
}
// We can now display the join message
if (AuthMePlayerListener.joinMessage.containsKey(name) && AuthMePlayerListener.joinMessage.get(name) != null) {
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
if (p.isOnline())
p.sendMessage(AuthMePlayerListener.joinMessage.get(name));
}
}
// The Loginevent now fires (as intended) after everything is processed
Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player, true));
player.saveData();
// Login is now finish , we can force all commands
forceCommands();
}
}

View File

@ -7,11 +7,13 @@ import java.util.Random;
import java.util.Scanner;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import fr.xephi.authme.api.API;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.events.AuthMeTeleportEvent;
import fr.xephi.authme.settings.Settings;
@ -126,24 +128,28 @@ public class Utils {
}
});
id = Bukkit.getScheduler().scheduleSyncRepeatingTask(AuthMe.getInstance(), new Runnable()
{
@Override
public void run() {
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);
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);
}
}
/*
@ -217,6 +223,14 @@ public class Utils {
return new String(arr);
}
/*
* Used for force player GameMode
*/
public static void forceGM(Player player) {
if (!AuthMe.getInstance().authmePermissible(player, "authme.bypassforcesurvival"))
player.setGameMode(GameMode.SURVIVAL);
}
public enum groupType {
UNREGISTERED, REGISTERED, NOTLOGGEDIN, LOGGEDIN
}

View File

@ -145,7 +145,7 @@ public class API {
if (isRegistered(name)) {
return false;
}
PlayerAuth auth = new PlayerAuth(name, hash, "198.18.0.1", 0);
PlayerAuth auth = new PlayerAuth(name, hash, "198.18.0.1", 0, "your@email.com", getPlayerRealName(name));
if (!database.saveAuth(auth)) {
return false;
}
@ -154,5 +154,26 @@ public class API {
return false;
}
}
/**
* Get Player realName from lowerCase nickname
* @param String playerName
* return String player real name
*/
public static String getPlayerRealName(String nickname) {
try {
String realName = Bukkit.getOfflinePlayer(nickname).getName();
if (realName != null && !realName.isEmpty())
return realName;
} catch (NullPointerException npe) {}
return nickname;
}
/**
* Force a player to login
* @param Player player
*/
public static void forceLogin(Player player) {
instance.management.performLogin(player, "dontneed", false, true);
}
}

View File

@ -5,10 +5,10 @@ import fr.xephi.authme.settings.Settings;
public class PlayerAuth {
private String nickname;
private String hash;
private String nickname = "";
private String hash = "";
private String ip = "198.18.0.1";
private long lastLogin;
private long lastLogin = 0;
private int x = 0;
private int y = 0;
private int z = 0;
@ -17,20 +17,15 @@ public class PlayerAuth {
private String vBhash = null;
private int groupId;
private String email = "your@email.com";
private String realName = "";
public PlayerAuth(String nickname, String hash, String ip, long lastLogin) {
this.nickname = nickname;
this.hash = hash;
this.ip = ip;
this.lastLogin = lastLogin;
}
public PlayerAuth(String nickname, String hash, String ip, long lastLogin, String email) {
public PlayerAuth(String nickname, String hash, String ip, long lastLogin, String email, String realName) {
this.nickname = nickname;
this.hash = hash;
this.ip = ip;
this.lastLogin = lastLogin;
this.email = email;
this.realName = realName;
}
public PlayerAuth(String nickname, int x, int y, int z, String world) {
@ -41,7 +36,7 @@ public class PlayerAuth {
this.world = world;
}
public PlayerAuth(String nickname, String hash, String ip, long lastLogin, int x, int y, int z, String world, String email) {
public PlayerAuth(String nickname, String hash, String ip, long lastLogin, int x, int y, int z, String world, String email, String realName) {
this.nickname = nickname;
this.hash = hash;
this.ip = ip;
@ -51,9 +46,10 @@ public class PlayerAuth {
this.z = z;
this.world = world;
this.email = email;
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) {
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) {
this.nickname = nickname;
this.hash = hash;
this.ip = ip;
@ -64,27 +60,30 @@ public class PlayerAuth {
this.world = world;
this.salt = salt;
this.groupId = groupId;
this.email = email;
this.email = email;
this.realName = realName;
}
public PlayerAuth(String nickname, String hash, String salt, int groupId , String ip, long lastLogin) {
public PlayerAuth(String nickname, String hash, String salt, int groupId , String ip, long lastLogin, String realName) {
this.nickname = nickname;
this.hash = hash;
this.ip = ip;
this.lastLogin = lastLogin;
this.salt = salt;
this.groupId = groupId;
this.realName = realName;
}
public PlayerAuth(String nickname, String hash, String salt, String ip, long lastLogin) {
public PlayerAuth(String nickname, String hash, String salt, String ip, long lastLogin, String realName) {
this.nickname = nickname;
this.hash = hash;
this.ip = ip;
this.lastLogin = lastLogin;
this.salt = salt;
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) {
public PlayerAuth(String nickname, String hash, String salt, String ip, long lastLogin, int x, int y, int z, String world, String email, String realName) {
this.nickname = nickname;
this.hash = hash;
this.ip = ip;
@ -94,19 +93,8 @@ public class PlayerAuth {
this.z = z;
this.world = world;
this.salt = salt;
this.email = email;
}
public PlayerAuth(String nickname, String hash, String ip, long lastLogin, int x, int y, int z, String world) {
this.nickname = nickname;
this.hash = hash;
this.ip = ip;
this.lastLogin = lastLogin;
this.x = x;
this.y = y;
this.z = z;
this.world = world;
this.email = "your@email.com";
this.email = email;
this.realName = realName;
}
public String getIp() {
@ -118,7 +106,7 @@ public class PlayerAuth {
}
public String getHash() {
if(!salt.isEmpty() && Settings.getPasswordHash == HashAlgorithm.MD5VB) {
if(salt != null && !salt.isEmpty() && Settings.getPasswordHash == HashAlgorithm.MD5VB) {
vBhash = "$MD5vb$"+salt+"$"+hash;
return vBhash;
}
@ -208,9 +196,13 @@ public class PlayerAuth {
@Override
public String toString() {
String s = "Player : " + nickname + " ! IP : " + ip + " ! LastLogin : " + lastLogin + " ! LastPosition : " + x + "," + y + "," + z + "," + world
+ " ! Email : " + email + " ! Hash : " + hash + " ! Salt : " + salt;
+ " ! Email : " + email + " ! Hash : " + hash + " ! Salt : " + salt + " ! RealName : " + realName;
return s;
}
public String getRealname() {
return realName;
}
}

View File

@ -3,12 +3,12 @@ package fr.xephi.authme.cache.limbo;
import java.util.HashMap;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.api.API;
import fr.xephi.authme.cache.backup.FileCache;
import fr.xephi.authme.events.ResetInventoryEvent;
import fr.xephi.authme.events.StoreInventoryEvent;
@ -30,6 +30,7 @@ public class LimboCache {
public void addLimboPlayer(Player player) {
String name = player.getName().toLowerCase();
Location loc = player.getLocation();
loc.setY(loc.getY() + 0.4D);
int gameMode = player.getGameMode().getValue();
ItemStack[] arm;
ItemStack[] inv;
@ -69,11 +70,11 @@ public class LimboCache {
}
if(Settings.isForceSurvivalModeEnabled) {
if(Settings.isResetInventoryIfCreative && gameMode != 0 ) {
if(Settings.isResetInventoryIfCreative && player.getGameMode() == GameMode.CREATIVE ) {
ResetInventoryEvent event = new ResetInventoryEvent(player);
Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
API.setPlayerInventory(player, new ItemStack[36], new ItemStack[4]);
player.getInventory().clear();
player.sendMessage("Your inventory has been cleaned!");
}
}

View File

@ -25,12 +25,14 @@ import org.bukkit.plugin.java.JavaPlugin;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.Utils;
import fr.xephi.authme.api.API;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.converter.FlatToSql;
import fr.xephi.authme.converter.FlatToSqlite;
import fr.xephi.authme.converter.RakamakConverter;
import fr.xephi.authme.converter.xAuthToFlat;
import fr.xephi.authme.converter.newxAuthToFlat;
import fr.xephi.authme.converter.oldxAuthToFlat;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.settings.Messages;
@ -66,6 +68,8 @@ public class AdminCommand implements CommandExecutor {
sender.sendMessage("/authme spawn - Teleport you to the AuthMe SpawnPoint");
sender.sendMessage("/authme chgemail <playername> <email> - Change player email");
sender.sendMessage("/authme getemail <playername> - Get player email");
sender.sendMessage("/authme purgelastpos <playername> - Purge last position for a player");
sender.sendMessage("/authme switchantibot on/off - Enable/Disable antibot method");
return true;
}
@ -100,7 +104,16 @@ public class AdminCommand implements CommandExecutor {
try {
long days = Long.parseLong(args[1]) * 86400000;
long until = new Date().getTime() - days;
sender.sendMessage("Deleted " + database.purgeDatabase(until) + " user accounts");
List<String> purged = database.autoPurgeDatabase(until);
sender.sendMessage("Deleted " + purged.size() + " user accounts");
if (Settings.purgeEssentialsFile && plugin.ess != null)
plugin.purgeEssentials(purged);
if (Settings.purgePlayerDat)
plugin.purgeDat(purged);
if (Settings.purgeLimitedCreative)
plugin.purgeLimitedCreative(purged);
if (Settings.purgeAntiXray)
plugin.purgeAntiXray(purged);
return true;
} catch (NumberFormatException e) {
sender.sendMessage("Usage: /authme purge <DAYS>");
@ -256,24 +269,27 @@ public class AdminCommand implements CommandExecutor {
}
try {
String name = args[1].toLowerCase();
String hash = PasswordSecurity.getHash(Settings.getPasswordHash, args[2], name);
if (database.isAuthAvailable(name)) {
sender.sendMessage(m._("user_regged"));
return true;
}
PlayerAuth auth = new PlayerAuth(name, hash, "198.18.0.1", 0);
auth.setSalt(PasswordSecurity.userSalt.get(name));
String hash = PasswordSecurity.getHash(Settings.getPasswordHash, args[2], name);
PlayerAuth auth = new PlayerAuth(name, hash, "198.18.0.1", 0L, "your@email.com", API.getPlayerRealName(name));
if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null)
auth.setSalt(PasswordSecurity.userSalt.get(name));
else
auth.setSalt("");
if (!database.saveAuth(auth)) {
sender.sendMessage(m._("error"));
return true;
}
database.updateSalt(auth);
sender.sendMessage(m._("registered"));
ConsoleLogger.info(args[1] + " registered");
} catch (NoSuchAlgorithmException ex) {
ConsoleLogger.showError(ex.getMessage());
sender.sendMessage(m._("error"));
}
return true;
} else if (args[0].equalsIgnoreCase("convertflattosql")) {
try {
FlatToSql.FlatToSqlConverter();
@ -294,13 +310,22 @@ public class AdminCommand implements CommandExecutor {
} catch (NullPointerException ex) {
System.out.println(ex.getMessage());
}
return true;
} else if (args[0].equalsIgnoreCase("xauthimport")) {
xAuthToFlat converter = new xAuthToFlat(plugin, database);
if (converter.convert(sender)) {
sender.sendMessage("[AuthMe] Successfull convert from xAuth database");
} else {
sender.sendMessage("[AuthMe] Error while trying to convert from xAuth database");
}
try {
Class.forName("com.cypherx.xauth.xAuth");
oldxAuthToFlat converter = new oldxAuthToFlat(plugin, database, sender);
converter.run();
} catch (ClassNotFoundException e) {
try {
Class.forName("de.luricos.bukkit.xAuth.xAuth");
newxAuthToFlat converter = new newxAuthToFlat(plugin, database, sender);
converter.run();
} catch (ClassNotFoundException ce) {
sender.sendMessage("[AuthMe] No version of xAuth found or xAuth isn't enable! ");
}
}
return true;
} else if (args[0].equalsIgnoreCase("getemail")) {
if (args.length != 2) {
sender.sendMessage("Usage: /authme getemail playername");
@ -343,6 +368,7 @@ public class AdminCommand implements CommandExecutor {
} catch (NullPointerException ex) {
ConsoleLogger.showError(ex.getMessage());
}
return true;
} else if (args[0].equalsIgnoreCase("setspawn")) {
try {
if (sender instanceof Player) {
@ -355,6 +381,7 @@ public class AdminCommand implements CommandExecutor {
} catch (NullPointerException ex) {
ConsoleLogger.showError(ex.getMessage());
}
return true;
} else if (args[0].equalsIgnoreCase("purgebannedplayers")) {
List<String> bannedPlayers = new ArrayList<String>();
for (OfflinePlayer off : plugin.getServer().getBannedPlayers()) {
@ -371,6 +398,15 @@ public class AdminCommand implements CommandExecutor {
}
});
}
if (Settings.purgeEssentialsFile && plugin.ess != null)
plugin.purgeEssentials(bannedPlayers);
if (Settings.purgePlayerDat)
plugin.purgeDat(bannedPlayers);
if (Settings.purgeLimitedCreative)
plugin.purgeLimitedCreative(bannedPlayers);
if (Settings.purgeAntiXray)
plugin.purgeAntiXray(bannedPlayers);
return true;
} else if (args[0].equalsIgnoreCase("spawn")) {
try {
if (sender instanceof Player) {
@ -383,6 +419,7 @@ public class AdminCommand implements CommandExecutor {
} catch (NullPointerException ex) {
ConsoleLogger.showError(ex.getMessage());
}
return true;
} else if (args[0].equalsIgnoreCase("changepassword") || args[0].equalsIgnoreCase("cp")) {
if (args.length != 3) {
sender.sendMessage("Usage: /authme changepassword playername newpassword");
@ -413,6 +450,7 @@ public class AdminCommand implements CommandExecutor {
ConsoleLogger.showError(ex.getMessage());
sender.sendMessage(m._("error"));
}
return true;
} else if (args[0].equalsIgnoreCase("unregister") || args[0].equalsIgnoreCase("unreg") || args[0].equalsIgnoreCase("del") ) {
if (args.length != 2) {
sender.sendMessage("Usage: /authme unregister playername");
@ -426,6 +464,49 @@ public class AdminCommand implements CommandExecutor {
PlayerCache.getInstance().removePlayer(name);
sender.sendMessage("unregistered");
ConsoleLogger.info(args[1] + " unregistered");
return true;
} else if (args[0].equalsIgnoreCase("purgelastpos")){
if (args.length != 2) {
sender.sendMessage("Usage: /authme purgelastpos playername");
return true;
}
try {
String name = args[1].toLowerCase();
PlayerAuth auth = database.getAuth(name);
if (auth == null) {
sender.sendMessage("The player " + name + " is not registered ");
return true;
}
auth.setQuitLocX(0);
auth.setQuitLocY(0);
auth.setQuitLocZ(0);
auth.setWorld("world");
database.updateQuitLoc(auth);
sender.sendMessage(name + " 's last pos location is now reset");
} catch (Exception e) {
ConsoleLogger.showError("An error occured while trying to reset location or player do not exist, please see below: ");
ConsoleLogger.showError(e.getMessage());
if (sender instanceof Player)
sender.sendMessage("An error occured while trying to reset location or player do not exist, please see logs");
}
return true;
} else if (args[0].equalsIgnoreCase("switchantibot")) {
if (args.length != 2) {
sender.sendMessage("Usage : /authme switchantibot on/off");
return true;
}
if (args[1].equalsIgnoreCase("on")) {
plugin.switchAntiBotMod(true);
sender.sendMessage("[AuthMe] AntiBotMod enabled");
return true;
}
if (args[1].equalsIgnoreCase("off")) {
plugin.switchAntiBotMod(false);
sender.sendMessage("[AuthMe] AntiBotMod disabled");
return true;
}
sender.sendMessage("Usage : /authme switchantibot on/off");
return true;
} else {
sender.sendMessage("Usage: /authme reload|register playername password|changepassword playername password|unregister playername");
}

View File

@ -59,7 +59,10 @@ public class ChangePasswordCommand implements CommandExecutor {
if (PasswordSecurity.comparePasswordWithHash(args[0], PlayerCache.getInstance().getAuth(name).getHash(), name)) {
PlayerAuth auth = PlayerCache.getInstance().getAuth(name);
auth.setHash(hashnew);
auth.setSalt(PasswordSecurity.userSalt.get(name));
if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null)
auth.setSalt(PasswordSecurity.userSalt.get(name));
else
auth.setSalt("");
if (!database.updatePassword(auth)) {
player.sendMessage(m._("error"));
return true;

View File

@ -35,7 +35,7 @@ public class LoginCommand implements CommandExecutor {
player.sendMessage(m._("no_perm"));
return true;
}
plugin.management.performLogin(player, args[0], false);
plugin.management.performLogin(player, args[0], false, false);
return true;
}
}

View File

@ -65,18 +65,14 @@ public class LogoutCommand implements CommandExecutor {
PlayerAuth auth = PlayerCache.getInstance().getAuth(name);
auth.setIp("198.18.0.1");
database.updateSession(auth);
auth.setQuitLocX(player.getLocation().getBlockX());
auth.setQuitLocY(player.getLocation().getBlockY());
auth.setQuitLocZ(player.getLocation().getBlockZ());
auth.setWorld(player.getWorld().getName());
database.updateQuitLoc(auth);
PlayerCache.getInstance().removePlayer(name);
LimboCache.getInstance().addLimboPlayer(player , utils.removeAll(player));
LimboCache.getInstance().addLimboPlayer(player);
if(Settings.protectInventoryBeforeLogInEnabled) {
player.getInventory().setArmorContents(new ItemStack[4]);
player.getInventory().setContents(new ItemStack[36]);
// create cache file for handling lost of inventories on unlogged in status
DataFileCache playerData = new DataFileCache(player.getInventory().getContents(),player.getInventory().getArmorContents());
playerBackup.createCache(name, playerData, LimboCache.getInstance().getLimboPlayer(name).getGroup(),LimboCache.getInstance().getLimboPlayer(name).getOperator(),LimboCache.getInstance().getLimboPlayer(name).isFlying());
}
if (Settings.isTeleportToSpawnEnabled) {
Location spawnLoc = player.getWorld().getSpawnLocation();
if (plugin.essentialsSpawn != null) {
@ -94,6 +90,17 @@ public class LogoutCommand implements CommandExecutor {
}
}
if (LimboCache.getInstance().hasLimboPlayer(name))
LimboCache.getInstance().deleteLimboPlayer(name);
LimboCache.getInstance().addLimboPlayer(player , utils.removeAll(player));
LimboCache.getInstance().addLimboPlayer(player);
if(Settings.protectInventoryBeforeLogInEnabled) {
player.getInventory().clear();
// create cache file for handling lost of inventories on unlogged in status
DataFileCache playerData = new DataFileCache(LimboCache.getInstance().getLimboPlayer(name).getInventory(),LimboCache.getInstance().getLimboPlayer(name).getArmour());
playerBackup.createCache(name, playerData, LimboCache.getInstance().getLimboPlayer(name).getGroup(),LimboCache.getInstance().getLimboPlayer(name).getOperator(),LimboCache.getInstance().getLimboPlayer(name).isFlying());
}
int delay = Settings.getRegistrationTimeout * 20;
int interval = Settings.getWarnMessageInterval;
BukkitScheduler sched = sender.getServer().getScheduler();

View File

@ -18,7 +18,7 @@ import fr.xephi.authme.settings.Messages;
public class PasspartuCommand implements CommandExecutor {
private Utils utils = new Utils();
public AuthMe plugin;
private Messages m;
private Messages m = Messages.getInstance();
public PasspartuCommand(AuthMe plugin) {
this.plugin = plugin;
@ -39,7 +39,7 @@ public class PasspartuCommand implements CommandExecutor {
if ((sender instanceof Player) && args.length == 1) {
if(utils.readToken(args[0])) {
//bypass login!
plugin.management.performLogin((Player) sender, "dontneed", true);
plugin.management.performLogin((Player) sender, "dontneed", true, false);
return true;
}
sender.sendMessage("Time is expired or Token is Wrong!");

View File

@ -126,7 +126,7 @@ public class RegisterCommand implements CommandExecutor {
if (PasswordSecurity.userSalt.containsKey(name)) {
try {
final String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, thePass, name);
final PlayerAuth fAuth = new PlayerAuth(name, hashnew, PasswordSecurity.userSalt.get(name), ip, new Date().getTime(), (int) player.getLocation().getX() , (int) player.getLocation().getY(), (int) player.getLocation().getZ(), player.getLocation().getWorld().getName(), email);
final PlayerAuth fAuth = new PlayerAuth(name, hashnew, PasswordSecurity.userSalt.get(name), ip, new Date().getTime(), (int) player.getLocation().getX() , (int) player.getLocation().getY(), (int) player.getLocation().getZ(), player.getLocation().getWorld().getName(), email, player.getName());
database.saveAuth(fAuth);
database.updateEmail(fAuth);
database.updateSession(fAuth);
@ -137,7 +137,7 @@ public class RegisterCommand implements CommandExecutor {
} else {
try {
final String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, thePass, name);
final PlayerAuth fAuth = new PlayerAuth(name, hashnew, ip, new Date().getTime(), (int) player.getLocation().getX() , (int) player.getLocation().getY(), (int) player.getLocation().getZ(), player.getLocation().getWorld().getName(), email);
final PlayerAuth fAuth = new PlayerAuth(name, hashnew, ip, new Date().getTime(), (int) player.getLocation().getX() , (int) player.getLocation().getY(), (int) player.getLocation().getZ(), player.getLocation().getWorld().getName(), email, player.getName());
database.saveAuth(fAuth);
database.updateEmail(fAuth);
database.updateSession(fAuth);
@ -216,9 +216,9 @@ public class RegisterCommand implements CommandExecutor {
hash = PasswordSecurity.getHash(Settings.getPasswordHash, args[0], name);
if (Settings.getMySQLColumnSalt.isEmpty())
{
auth = new PlayerAuth(name, hash, ip, new Date().getTime());
auth = new PlayerAuth(name, hash, ip, new Date().getTime(), "your@email.com", player.getName());
} else {
auth = new PlayerAuth(name, hash, PasswordSecurity.userSalt.get(name), ip, new Date().getTime());
auth = new PlayerAuth(name, hash, PasswordSecurity.userSalt.get(name), ip, new Date().getTime(), player.getName());
}
if (!database.saveAuth(auth)) {
player.sendMessage(m._("error"));

View File

@ -77,6 +77,8 @@ public class FlatToSql {
newline = "INSERT INTO " + tableName + " VALUES (" + i + ", '" + args[0] + "', '" + args[1] + "', '" + args[2] + "', " + args[3] + ", " + args[4] + ", " + args[5] + ", " + args[6] + ", 'world', 'your@email.com');";
else if (args.length == 8)
newline = "INSERT INTO " + tableName + " VALUES (" + i + ", '" + args[0] + "', '" + args[1] + "', '" + args[2] + "', " + args[3] + ", " + args[4] + ", " + args[5] + ", " + args[6] + ", '" + args[7] + "', 'your@email.com');";
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 != "")

View File

@ -73,6 +73,8 @@ public class FlatToSqlite {
newline = "INSERT INTO " + tableName + " VALUES (" + i + ", '" + args[0] + "', '" + args[1] + "', '" + args[2] + "', " + args[3] + ", " + args[4] + ", " + args[5] + ", " + args[6] + ", 'world', 'your@email.com');";
else if (args.length == 8)
newline = "INSERT INTO " + tableName + " VALUES (" + i + ", '" + args[0] + "', '" + args[1] + "', '" + args[2] + "', " + args[3] + ", " + args[4] + ", " + args[5] + ", " + args[6] + ", '" + args[7] + "', 'your@email.com');";
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 != "")

View File

@ -94,12 +94,12 @@ public class RakamakConverter {
String player = m.getKey();
String psw = playerPSW.get(player);
String ip = playerIP.get(player);
newLine = player + ":" + psw + ":" + ip + ":1325376060:0:0:0";
newLine = player + ":" + psw + ":" + ip + ":1325376060:0:0:0:world:your@email.com";
} else {
String player = m.getKey();
String psw = playerPSW.get(player);
String ip = "127.0.0.1";
newLine = player + ":" + psw + ":" + ip + ":1325376060:0:0:0";
newLine = player + ":" + psw + ":" + ip + ":1325376060:0:0:0:world:your@email.com";
}
if (alreadyExist) outputDB.newLine();
outputDB.write(newLine);

View File

@ -0,0 +1,137 @@
package fr.xephi.authme.converter;
import java.io.File;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.command.CommandSender;
import de.luricos.bukkit.xAuth.xAuth;
import de.luricos.bukkit.xAuth.database.Table;
import de.luricos.bukkit.xAuth.utils.xAuthLog;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.api.API;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
public class newxAuthToFlat extends Thread {
public AuthMe instance;
public DataSource database;
public CommandSender sender;
public newxAuthToFlat(AuthMe instance, DataSource database, CommandSender sender) {
this.instance = instance;
this.database = database;
this.sender = sender;
}
public void run() {
convert();
if (isAlive())
interrupt();
}
public boolean convert() {
if (instance.getServer().getPluginManager().getPlugin("xAuth") == null) {
sender.sendMessage("[AuthMe] xAuth plugin not found");
return false;
}
if (!(new File("./plugins/xAuth/xAuth.h2.db").exists())) {
sender.sendMessage("[AuthMe] xAuth H2 database not found, checking for MySQL or SQLite data...");
}
List<Integer> players = getXAuthPlayers();
if (players == null || players.isEmpty()) {
sender.sendMessage("[AuthMe] Error while import xAuthPlayers");
return false;
}
sender.sendMessage("[AuthMe] Starting import...");
try {
for (int id : players) {
String pl = getIdPlayer(id);
String psw = getPassword(id);
if (psw != null && !psw.isEmpty() && pl != null) {
PlayerAuth auth = new PlayerAuth(pl, psw, "198.18.0.1", 0, "your@email.com", API.getPlayerRealName(pl));
database.saveAuth(auth);
}
}
sender.sendMessage("[AuthMe] Successfull convert from xAuth database");
} catch (Exception e) {
sender.sendMessage("[AuthMe] An error has been thrown while import xAuth database, the import hadn't fail but can be not complete ");
}
return true;
}
public String getIdPlayer(int id) {
String realPass = "";
Connection conn = xAuth.getPlugin().getDatabaseController().getConnection();
PreparedStatement ps = null;
ResultSet rs = null;
try {
String sql = String.format("SELECT `playername` FROM `%s` WHERE `id` = ?",
xAuth.getPlugin().getDatabaseController().getTable(Table.ACCOUNT));
ps = conn.prepareStatement(sql);
ps.setInt(1, id);
rs = ps.executeQuery();
if (!rs.next())
return null;
realPass = rs.getString("playername").toLowerCase();
} catch (SQLException e) {
xAuthLog.severe("Failed to retrieve name for account: " + id, e);
return null;
} finally {
xAuth.getPlugin().getDatabaseController().close(conn, ps, rs);
}
return realPass;
}
public List<Integer> getXAuthPlayers() {
List<Integer> xP = new ArrayList<Integer>();
Connection conn = xAuth.getPlugin().getDatabaseController().getConnection();
PreparedStatement ps = null;
ResultSet rs = null;
try {
String sql = String.format("SELECT * FROM `%s`",
xAuth.getPlugin().getDatabaseController().getTable(Table.ACCOUNT));
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
while(rs.next()) {
xP.add(rs.getInt("id"));
}
} catch (SQLException e) {
xAuthLog.severe("Cannot import xAuthPlayers", e);
return new ArrayList<Integer>();
} finally {
xAuth.getPlugin().getDatabaseController().close(conn, ps, rs);
}
return xP;
}
public String getPassword(int accountId) {
String realPass = "";
Connection conn = xAuth.getPlugin().getDatabaseController().getConnection();
PreparedStatement ps = null;
ResultSet rs = null;
try {
String sql = String.format("SELECT `password`, `pwtype` FROM `%s` WHERE `id` = ?",
xAuth.getPlugin().getDatabaseController().getTable(Table.ACCOUNT));
ps = conn.prepareStatement(sql);
ps.setInt(1, accountId);
rs = ps.executeQuery();
if (!rs.next())
return null;
realPass = rs.getString("password");
} catch (SQLException e) {
xAuthLog.severe("Failed to retrieve password hash for account: " + accountId, e);
return null;
} finally {
xAuth.getPlugin().getDatabaseController().close(conn, ps, rs);
}
return realPass;
}
}

View File

@ -15,6 +15,7 @@ import com.cypherx.xauth.database.Table;
import com.cypherx.xauth.utils.xAuthLog;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.api.API;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
@ -23,17 +24,25 @@ import fr.xephi.authme.datasource.DataSource;
*
* @author Xephi59
*/
public class xAuthToFlat {
public class oldxAuthToFlat extends Thread {
public AuthMe instance;
public DataSource database;
public CommandSender sender;
public xAuthToFlat(AuthMe instance, DataSource database) {
public oldxAuthToFlat(AuthMe instance, DataSource database, CommandSender sender) {
this.instance = instance;
this.database = database;
this.sender = sender;
}
public void run() {
convert();
if (isAlive())
interrupt();
}
public boolean convert(CommandSender sender) {
public boolean convert() {
if (instance.getServer().getPluginManager().getPlugin("xAuth") == null) {
sender.sendMessage("[AuthMe] xAuth plugin not found");
return false;
@ -47,15 +56,19 @@ public class xAuthToFlat {
return false;
}
sender.sendMessage("[AuthMe] Starting import...");
for (int id : players) {
String pl = getIdPlayer(id);
String psw = getPassword(id);
if (psw != null && !psw.isEmpty() && pl != null) {
PlayerAuth auth = new PlayerAuth(pl, psw, "198.18.0.1", 0);
database.saveAuth(auth);
try {
for (int id : players) {
String pl = getIdPlayer(id);
String psw = getPassword(id);
if (psw != null && !psw.isEmpty() && pl != null) {
PlayerAuth auth = new PlayerAuth(pl, psw, "198.18.0.1", 0, "your@email.com", API.getPlayerRealName(pl));
database.saveAuth(auth);
}
}
sender.sendMessage("[AuthMe] Successfull convert from xAuth database");
} catch (Exception e) {
sender.sendMessage("[AuthMe] An error has been thrown while import xAuth database, the import hadn't fail but can be not complete ");
}
sender.sendMessage("[AuthMe] Import done!");
return true;
}

View File

@ -11,6 +11,7 @@ import java.util.ArrayList;
import java.util.List;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.api.API;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.settings.Settings;
@ -19,9 +20,10 @@ public class FileDataSource implements DataSource {
/* file layout:
*
* PLAYERNAME:HASHSUM:IP:LOGININMILLIESECONDS:LASTPOSX:LASTPOSY:LASTPOSZ:LASTPOSWORLD
* PLAYERNAME:HASHSUM:IP:LOGININMILLIESECONDS:LASTPOSX:LASTPOSY:LASTPOSZ:LASTPOSWORLD:EMAIL
*
* Old but compatible:
* PLAYERNAME:HASHSUM:IP:LOGININMILLIESECONDS:LASTPOSX:LASTPOSY:LASTPOSZ:LASTPOSWORLD
* PLAYERNAME:HASHSUM:IP:LOGININMILLIESECONDS
* PLAYERNAME:HASHSUM:IP
* PLAYERNAME:HASHSUM
@ -71,7 +73,7 @@ public class FileDataSource implements DataSource {
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter(source, true));
bw.write(auth.getNickname() + ":" + auth.getHash() + ":" + auth.getIp() + ":" + auth.getLastLogin() + ":" + auth.getQuitLocX() + ":" + auth.getQuitLocY() + ":" + auth.getQuitLocZ() + ":" + auth.getWorld() + "\n");
bw.write(auth.getNickname() + ":" + auth.getHash() + ":" + auth.getIp() + ":" + auth.getLastLogin() + ":" + auth.getQuitLocX() + ":" + auth.getQuitLocY() + ":" + auth.getQuitLocZ() + ":" + auth.getWorld() + ":" + auth.getEmail() + "\n");
} catch (IOException ex) {
ConsoleLogger.showError(ex.getMessage());
return false;
@ -101,19 +103,23 @@ public class FileDataSource implements DataSource {
if (args[0].equals(auth.getNickname())) {
switch (args.length) {
case 4: {
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), 0, 0, 0, "world");
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), 0, 0, 0, "world", "your@email.com", API.getPlayerRealName(args[0]));
break;
}
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");
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]));
break;
}
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]);
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]));
break;
}
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]));
break;
}
default: {
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], 0, 0, 0, 0, "world");
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], 0, 0, 0, 0, "world", "your@email.com", API.getPlayerRealName(args[0]));
break;
}
}
@ -154,19 +160,23 @@ public class FileDataSource implements DataSource {
if (args[0].equals(auth.getNickname())) {
switch (args.length) {
case 4: {
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), 0, 0, 0, "world");
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), 0, 0, 0, "world", "your@email.com", API.getPlayerRealName(args[0]));
break;
}
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");
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]));
break;
}
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]);
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]));
break;
}
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]));
break;
}
default: {
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), 0, 0, 0, "world");
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), 0, 0, 0, "world", "your@email.com", API.getPlayerRealName(args[0]));
break;
}
}
@ -205,7 +215,7 @@ public class FileDataSource implements DataSource {
while ((line = br.readLine()) != null) {
String[] args = line.split(":");
if (args[0].equals(auth.getNickname())) {
newAuth = new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ(), auth.getWorld());
newAuth = new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ(), auth.getWorld(), auth.getEmail(), API.getPlayerRealName(args[0]));
break;
}
}
@ -407,15 +417,17 @@ public class FileDataSource implements DataSource {
if (args[0].equals(user)) {
switch (args.length) {
case 2:
return new PlayerAuth(args[0], args[1], "198.18.0.1", 0);
return new PlayerAuth(args[0], args[1], "198.18.0.1", 0, "your@email.com", API.getPlayerRealName(args[0]));
case 3:
return new PlayerAuth(args[0], args[1], args[2], 0);
return new PlayerAuth(args[0], args[1], args[2], 0, "your@email.com", API.getPlayerRealName(args[0]));
case 4:
return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]));
return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), "your@email.com", API.getPlayerRealName(args[0]));
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");
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]));
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]);
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]));
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]));
}
}
}
@ -446,7 +458,38 @@ public class FileDataSource implements DataSource {
@Override
public boolean updateEmail(PlayerAuth auth) {
return false;
if (!isAuthAvailable(auth.getNickname())) {
return false;
}
PlayerAuth newAuth = null;
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(source));
String line = "";
while ((line = br.readLine()) != null) {
String[] args = line.split(":");
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]));
break;
}
}
} catch (FileNotFoundException ex) {
ConsoleLogger.showError(ex.getMessage());
return false;
} catch (IOException ex) {
ConsoleLogger.showError(ex.getMessage());
return false;
} finally {
if (br != null) {
try {
br.close();
} catch (IOException ex) {
}
}
}
removeAuth(auth.getNickname());
saveAuth(newAuth);
return true;
}
@Override
@ -511,12 +554,37 @@ public class FileDataSource implements DataSource {
} catch (IOException ex) {
}
}
}
}
}
@Override
public List<String> getAllAuthsByEmail(String email) {
return new ArrayList<String>();
BufferedReader br = null;
List<String> countEmail = new ArrayList<String>();
try {
br = new BufferedReader(new FileReader(source));
String line;
while ((line = br.readLine()) != null) {
String[] args = line.split(":");
if (args.length > 8 && args[8].equals(email)) {
countEmail.add(args[0]);
}
}
return countEmail;
} catch (FileNotFoundException ex) {
ConsoleLogger.showError(ex.getMessage());
return new ArrayList<String>();
} catch (IOException ex) {
ConsoleLogger.showError(ex.getMessage());
return new ArrayList<String>();
} finally {
if (br != null) {
try {
br.close();
} catch (IOException ex) {
}
}
}
}
@Override

View File

@ -4,6 +4,7 @@ import com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.api.API;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.datasource.MiniConnectionPoolManager.TimeoutException;
import fr.xephi.authme.security.HashAlgorithm;
@ -177,14 +178,14 @@ public class MySQLDataSource implements DataSource {
rs = pst.executeQuery();
if (rs.next()) {
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));
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)));
} else {
if(!columnSalt.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));
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));
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)));
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(columnIp), rs.getLong(columnLastLogin), rs.getInt(lastlocX), rs.getInt(lastlocY), rs.getInt(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail));
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)));
}
}
} else {
@ -209,7 +210,7 @@ public class MySQLDataSource implements DataSource {
PreparedStatement pst = null;
try {
con = makeSureConnectionIsReady();
if ((columnSalt.isEmpty() || columnSalt == null) && (auth.getSalt().isEmpty() || auth.getSalt() == null)) {
if ((columnSalt == null || columnSalt.isEmpty()) && (auth.getSalt() == null || auth.getSalt().isEmpty())) {
pst = con.prepareStatement("INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + "," + columnIp + "," + columnLastLogin + ") VALUES (?,?,?,?);");
pst.setString(1, auth.getNickname());
pst.setString(2, auth.getHash());
@ -227,8 +228,8 @@ public class MySQLDataSource implements DataSource {
}
if (!columnOthers.isEmpty()) {
for(String column : columnOthers) {
pst = con.prepareStatement("UPDATE " + tableName + " SET " + tableName + "." + column + "=? WHERE " + columnName + "=?;");
pst.setString(1, auth.getNickname());
pst = con.prepareStatement("UPDATE " + tableName + " SET " + column + "=? WHERE " + columnName + "=?;");
pst.setString(1, auth.getRealname());
pst.setString(2, auth.getNickname());
pst.executeUpdate();
}
@ -241,12 +242,30 @@ public class MySQLDataSource implements DataSource {
rs = pst.executeQuery();
if (rs.next()) {
id = rs.getInt(columnID);
// Insert player in phpbb_user_group
pst = con.prepareStatement("INSERT INTO " + Settings.getPhpbbPrefix + "user_group (group_id, user_id, group_leader, user_pending) VALUES (?,?,?,?);");
pst.setInt(1, Settings.getPhpbbGroup);
pst.setInt(2, id);
pst.setInt(3, 0);
pst.setInt(4, 0);
pst.executeUpdate();
// Update player group in phpbb_users
pst = con.prepareStatement("UPDATE " + tableName + " SET " + tableName + ".group_id=? WHERE " + columnName + "=?;");
pst.setInt(1, Settings.getPhpbbGroup);
pst.setString(2, auth.getNickname());
pst.executeUpdate();
// Get current time without ms
long time = System.currentTimeMillis()/1000;
// Update user_regdate
pst = con.prepareStatement("UPDATE " + tableName + " SET " + tableName + ".user_regdate=? WHERE " + columnName + "=?;");
pst.setLong(1, time);
pst.setString(2, auth.getNickname());
pst.executeUpdate();
// Update user_lastvisit
pst = con.prepareStatement("UPDATE " + tableName + " SET " + tableName + ".user_lastvisit=? WHERE " + columnName + "=?;");
pst.setLong(1, time);
pst.setString(2, auth.getNickname());
pst.executeUpdate();
}
}
if (Settings.getPasswordHash == HashAlgorithm.WORDPRESS) {
@ -426,6 +445,9 @@ public class MySQLDataSource implements DataSource {
while (rs.next()) {
list.add(rs.getString(columnName));
}
pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE " + columnLastLogin + "<?;");
pst.setLong(1, until);
pst.executeUpdate();
return list;
} catch (SQLException ex) {
ConsoleLogger.showError(ex.getMessage());

View File

@ -7,6 +7,7 @@ import java.util.List;
import org.sqlite.*;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.api.API;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.datasource.MiniConnectionPoolManager.TimeoutException;
import fr.xephi.authme.settings.Settings;
@ -147,12 +148,12 @@ public class SqliteDataSource implements DataSource {
rs = pst.executeQuery();
if (rs.next()) {
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));
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)));
} else {
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));
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)));
} 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));
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)));
}
}
} else {

View File

@ -41,4 +41,8 @@ public class LoginEvent extends Event {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@ -41,4 +41,8 @@ public class PasswordEncryptionEvent extends Event {
return playerName;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@ -117,7 +117,7 @@ public class LoginScreen extends GenericPopup implements Clickable{
if (event.isCancelled() || event == null || event.getPlayer() == null) return;
if (b.equals(loginBtn))
{
plugin.management.performLogin(player, passBox.getText(), false);
plugin.management.performLogin(player, passBox.getText(), false, false);
}else if(b.equals(exitBtn))
{
event.getPlayer().kickPlayer(exitMsg);

View File

@ -8,6 +8,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.Utils;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.datasource.DataSource;
@ -16,9 +17,11 @@ import fr.xephi.authme.settings.Settings;
public class AuthMeBungeeCordListener implements Listener {
private DataSource data;
private AuthMe plugin;
public AuthMeBungeeCordListener(DataSource data) {
this.data = data;
public AuthMeBungeeCordListener(DataSource data, AuthMe plugin) {
this.data = data;
this.plugin = plugin;
}
@EventHandler (priority = EventPriority.LOWEST)
@ -27,9 +30,20 @@ public class AuthMeBungeeCordListener implements Listener {
if (event.isCancelled()) return;
if (!event.isCommand()) return;
Player player = null;
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
if (p.getAddress().getAddress().equals(event.getReceiver().getAddress().getAddress())) {
player = p;
try {
for (String p : plugin.realIp.keySet()) {
Player pl = Bukkit.getPlayer(p);
if (pl != null) {
if (plugin.realIp.get(p).equalsIgnoreCase(event.getSender().getAddress().getAddress().getHostAddress()))
player = pl;
}
}
} catch (Exception e) {}
if (player == null) {
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
if (p.getAddress().getAddress().equals(event.getSender().getAddress().getAddress())) {
player = p;
}
}
}
String name = player.getName().toLowerCase();

View File

@ -24,6 +24,7 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerBedEnterEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerGameModeChangeEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
@ -65,11 +66,14 @@ public class AuthMePlayerListener implements Listener {
public static int gm = 0;
public static HashMap<String, Integer> gameMode = new HashMap<String, Integer>();
public static HashMap<String, String> joinMessage = new HashMap<String, String>();
private Utils utils = Utils.getInstance();
private Messages m = Messages.getInstance();
public AuthMe plugin;
private DataSource data;
private FileCache playerBackup = new FileCache();
public boolean causeByAuthMe = false;
private HashMap<String, PlayerLoginEvent> antibot = new HashMap<String, PlayerLoginEvent>();
public AuthMePlayerListener(AuthMe plugin, DataSource data) {
this.plugin = plugin;
@ -384,6 +388,21 @@ public class AuthMePlayerListener implements Listener {
return;
}
if (Settings.enableProtection && !Settings.countries.isEmpty()) {
String code = plugin.getCountryCode(event.getAddress());
if (((code == null) || (!Settings.countries.contains(code) && !API.isRegistered(name))) && !plugin.authmePermissible(player, "authme.bypassantibot")) {
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, m._("country_banned"));
return;
}
}
if (Settings.isKickNonRegisteredEnabled) {
if (!data.isAuthAvailable(name)) {
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, m._("reg_only"));
return;
}
}
if (player.isOnline() && Settings.isForceSingleSessionEnabled) {
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, m._("same_nick"));
return;
@ -442,11 +461,19 @@ public class AuthMePlayerListener implements Listener {
return;
}
if (Settings.isKickNonRegisteredEnabled) {
if (!data.isAuthAvailable(name)) {
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, m._("reg_only"));
return;
if (event.getResult() == PlayerLoginEvent.Result.ALLOWED) {
checkAntiBotMod(event);
if (Settings.bungee) {
final ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
try {
out.writeUTF("IP");
} catch (IOException e) {
}
player.sendPluginMessage(plugin, "BungeeCord", b.toByteArray());
}
return;
}
if (event.getResult() != PlayerLoginEvent.Result.KICK_FULL) return;
if (player.isBanned()) return;
@ -467,34 +494,38 @@ public class AuthMePlayerListener implements Listener {
} else {
ConsoleLogger.info("The player " + player.getName() + " wants to join, but the server is full");
event.disallow(Result.KICK_FULL, m._("kick_fullserver"));
return;
}
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerLowestJoin(PlayerJoinEvent event) {
if (event.getPlayer() == null) return;
final Player player = event.getPlayer();
if (plugin.getCitizensCommunicator().isNPC(player, plugin) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
return;
}
if (Settings.bungee) {
final ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
try {
out.writeUTF("IP");
} catch (IOException e) {
}
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override
public void run() {
player.sendPluginMessage(plugin, "BungeeCord", b.toByteArray());
}
});
}
private void checkAntiBotMod(final PlayerLoginEvent event) {
if (plugin.delayedAntiBot || plugin.antibotMod)
return;
if (plugin.authmePermissible(event.getPlayer(), "authme.bypassantibot"))
return;
if (antibot.keySet().size() > Settings.antiBotSensibility) {
plugin.switchAntiBotMod(true);
Bukkit.broadcastMessage(m._("antibot_auto_enabled"));
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
@Override
public void run() {
if (plugin.antibotMod) {
plugin.switchAntiBotMod(false);
antibot.clear();
Bukkit.broadcastMessage(m._("antibot_auto_disabled").replace("%m", "" + Settings.antiBotDuration));
}
}
}, Settings.antiBotDuration * 1200);
return;
}
antibot.put(event.getPlayer().getName().toLowerCase(), event);
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
@Override
public void run() {
antibot.remove(event.getPlayer().getName().toLowerCase());
}
}, 300);
}
@EventHandler(priority = EventPriority.HIGHEST)
@ -510,14 +541,16 @@ public class AuthMePlayerListener implements Listener {
final String name = player.getName().toLowerCase();
gameMode.put(name, gm);
BukkitScheduler sched = plugin.getServer().getScheduler();
final PlayerJoinEvent e = event;
if (plugin.getCitizensCommunicator().isNPC(player, plugin) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
return;
}
if (plugin.ess != null && Settings.disableSocialSpy)
plugin.ess.getUser(player.getName()).setSocialSpyEnabled(false);
if (plugin.ess != null && Settings.disableSocialSpy) {
try {
plugin.ess.getUser(player.getName()).setSocialSpyEnabled(false);
} catch (Exception e) {}
}
String ip = player.getAddress().getAddress().getHostAddress();
if (Settings.bungee) {
@ -526,7 +559,9 @@ public class AuthMePlayerListener implements Listener {
}
if(Settings.isAllowRestrictedIp && !Settings.getRestrictedIp(name, ip)) {
int gM = gameMode.get(name);
this.causeByAuthMe = true;
player.setGameMode(GameMode.getByValue(gM));
this.causeByAuthMe = false;
player.kickPlayer("You are not the Owner of this account, please try another name!");
if (Settings.banUnsafeIp)
plugin.getServer().banIP(ip);
@ -550,22 +585,25 @@ public class AuthMePlayerListener implements Listener {
return;
} else if (!Settings.sessionExpireOnIpChange){
int gM = gameMode.get(name);
this.causeByAuthMe = true;
player.setGameMode(GameMode.getByValue(gM));
this.causeByAuthMe = false;
player.kickPlayer(m._("unvalid_session"));
return;
} else if (auth.getNickname().equalsIgnoreCase(name)){
if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin)
sched.scheduleSyncDelayedTask(plugin, new Runnable() {
public void run() {
e.getPlayer().setGameMode(GameMode.SURVIVAL);
}
});
if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) {
this.causeByAuthMe = true;
Utils.forceGM(player);
this.causeByAuthMe = false;
}
//Player change his IP between 2 relog-in
PlayerCache.getInstance().removePlayer(name);
LimboCache.getInstance().addLimboPlayer(player , utils.removeAll(player));
} else {
int gM = gameMode.get(name);
this.causeByAuthMe = true;
player.setGameMode(GameMode.getByValue(gM));
this.causeByAuthMe = false;
player.kickPlayer(m._("unvalid_session"));
return;
}
@ -576,8 +614,11 @@ public class AuthMePlayerListener implements Listener {
}
}
// isent in session or session was ended correctly
if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin)
e.getPlayer().setGameMode(GameMode.SURVIVAL);
if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) {
this.causeByAuthMe = true;
Utils.forceGM(player);
this.causeByAuthMe = false;
}
if (Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName()))) {
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, PlayerCache.getInstance().isAuthenticated(name));
plugin.getServer().getPluginManager().callEvent(tpEvent);
@ -593,8 +634,11 @@ public class AuthMePlayerListener implements Listener {
DataFileCache dataFile = new DataFileCache(LimboCache.getInstance().getLimboPlayer(name).getInventory(),LimboCache.getInstance().getLimboPlayer(name).getArmour());
playerBackup.createCache(name, dataFile, LimboCache.getInstance().getLimboPlayer(name).getGroup(),LimboCache.getInstance().getLimboPlayer(name).getOperator(),LimboCache.getInstance().getLimboPlayer(name).isFlying());
} else {
if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin)
e.getPlayer().setGameMode(GameMode.SURVIVAL);
if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) {
this.causeByAuthMe = true;
Utils.forceGM(player);
this.causeByAuthMe = false;
}
if(!Settings.unRegisteredGroup.isEmpty()){
utils.setGroup(player, Utils.groupType.UNREGISTERED);
}
@ -643,6 +687,10 @@ public class AuthMePlayerListener implements Listener {
player.setNoDamageTicks(Settings.getRegistrationTimeout * 20);
if (Settings.useEssentialsMotd)
player.performCommand("motd");
// Remove the join message while the player isn't logging in
joinMessage.put(name, event.getJoinMessage());
event.setJoinMessage(null);
}
private void placePlayerSafely(Player player, Location spawnLoc) {
@ -688,7 +736,9 @@ public class AuthMePlayerListener implements Listener {
}
} catch (NullPointerException npe) { }
}
}
} else {
event.setQuitMessage(null);
}
if (LimboCache.getInstance().hasLimboPlayer(name)) {
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name);
@ -762,6 +812,8 @@ public class AuthMePlayerListener implements Listener {
});
}
} catch (NullPointerException npe) { }
} else if (!PlayerCache.getInstance().isAuthenticated(name)){
event.setLeaveMessage(null);
}
if (LimboCache.getInstance().hasLimboPlayer(name))
@ -1040,12 +1092,48 @@ public class AuthMePlayerListener implements Listener {
if (!data.isAuthAvailable(name))
if (!Settings.isForcedRegistrationEnabled)
return;
if (!Settings.isTeleportToSpawnEnabled && !Settings.isForceSpawnLocOnJoinEnabled)
return;
Location spawn = plugin.getSpawnLocation(player.getWorld());
if(Settings.isSaveQuitLocationEnabled && data.isAuthAvailable(name)) {
final PlayerAuth auth = new PlayerAuth(name,spawn.getBlockX(),spawn.getBlockY(),spawn.getBlockZ(),spawn.getWorld().getName());
try {
data.updateQuitLoc(auth);
} catch (NullPointerException npe) { }
}
event.setRespawnLocation(spawn);
}
@EventHandler (priority = EventPriority.HIGHEST)
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {
if (event.isCancelled())
return;
if (event.getPlayer() == null || event == null)
return;
if (!Settings.isForceSurvivalModeEnabled)
return;
Player player = event.getPlayer();
if (plugin.authmePermissible(player, "authme.bypassforcesurvival"))
return;
String name = player.getName().toLowerCase();
if (Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player))
return;
if(plugin.getCitizensCommunicator().isNPC(player, plugin))
return;
if (PlayerCache.getInstance().isAuthenticated(name))
return;
if (!data.isAuthAvailable(name))
if (!Settings.isForcedRegistrationEnabled)
return;
if (this.causeByAuthMe)
return;
event.setCancelled(true);
}
}

View File

@ -20,10 +20,15 @@ public class BungeeCordMessage implements PluginMessageListener {
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
if (!channel.equals("BungeeCord")) {
return;
}
try {
final DataInputStream in = new DataInputStream(new ByteArrayInputStream(message));
if (in.readUTF().equals("IP")) { //We need only the IP channel
plugin.realIp.put(player.getName().toLowerCase(), in.readUTF()); //Put the IP (only the ip not the port) in the hashmap
String subchannel = in.readUTF();
if (subchannel.equals("IP")) { //We need only the IP channel
String ip = in.readUTF();
plugin.realIp.put(player.getName().toLowerCase(), ip); //Put the IP (only the ip not the port) in the hashmap
}
} catch (IOException ex) {
}

View File

@ -36,4 +36,5 @@ public enum HashAlgorithm {
public Class<?> getclass() {
return classe;
}
}

View File

@ -6,6 +6,8 @@ import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.HashMap;
import org.bukkit.Bukkit;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.events.PasswordEncryptionEvent;
@ -19,7 +21,7 @@ public class PasswordSecurity {
private static SecureRandom rnd = new SecureRandom();
public static HashMap<String, String> userSalt = new HashMap<String, String>();
private static String createSalt(int length) throws NoSuchAlgorithmException {
public static String createSalt(int length) throws NoSuchAlgorithmException {
byte[] msg = new byte[40];
rnd.nextBytes(msg);
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
@ -41,64 +43,68 @@ public class PasswordSecurity {
}
String salt = "";
switch (alg) {
case MD5:
case SHA1:
case WHIRLPOOL:
case PHPBB:
case PLAINTEXT:
case XENFORO:
case SHA512:
case DOUBLEMD5:
case WORDPRESS:
case CUSTOM:
break;
case SHA256:
salt = createSalt(16);
break;
case MD5VB:
salt = createSalt(16);
break;
case XAUTH:
salt = createSalt(12);
break;
case MYBB:
salt = createSalt(8);
userSalt.put(playerName, salt);
break;
case IPB3:
salt = createSalt(5);
userSalt.put(playerName, salt);
break;
case PHPFUSION:
salt = createSalt(12);
userSalt.put(playerName, salt);
break;
case SALTED2MD5:
salt = createSalt(Settings.saltLength);
userSalt.put(playerName, salt);
break;
case JOOMLA:
salt = createSalt(32);
userSalt.put(playerName, salt);
break;
case BCRYPT:
salt = BCRYPT.gensalt(Settings.bCryptLog2Rounds);
userSalt.put(playerName, salt);
break;
case WBB3:
salt = createSalt(40);
userSalt.put(playerName, salt);
break;
case PBKDF2:
salt = createSalt(12);
userSalt.put(playerName, salt);
break;
case SMF:
return method.getHash(password, playerName.toLowerCase());
default:
throw new NoSuchAlgorithmException("Unknown hash algorithm");
case SHA256:
salt = createSalt(16);
break;
case MD5VB:
salt = createSalt(16);
break;
case XAUTH:
salt = createSalt(12);
break;
case MYBB:
salt = createSalt(8);
userSalt.put(playerName, salt);
break;
case IPB3:
salt = createSalt(5);
userSalt.put(playerName, salt);
break;
case PHPFUSION:
salt = createSalt(12);
userSalt.put(playerName, salt);
break;
case SALTED2MD5:
salt = createSalt(Settings.saltLength);
userSalt.put(playerName, salt);
break;
case JOOMLA:
salt = createSalt(32);
userSalt.put(playerName, salt);
break;
case BCRYPT:
salt = BCRYPT.gensalt(Settings.bCryptLog2Rounds);
userSalt.put(playerName, salt);
break;
case WBB3:
salt = createSalt(40);
userSalt.put(playerName, salt);
break;
case PBKDF2:
salt = createSalt(12);
userSalt.put(playerName, salt);
break;
case SMF:
return method.getHash(password, playerName.toLowerCase());
case PHPBB:
salt = createSalt(16);
userSalt.put(playerName, salt);
break;
case MD5:
case SHA1:
case WHIRLPOOL:
case PLAINTEXT:
case XENFORO:
case SHA512:
case DOUBLEMD5:
case WORDPRESS:
case CUSTOM:
break;
default:
throw new NoSuchAlgorithmException("Unknown hash algorithm");
}
PasswordEncryptionEvent event = new PasswordEncryptionEvent(method, playerName);
Bukkit.getPluginManager().callEvent(event);
method = event.getMethod();
if (method == null)
throw new NoSuchAlgorithmException("Unknown hash algorithm");
@ -118,6 +124,7 @@ public class PasswordSecurity {
throw new NoSuchAlgorithmException("Problem with this hash algorithm");
}
PasswordEncryptionEvent event = new PasswordEncryptionEvent(method, playerName);
Bukkit.getPluginManager().callEvent(event);
method = event.getMethod();
if (method == null)
throw new NoSuchAlgorithmException("Unknown hash algorithm");
@ -136,8 +143,9 @@ public class PasswordSecurity {
private static boolean compareWithAllEncryptionMethod(String password, String hash, String playerName) throws NoSuchAlgorithmException {
for (HashAlgorithm algo : HashAlgorithm.values()) {
try {
if (algo != HashAlgorithm.CUSTOM)
if (((EncryptionMethod) algo.getclass().newInstance()).comparePassword(hash, password, playerName)) {
EncryptionMethod method = (EncryptionMethod) algo.getclass().newInstance();
if (algo != HashAlgorithm.CUSTOM) {
if (method.comparePassword(hash, password, playerName)) {
PlayerAuth nAuth = AuthMe.getInstance().database.getAuth(playerName);
if (nAuth != null) {
nAuth.setHash(getHash(Settings.getPasswordHash, password, playerName));
@ -147,9 +155,8 @@ public class PasswordSecurity {
}
return true;
}
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
}
}
} catch (Exception e) {}
}
return false;
}

View File

@ -18,9 +18,6 @@ import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import fr.xephi.authme.AuthMe;
/**
* BCrypt implements OpenBSD-style Blowfish password hashing using
* the scheme described in "A Future-Adaptable Password Scheme" by
@ -762,7 +759,6 @@ public class BCRYPT implements EncryptionMethod {
@Override
public boolean comparePassword(String hash, String password,
String playerName) throws NoSuchAlgorithmException {
String salt = AuthMe.getInstance().database.getAuth(playerName).getSalt();
return hash.equals(hashpw(password, salt));
return checkpw(password, hash);
}
}

View File

@ -18,14 +18,14 @@ public class PHPBB implements EncryptionMethod {
private String itoa64 =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
public String phpbb_hash(String password) {
String random_state = unique_id();
public String phpbb_hash(String password, String salt) {
String random_state = salt;
String random = "";
int count = 6;
if (random.length() < count) {
random = "";
for (int i = 0; i < count; i += 16) {
random_state = md5(unique_id() + random_state);
random_state = md5(salt + random_state);
random += pack(md5(random_state));
}
random = random.substring(0, count);
@ -37,15 +37,6 @@ public class PHPBB implements EncryptionMethod {
return md5(password);
}
private String unique_id() {
return unique_id("c");
}
private String unique_id(String extra) {
//TODO: Maybe check the salt?
return "1234567890abcdef";
}
private String _hash_gensalt_private(String input, String itoa64) {
return _hash_gensalt_private(input, itoa64, 6);
}
@ -162,7 +153,7 @@ private String _hash_gensalt_private(
@Override
public String getHash(String password, String salt)
throws NoSuchAlgorithmException {
return phpbb_hash(password);
return phpbb_hash(password, salt);
}
@Override

View File

@ -61,8 +61,6 @@ import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
public class WHIRLPOOL implements EncryptionMethod {
public WHIRLPOOL() {}
/**
* The message digest size (in bits)
@ -181,6 +179,9 @@ public class WHIRLPOOL implements EncryptionMethod {
protected long[] block = new long[8];
protected long[] state = new long[8];
public WHIRLPOOL() {
}
/**
* The core Whirlpool transform.
*/

View File

@ -7,8 +7,7 @@ public class XAUTH implements EncryptionMethod {
@Override
public String getHash(String password, String salt)
throws NoSuchAlgorithmException {
WHIRLPOOL w = new WHIRLPOOL();
String hash = w.getHash((salt + password).toLowerCase(), "");
String hash = getWhirlpool(salt + password).toLowerCase();
int saltPos = (password.length() >= hash.length() ? hash.length() - 1 : password.length());
return hash.substring(0, saltPos) + salt + hash.substring(saltPos);
}
@ -21,4 +20,13 @@ public class XAUTH implements EncryptionMethod {
return hash.equals(getHash(password, salt));
}
public static String getWhirlpool(String message) {
WHIRLPOOL w = new WHIRLPOOL();
byte[] digest = new byte[WHIRLPOOL.DIGESTBYTES];
w.NESSIEinit();
w.NESSIEadd(message);
w.NESSIEfinalize(digest);
return WHIRLPOOL.display(digest);
}
}

View File

@ -1,73 +1,64 @@
package fr.xephi.authme.settings;
import java.io.File;
import java.io.InputStream;
import org.bukkit.configuration.file.YamlConfiguration;
import fr.xephi.authme.AuthMe;
public class Messages extends CustomConfiguration {
private static Messages singleton = null;
public Messages() {
super(new File(Settings.MESSAGE_FILE+"_"+Settings.messagesLanguage+".yml"));
loadDefaults();
public Messages(File file) {
super(file);
loadDefaults(file);
loadFile();
saveDefaults(file);
singleton = this;
}
private void loadDefaults() {
this.set("logged_in", "&cAlready logged in!");
this.set("not_logged_in", "&cNot logged in!");
this.set("reg_disabled", "&cRegistration is disabled");
this.set("user_regged", "&cUsername already registered");
this.set("usage_reg", "&cUsage: /register password ConfirmPassword");
this.set("usage_log", "&cUsage: /login password");
this.set("user_unknown", "&cUsername not registered");
this.set("pwd_changed", "&cPassword changed!");
this.set("reg_only", "&fRegistered players only! Please visit http://example.com to register");
this.set("valid_session", "&cSession login");
this.set("login_msg", "&cPlease login with \"/login password\"");
this.set("reg_msg", "&cPlease register with \"/register password ConfirmPassword\"");
this.set("reg_email_msg", "&cPlease register with \"/register <email> <confirmEmail>\"");
this.set("timeout", "&fLogin Timeout");
this.set("wrong_pwd", "&cWrong password");
this.set("logout", "&cSuccessful logout");
this.set("usage_unreg", "&cUsage: /unregister password");
this.set("registered", "&cSuccessfully registered!");
this.set("unregistered", "&cSuccessfully unregistered!");
this.set("login", "&cSuccessful login!");
this.set("no_perm", "&cNo Permission");
this.set("same_nick", "&fSame nick is already playing");
this.set("reg_voluntarily", "&fYou can register your nickname with the server with the command \"/register password ConfirmPassword\"");
this.set("reload", "&fConfiguration and database has been reloaded");
this.set("error", "&fAn error ocurred; Please contact the admin");
this.set("unknown_user", "&fUser is not in database");
this.set("unsafe_spawn","&fYour Quit location was unsafe, teleporting you to World Spawn");
this.set("unvalid_session","&fSession Dataes doesnt corrispond Plaese wait the end of session");
this.set("max_reg","&fYou have Exceded the max number of Registration for your Account");
this.set("password_error","&fPassword doesnt match");
this.set("pass_len","&fYour password dind''t reach the minimum length or exeded the max length");
this.set("vb_nonActiv","&fYour Account isent Activated yet check your Emails!");
this.set("usage_changepassword", "&fUsage: /changepassword oldPassword newPassword");
this.set("name_len", "&cYour nickname is too Short or too long");
this.set("regex", "&cYour nickname contains illegal characters. Allowed chars: REG_EX");
this.set("add_email","&cPlease add your email with : /email add yourEmail confirmEmail");
this.set("bad_database_email", "[AuthMe] This /email command only available with MySQL and SQLite, contact an Admin");
this.set("recovery_email", "&cForgot your password? Please use /email recovery <yourEmail>");
this.set("usage_captcha", "&cUsage: /captcha <theCaptcha>");
this.set("wrong_captcha", "&cWrong Captcha, please use : /captcha THE_CAPTCHA");
this.set("valid_captcha", "&cYour captcha is valid !");
this.set("kick_forvip", "&cA VIP Player join the full server!");
this.set("kick_fullserver", "&cThe server is actually full, Sorry!");
this.set("usage_email_add", "&fUsage: /email add <Email> <confirmEmail> ");
this.set("usage_email_change", "&Usage: /email change <old> <new> ");
this.set("usage_email_recovery", "&Usage: /email recovery <Email>");
this.set("email_add", "[AuthMe] /email add <Email> <confirmEmail>");
this.set("new_email_invalid", "[AuthMe] New email invalid!");
this.set("old_email_invalid", "[AuthMe] Old email invalid!");
this.set("email_invalid", "[AuthMe] Invalid Email !");
this.set("email_added", "[AuthMe] Email Added !");
this.set("email_confirm", "[AuthMe] Confirm your Email !");
this.set("email_changed", "[AuthMe] Email Change !");
this.set("email_send", "[AuthMe] Recovery Email Send !");
/**
* Loads a file from the plugin jar and sets as default
*
* @param filename The filename to open
*/
public final void loadDefaults(File file) {
InputStream stream = AuthMe.getInstance().getResource(file.getName());
if(stream == null) return;
setDefaults(YamlConfiguration.loadConfiguration(stream));
}
/**
* Saves the configuration to disk
*
* @return True if saved successfully
*/
public final boolean saved(File file) {
try {
save(file);
return true;
} catch (Exception ex) {
return false;
}
}
/**
* Saves current configuration (plus defaults) to disk.
*
* If defaults and configuration are empty, saves blank file.
*
* @return True if saved successfully
*/
public final boolean saveDefaults(File file) {
options().copyDefaults(true);
options().copyHeader(true);
boolean success = saved(file);
options().copyDefaults(false);
options().copyHeader(false);
return success;
}
private void loadFile() {
@ -76,23 +67,24 @@ public class Messages extends CustomConfiguration {
}
public String _(String msg) {
String loc = (String) this.get(msg);
String loc = (String) this.get(msg, this.getDefault(msg));
if (loc != null) {
return loc.replace("&", "\u00a7");
}
if (loc == null && !contains(msg)) {
set(msg, this.getDefault(msg));
save();
loc = (String) this.get(msg);
load();
loc = (String) this.get(msg, this.getDefault(msg));
}
if (loc == null)
return "Error with Translation files; Please contact the admin";
return "Error with Translation files; Please contact the admin ";
return loc.replace("&", "\u00a7");
}
public static Messages getInstance() {
if (singleton == null) {
singleton = new Messages();
singleton = new Messages(new File(Settings.MESSAGE_FILE+"_"+Settings.messagesLanguage+".yml"));
}
return singleton;
}

View File

@ -29,8 +29,10 @@ public final class Settings extends YamlConfiguration {
private static List<String> getRestrictedIp;
public static List<String> getMySQLOtherUsernameColumn = null;
public static List<String> getForcedWorlds = null;
public static List<String> countries = null;
public static List<String> forceCommands = null;
public final Plugin plugin;
private final File file;
private final File file;
public static DataSourceType getDataSource;
public static HashAlgorithm getPasswordHash;
public static HashAlgorithm rakamakHash;
@ -39,13 +41,14 @@ public final class Settings extends YamlConfiguration {
public static Boolean isPermissionCheckEnabled, isRegistrationEnabled, isForcedRegistrationEnabled,
isTeleportToSpawnEnabled, isSessionsEnabled, isChatAllowed, isAllowRestrictedIp,
isMovementAllowed, isKickNonRegisteredEnabled, isForceSingleSessionEnabled,
isForceSpawnLocOnJoinEnabled, isForceExactSpawnEnabled, isSaveQuitLocationEnabled,
isForceSpawnLocOnJoinEnabled, isSaveQuitLocationEnabled,
isForceSurvivalModeEnabled, isResetInventoryIfCreative, isCachingEnabled, isKickOnWrongPasswordEnabled,
getEnablePasswordVerifier, protectInventoryBeforeLogInEnabled, isBackupActivated, isBackupOnStart,
isBackupOnStop, enablePasspartu, isStopEnabled, reloadSupport, rakamakUseIp, noConsoleSpam, removePassword, displayOtherAccounts,
useCaptcha, emailRegistration, multiverse, notifications, chestshop, bungee, banUnsafeIp, doubleEmailCheck, sessionExpireOnIpChange,
disableSocialSpy, useMultiThreading, forceOnlyAfterLogin, useEssentialsMotd,
usePurge, purgePlayerDat, purgeEssentialsFile, supportOldPassword;
usePurge, purgePlayerDat, purgeEssentialsFile, supportOldPassword, purgeLimitedCreative,
purgeAntiXray, purgePermissions, enableProtection, enableAntiBot;
public static String getNickRegex, getUnloggedinGroup, getMySQLHost, getMySQLPort,
getMySQLUsername, getMySQLPassword, getMySQLDatabase, getMySQLTablename,
@ -59,7 +62,7 @@ public final class Settings extends YamlConfiguration {
public static int getWarnMessageInterval, getSessionTimeout, getRegistrationTimeout, getMaxNickLength,
getMinNickLength, getPasswordMinLen, getMovementRadius, getmaxRegPerIp, getNonActivatedGroup,
passwordMaxLength, getRecoveryPassLength, getMailPort, maxLoginTry, captchaLength, saltLength, getmaxRegPerEmail,
bCryptLog2Rounds, purgeDelay, getPhpbbGroup;
bCryptLog2Rounds, purgeDelay, getPhpbbGroup, antiBotSensibility, antiBotDuration;
protected static YamlConfiguration configFile;
@ -187,7 +190,7 @@ public void loadConfigOptions() {
chestshop = configFile.getBoolean("Hooks.chestshop", true);
notifications = configFile.getBoolean("Hooks.notifications", true);
bungee = configFile.getBoolean("Hooks.bungeecord", false);
getForcedWorlds = (List<String>) configFile.getList("settings.restrictions.ForceSpawnOnTheseWorlds");
getForcedWorlds = (List<String>) configFile.getList("settings.restrictions.ForceSpawnOnTheseWorlds", new ArrayList<String>());
banUnsafeIp = configFile.getBoolean("settings.restrictions.banUnsafedIP", false);
doubleEmailCheck = configFile.getBoolean("settings.registration.doubleEmailCheck", false);
sessionExpireOnIpChange = configFile.getBoolean("settings.sessions.sessionExpireOnIpChange", false);
@ -206,6 +209,15 @@ public void loadConfigOptions() {
getPhpbbGroup = configFile.getInt("ExternalBoardOptions.phpbbActivatedGroupId", 2);
supportOldPassword = configFile.getBoolean("settings.security.supportOldPasswordHash", false);
getWordPressPrefix = configFile.getString("ExternalBoardOptions.wordpressTablePrefix", "wp_");
purgeLimitedCreative = configFile.getBoolean("Purge.removeLimitedCreativesInventories", false);
purgeAntiXray = configFile.getBoolean("Purge.removeAntiXRayFile", false);
//purgePermissions = configFile.getBoolean("Purge.removePermissions", false);
enableProtection = configFile.getBoolean("Protection.enableProtection", false);
countries = (List<String>) configFile.getList("Protection.countries", new ArrayList<String>());
enableAntiBot = configFile.getBoolean("Protection.enableAntiBot", false);
antiBotSensibility = configFile.getInt("Protection.antiBotSensibility", 5);
antiBotDuration = configFile.getInt("Protection.antiBotDuration", 10);
forceCommands = (List<String>) configFile.getList("settings.forceCommands", new ArrayList<String>());
saveDefaults();
}
@ -339,6 +351,15 @@ public static void reloadConfigOptions(YamlConfiguration newConfig) {
getPhpbbGroup = configFile.getInt("ExternalBoardOptions.phpbbActivatedGroupId", 2);
supportOldPassword = configFile.getBoolean("settings.security.supportOldPasswordHash", false);
getWordPressPrefix = configFile.getString("ExternalBoardOptions.wordpressTablePrefix", "wp_");
purgeLimitedCreative = configFile.getBoolean("Purge.removeLimitedCreativesInventories", false);
purgeAntiXray = configFile.getBoolean("Purge.removeAntiXRayFile", false);
//purgePermissions = configFile.getBoolean("Purge.removePermissions", false);
enableProtection = configFile.getBoolean("Protection.enableProtection", false);
countries = (List<String>) configFile.getList("Protection.countries");
enableAntiBot = configFile.getBoolean("Protection.enableAntiBot", false);
antiBotSensibility = configFile.getInt("Protection.antiBotSensibility", 5);
antiBotDuration = configFile.getInt("Protection.antiBotDuration", 10);
forceCommands = (List<String>) configFile.getList("settings.forceCommands", new ArrayList<String>());
}
public void mergeConfig() {
@ -433,7 +454,29 @@ public void mergeConfig() {
set("Xenoforo.predefinedSalt", null);
if(configFile.getString("settings.security.passwordHash","SHA256").toUpperCase().equals("XFSHA1") || configFile.getString("settings.security.passwordHash","SHA256").toUpperCase().equals("XFSHA256"))
set("settings.security.passwordHash", "XENFORO");
if(!contains("Purge.removeLimitedCreativesInventories"))
set("Purge.removeLimitedCreativesInventories", false);
if(!contains("Purge.removeAntiXRayFile"))
set("Purge.removeAntiXRayFile", false);
/*if(!contains("Purge.removePermissions"))
set("Purge.removePermissions", false);*/
if(!contains("Protection.enableProtection"))
set("Protection.enableProtection", false);
if(!contains("Protection.countries")) {
countries = new ArrayList<String>();
countries.add("US");
countries.add("GB");
set("Protection.countries", countries);
}
if(!contains("Protection.enableAntiBot"))
set("Protection.enableAntiBot", false);
if(!contains("Protection.antiBotSensibility"))
set("Protection.antiBotSensibility", 5);
if(!contains("Protection.antiBotDuration"))
set("Protection.antiBotDuration", 10);
if(!contains("settings.forceCommands"))
set("settings.forceCommands", new ArrayList<String>());
plugin.getLogger().info("Merge new Config Options if needed..");
plugin.saveConfig();
@ -581,11 +624,11 @@ public void mergeConfig() {
setDefaults(new MemoryConfiguration());
}
/**
* Check loaded defaults against current configuration
*
* @return false When all defaults aren't present in config
*/
/**
* Check loaded defaults against current configuration
*
* @return false When all defaults aren't present in config
*/
public boolean checkDefaults() {
if (getDefaults() == null) {
return true;
@ -604,8 +647,14 @@ public void mergeConfig() {
return "en";
}
public enum messagesLang {
en, de, br, cz, pl, fr, ru, hu, sk, es, zhtw, fi, zhcn, lt, it, ko, pt
public static void switchAntiBotMod(boolean mode) {
if (mode)
isKickNonRegisteredEnabled = true;
else
isKickNonRegisteredEnabled = configFile.getBoolean("settings.restrictions.kickNonRegistered",false);
}
public enum messagesLang {
en, de, br, cz, pl, fr, ru, hu, sk, es, zhtw, fi, zhcn, lt, it, ko, pt, nl
}
}

View File

@ -25,9 +25,9 @@ public class MessageTask implements Runnable {
@Override
public void run() {
if (PlayerCache.getInstance().isAuthenticated(name)) {
if (PlayerCache.getInstance().isAuthenticated(name))
return;
}
for (Player player : plugin.getServer().getOnlinePlayers()) {
if (player.getName().toLowerCase().equals(name)) {
player.sendMessage(msg);

View File

@ -32,13 +32,14 @@ public class TimeoutTask implements Runnable {
@Override
public void run() {
if (PlayerCache.getInstance().isAuthenticated(name)) {
if (PlayerCache.getInstance().isAuthenticated(name))
return;
}
for (Player player : plugin.getServer().getOnlinePlayers()) {
if (player.getName().toLowerCase().equals(name)) {
if (LimboCache.getInstance().hasLimboPlayer(name)) {
LimboPlayer inv = LimboCache.getInstance().getLimboPlayer(name);
player.getServer().getScheduler().cancelTask(inv.getMessageTaskId());
player.getServer().getScheduler().cancelTask(inv.getTimeoutTaskId());
if(playerCache.doesCacheExist(name)) {
playerCache.removeCache(name);

View File

@ -12,6 +12,7 @@ import java.util.List;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.api.API;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.settings.Settings;
@ -21,9 +22,10 @@ public class FlatFileThread extends Thread implements DataSource {
/* file layout:
*
* PLAYERNAME:HASHSUM:IP:LOGININMILLIESECONDS:LASTPOSX:LASTPOSY:LASTPOSZ:LASTPOSWORLD
* PLAYERNAME:HASHSUM:IP:LOGININMILLIESECONDS:LASTPOSX:LASTPOSY:LASTPOSZ:LASTPOSWORLD:EMAIL
*
* Old but compatible:
* PLAYERNAME:HASHSUM:IP:LOGININMILLIESECONDS:LASTPOSX:LASTPOSY:LASTPOSZ:LASTPOSWORLD
* PLAYERNAME:HASHSUM:IP:LOGININMILLIESECONDS
* PLAYERNAME:HASHSUM:IP
* PLAYERNAME:HASHSUM
@ -84,7 +86,7 @@ public class FlatFileThread extends Thread implements DataSource {
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter(source, true));
bw.write(auth.getNickname() + ":" + auth.getHash() + ":" + auth.getIp() + ":" + auth.getLastLogin() + ":" + auth.getQuitLocX() + ":" + auth.getQuitLocY() + ":" + auth.getQuitLocZ() + ":" + auth.getWorld() + "\n");
bw.write(auth.getNickname() + ":" + auth.getHash() + ":" + auth.getIp() + ":" + auth.getLastLogin() + ":" + auth.getQuitLocX() + ":" + auth.getQuitLocY() + ":" + auth.getQuitLocZ() + ":" + auth.getWorld() + ":" + auth.getEmail() + "\n");
} catch (IOException ex) {
ConsoleLogger.showError(ex.getMessage());
return false;
@ -114,19 +116,23 @@ public class FlatFileThread extends Thread implements DataSource {
if (args[0].equals(auth.getNickname())) {
switch (args.length) {
case 4: {
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), 0, 0, 0, "world");
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], Long.parseLong(args[3]), 0, 0, 0, "world", "your@email.com", API.getPlayerRealName(args[0]));
break;
}
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");
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]));
break;
}
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]);
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]));
break;
}
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]));
break;
}
default: {
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], 0, 0, 0, 0, "world");
newAuth = new PlayerAuth(args[0], auth.getHash(), args[2], 0, 0, 0, 0, "world", "your@email.com", API.getPlayerRealName(args[0]));
break;
}
}
@ -167,19 +173,23 @@ public class FlatFileThread extends Thread implements DataSource {
if (args[0].equals(auth.getNickname())) {
switch (args.length) {
case 4: {
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), 0, 0, 0, "world");
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), 0, 0, 0, "world", "your@email.com", API.getPlayerRealName(args[0]));
break;
}
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");
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]));
break;
}
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]);
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]));
break;
}
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]));
break;
}
default: {
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), 0, 0, 0, "world");
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), 0, 0, 0, "world", "your@email.com", API.getPlayerRealName(args[0]));
break;
}
}
@ -218,7 +228,7 @@ public class FlatFileThread extends Thread implements DataSource {
while ((line = br.readLine()) != null) {
String[] args = line.split(":");
if (args[0].equals(auth.getNickname())) {
newAuth = new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ(), auth.getWorld());
newAuth = new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ(), auth.getWorld(), auth.getEmail(), API.getPlayerRealName(args[0]));
break;
}
}
@ -420,15 +430,17 @@ public class FlatFileThread extends Thread implements DataSource {
if (args[0].equals(user)) {
switch (args.length) {
case 2:
return new PlayerAuth(args[0], args[1], "198.18.0.1", 0);
return new PlayerAuth(args[0], args[1], "198.18.0.1", 0, "your@email.com", API.getPlayerRealName(args[0]));
case 3:
return new PlayerAuth(args[0], args[1], args[2], 0);
return new PlayerAuth(args[0], args[1], args[2], 0, "your@email.com", API.getPlayerRealName(args[0]));
case 4:
return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]));
return new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), "your@email.com", API.getPlayerRealName(args[0]));
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");
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]));
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]);
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]));
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]));
}
}
}
@ -459,7 +471,38 @@ public class FlatFileThread extends Thread implements DataSource {
@Override
public boolean updateEmail(PlayerAuth auth) {
return false;
if (!isAuthAvailable(auth.getNickname())) {
return false;
}
PlayerAuth newAuth = null;
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(source));
String line = "";
while ((line = br.readLine()) != null) {
String[] args = line.split(":");
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]));
break;
}
}
} catch (FileNotFoundException ex) {
ConsoleLogger.showError(ex.getMessage());
return false;
} catch (IOException ex) {
ConsoleLogger.showError(ex.getMessage());
return false;
} finally {
if (br != null) {
try {
br.close();
} catch (IOException ex) {
}
}
}
removeAuth(auth.getNickname());
saveAuth(newAuth);
return true;
}
@Override
@ -524,12 +567,37 @@ public class FlatFileThread extends Thread implements DataSource {
} catch (IOException ex) {
}
}
}
}
}
@Override
public List<String> getAllAuthsByEmail(String email) {
return new ArrayList<String>();
BufferedReader br = null;
List<String> countEmail = new ArrayList<String>();
try {
br = new BufferedReader(new FileReader(source));
String line;
while ((line = br.readLine()) != null) {
String[] args = line.split(":");
if (args.length > 8 && args[8].equals(email)) {
countEmail.add(args[0]);
}
}
return countEmail;
} catch (FileNotFoundException ex) {
ConsoleLogger.showError(ex.getMessage());
return new ArrayList<String>();
} catch (IOException ex) {
ConsoleLogger.showError(ex.getMessage());
return new ArrayList<String>();
} finally {
if (br != null) {
try {
br.close();
} catch (IOException ex) {
}
}
}
}
@Override

View File

@ -13,6 +13,7 @@ import com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.api.API;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.datasource.MiniConnectionPoolManager;
@ -208,14 +209,14 @@ public class MySQLThread extends Thread implements DataSource {
rs = pst.executeQuery();
if (rs.next()) {
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));
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)));
} else {
if(!columnSalt.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));
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));
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)));
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(columnIp), rs.getLong(columnLastLogin), rs.getInt(lastlocX), rs.getInt(lastlocY), rs.getInt(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail));
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)));
}
}
} else {
@ -258,8 +259,8 @@ public class MySQLThread extends Thread implements DataSource {
}
if (!columnOthers.isEmpty()) {
for(String column : columnOthers) {
pst = con.prepareStatement("UPDATE " + tableName + " SET " + tableName + "." + column + "=? WHERE " + columnName + "=?;");
pst.setString(1, auth.getNickname());
pst = con.prepareStatement("UPDATE " + tableName + " SET " + column + "=? WHERE " + columnName + "=?;");
pst.setString(1, auth.getRealname());
pst.setString(2, auth.getNickname());
pst.executeUpdate();
}
@ -272,12 +273,30 @@ public class MySQLThread extends Thread implements DataSource {
rs = pst.executeQuery();
if (rs.next()) {
id = rs.getInt(columnID);
// Insert player in phpbb_user_group
pst = con.prepareStatement("INSERT INTO " + Settings.getPhpbbPrefix + "user_group (group_id, user_id, group_leader, user_pending) VALUES (?,?,?,?);");
pst.setInt(1, Settings.getPhpbbGroup);
pst.setInt(2, id);
pst.setInt(3, 0);
pst.setInt(4, 0);
pst.executeUpdate();
// Update player group in phpbb_users
pst = con.prepareStatement("UPDATE " + tableName + " SET " + tableName + ".group_id=? WHERE " + columnName + "=?;");
pst.setInt(1, Settings.getPhpbbGroup);
pst.setString(2, auth.getNickname());
pst.executeUpdate();
// Get current time without ms
long time = System.currentTimeMillis()/1000;
// Update user_regdate
pst = con.prepareStatement("UPDATE " + tableName + " SET " + tableName + ".user_regdate=? WHERE " + columnName + "=?;");
pst.setLong(1, time);
pst.setString(2, auth.getNickname());
pst.executeUpdate();
// Update user_lastvisit
pst = con.prepareStatement("UPDATE " + tableName + " SET " + tableName + ".user_lastvisit=? WHERE " + columnName + "=?;");
pst.setLong(1, time);
pst.setString(2, auth.getNickname());
pst.executeUpdate();
}
}
if (Settings.getPasswordHash == HashAlgorithm.WORDPRESS) {
@ -457,6 +476,9 @@ public class MySQLThread extends Thread implements DataSource {
while (rs.next()) {
list.add(rs.getString(columnName));
}
pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE " + columnLastLogin + "<?;");
pst.setLong(1, until);
pst.executeUpdate();
return list;
} catch (SQLException ex) {
ConsoleLogger.showError(ex.getMessage());

View File

@ -11,6 +11,7 @@ import java.util.List;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.api.API;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.datasource.MiniConnectionPoolManager.TimeoutException;
@ -169,12 +170,12 @@ public class SQLiteThread extends Thread implements DataSource {
rs = pst.executeQuery();
if (rs.next()) {
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));
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)));
} else {
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));
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)));
} 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));
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)));
}
}
} else {

View File

@ -224,6 +224,8 @@ settings:
UnrestrictedName: []
# Message language, available : en, de, br, cz, pl, fr, ru, hu, sk, es, zhtw, fi, zhcn, lt, it, ko, pt
messagesLanguage: en
#Force these commands after /login, without any '/', use %p for replace with player name
forceCommands: []
ExternalBoardOptions:
# MySQL column for the salt , needed for some forum/cms support
mySQLColumnSalt: ''
@ -343,7 +345,24 @@ Purge:
daysBeforeRemovePlayer: 60
# Do we need to remove the player.dat file during purge process ?
removePlayerDat: false
# Do we need to remove the Essentials/users/player.yml file during purge proecess ?
# Do we need to remove the Essentials/users/player.yml file during purge process ?
removeEssentialsFile: false
# World where are players.dat stores
defaultWorld: 'world'
defaultWorld: 'world'
# Do we need to remove LimitedCreative/inventories/player.yml , player_creative.yml files during purge process ?
removeLimitedCreativesInventories: false
# Do we need to remove the AntiXRayData/PlayerData/player file during purge process ?
removeAntiXRayFile: false
Protection:
# Enable some servers protection ( country based login, antibot )
enableProtection: false
# Countries allowed to join the server and register, see http://dev.maxmind.com/geoip/legacy/codes/iso3166/ for countries' codes
countries:
- US
- GB
# Do we need to enable automatic antibot system?
enableAntiBot: false
# Max number of player allowed to login in 5 secs before enable AntiBot system automatically
antiBotSensibility: 5
# Duration in minutes of the antibot automatic system
antiBotDuration: 10

View File

@ -49,3 +49,6 @@ email_added: '[AuthMe] E-mail adicionado com sucesso!'
email_confirm: '[AuthMe] Confirme seu e-mail!'
email_changed: '[AuthMe] E-mail alterado!'
email_send: '[AuthMe] E-mail com nova senha enviado!'
country_banned: 'Your country is banned from this server'
antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!'
antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes, hope invasion stopped'

View File

@ -51,3 +51,6 @@ email_added: '[AuthMe] Email pridan !'
email_confirm: '[AuthMe] Potvrd prosim svuj email !'
email_changed: '[AuthMe] Email zmenen !'
email_send: '[AuthMe] Email pro obnoveni hesla odeslan !'
country_banned: 'Your country is banned from this server'
antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!'
antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes, hope invasion stopped'

View File

@ -50,4 +50,7 @@ email_invalid: '[AuthMe] Invalid Email'
email_added: '[AuthMe] Email Added !'
email_confirm: '[AuthMe] Confirm your Email !'
email_changed: '[AuthMe] Email Change !'
email_send: '[AuthMe] Recovery Email Send !'
email_send: '[AuthMe] Recovery Email Send !'
country_banned: 'Your country is banned from this server'
antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!'
antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes, hope invasion stopped'

View File

@ -36,7 +36,7 @@ regex: '&cYour nickname contains illegal characters. Allowed chars: REG_EX'
add_email: '&cPlease add your email with : /email add yourEmail confirmEmail'
bad_database_email: '[AuthMe] This /email command only available with MySQL and SQLite, contact an Admin'
recovery_email: '&cForgot your password? Please use /email recovery <yourEmail>'
usage_captcha: '&cUsage: /captcha <theCaptcha>'
usage_captcha: '&cYou need to type a captcha, please type: /captcha <theCaptcha>'
wrong_captcha: '&cWrong Captcha, please use : /captcha THE_CAPTCHA'
valid_captcha: '&cYour captcha is valid !'
kick_forvip: '&cA VIP Player join the full server!'
@ -51,3 +51,6 @@ email_added: '[AuthMe] Email Added !'
email_confirm: '[AuthMe] Confirm your Email !'
email_changed: '[AuthMe] Email Change !'
email_send: '[AuthMe] Recovery Email Send !'
country_banned: 'Your country is banned from this server'
antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!'
antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes, hope invasion stopped'

View File

@ -52,3 +52,6 @@ email_added: '[AuthMe] Email agregado !'
email_confirm: '[AuthMe] Confirma tu Email !'
email_changed: '[AuthMe] Email cambiado !'
email_send: '[AuthMe] Correo de recuperación enviado !'
country_banned: 'Your country is banned from this server'
antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!'
antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes, hope invasion stopped'

View File

@ -51,3 +51,6 @@ email_added: '[AuthMe] Sähköposti lisätty!'
email_confirm: '[AuthMe] Vahvistuta sähköposti!'
email_changed: '[AuthMe] Sähköposti vaihdettu!'
email_send: '[AuthMe] Palautus sähköposti lähetetty!'
country_banned: 'Your country is banned from this server'
antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!'
antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes, hope invasion stopped'

View File

@ -26,7 +26,7 @@ unvalid_session: '&fSession invalide, relancez le jeu ou attendez la fin de la s
reg_only: '&fSeul les joueurs enregistré sont admis!'
logged_in: '&cVous êtes déjà connecté!'
logout: '&cVous avez été déconnecté!'
same_nick: '&fUne personne ayant ce même pseudo joue deja..'
same_nick: '&fUne personne ayant ce même pseudo joue déjà..'
registered: '&cEnregistrement réussi avec succès!'
pass_len: '&fVotre mot de passe n''est pas assez long..'
reload: '&fConfiguration et BDD relancé avec succès'
@ -45,10 +45,13 @@ kick_fullserver: '&cLe serveur est actuellement plein, désolé!'
usage_email_add: '&fUsage: /email add <Email> <ConfirmeEmail> '
usage_email_change: '&fUsage: /email change <EmailAntigo> <NovoEmail> '
usage_email_recovery: '&fUsage: /email recovery <Email>'
new_email_invalid: '[AuthMe] New email invalid!'
old_email_invalid: '[AuthMe] Old email invalid!'
email_invalid: '[AuthMe] Invalid Email'
email_added: '[AuthMe] Email Added !'
email_confirm: '[AuthMe] Confirm your Email !'
email_changed: '[AuthMe] Email Change !'
email_send: '[AuthMe] Recovery Email Send !'
new_email_invalid: '[AuthMe] Nouvel email invalide!'
old_email_invalid: '[AuthMe] Ancien email invalide!'
email_invalid: '[AuthMe] Email invalide'
email_added: '[AuthMe] Email ajouté !'
email_confirm: '[AuthMe] Confirmez votre email !'
email_changed: '[AuthMe] Email changé !'
email_send: '[AuthMe] Email de récupération envoyé!'
country_banned: 'Votre pays est banni de ce serveur'
antibot_auto_enabled: '[AuthMe] AntiBotMod a été activé automatiquement à cause de nombreuses connections!'
antibot_auto_disabled: '[AuthMe] AntiBotMod a été désactivé automatiquement après %m Minutes, espérons que l''invasion soit arrêtée!'

View File

@ -51,3 +51,6 @@ email_added: '[AuthMe] Email Added !'
email_confirm: '[AuthMe] Confirm your Email !'
email_changed: '[AuthMe] Email Change !'
email_send: '[AuthMe] Recovery Email Send !'
country_banned: 'Your country is banned from this server'
antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!'
antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes, hope invasion stopped'

View File

@ -51,3 +51,6 @@ email_added: '[AuthMe] Email Aggiunta!'
email_confirm: '[AuthMe] Conferma la tua Email!'
email_changed: '[AuthMe] Email cambiata!'
email_send: '[AuthMe] Email di recupero inviata!'
country_banned: 'Your country is banned from this server'
antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!'
antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes, hope invasion stopped'

View File

@ -42,7 +42,7 @@ valid_captcha: '&c당신의 캡차는 올바릅니다 !'
kick_forvip: '&c한 VIP 플레이어가 만원인 서버에 입장했습니다!!'
kick_fullserver: '&c그 서버는 실제로 만원입니다, 미안!'
usage_email_add: '&f사용법: /email add <이메일> <이메일재입력> '
usage_email_change: '&f사용법: /email change <oldEmail> <newEmail> '
usage_email_change: '&f사용법: /email change <기존이메일> <새이메일> '
usage_email_recovery: '&f사용법: /email recovery <이메일>'
new_email_invalid: '[AuthMe] 새 이메일이 잘못되었습니다!'
old_email_invalid: '[AuthMe] 기존 이메일이 잘못되었습니다!'
@ -51,3 +51,6 @@ email_added: '[AuthMe] 이메일 추가됨 !'
email_confirm: '[AuthMe] 이메일을 확인해주세요 !'
email_changed: '[AuthMe] 이메일 변경됨 !'
email_send: '[AuthMe] 복구 이메일 발송됨 !'
country_banned: 'Your country is banned from this server'
antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!'
antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes, hope invasion stopped'

View File

@ -50,4 +50,7 @@ email_invalid: '[AuthMe] Invalid Email'
email_added: '[AuthMe] Email Added !'
email_confirm: '[AuthMe] Confirm your Email !'
email_changed: '[AuthMe] Email Change !'
email_send: '[AuthMe] Recovery Email Send !'
email_send: '[AuthMe] Recovery Email Send !'
country_banned: 'Your country is banned from this server'
antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!'
antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes, hope invasion stopped'

View File

@ -0,0 +1,55 @@
unknown_user: Gebruiker is niet gevonden in database
unsafe_spawn: De locatie waar je de vorige keer het spel verlied was gevaarlijk, je bent geteleporteert naar de Spawn
not_logged_in: '&cNiet ingelogt!'
reg_voluntarily: Je kunt je gebruikersnaam registreren met "/register <wachtwoord> <herhaalWachtwoord>"
usage_log: '&cGebruik: /login <wachtwoord>'
wrong_pwd: '&cFout wachtwoord'
unregistered: '&cRegistratie succesvol ongedaan gemaakt!'
reg_disabled: '&cRegistratie is uitgeschakeld'
valid_session: '&cSessie ingelogt'
login: '&cSuccesvol ingelogt!'
vb_nonActiv: Je accound is nog niet geactiveerd, controleer je mailbox!
user_regged: '&cGebruikersnaam is al geregistreerd'
usage_reg: '&cGebruik: /register <wachtwoord> <herhaalWachtwoord>'
max_reg: Je hebt de maximale registraties van jouw account overschreden.
no_perm: '&cGeen toegang!'
error: Error; neem contact op met een ADMIN!
login_msg: '&cLog in met "/login <wachtwoord>"'
reg_msg: '&cRegistreer met "/register <wachtwoord> <herhaalWachtwoord>"'
usage_unreg: '&cGebruik: /unregister password'
pwd_changed: '&cWachtwoord aangepast!'
user_unknown: '&cGebruikersnaam niet geregistreerd'
password_error: Wachtwoord incorrect!
unvalid_session: Sessie beschadigt, wacht tot de sessie is verlopen en join opnieuw.
reg_only: Alleen voor geregistreerde spelers! Bezoek http://example.com om te registreren
logged_in: '&cJe bent al ingelogt!'
logout: '&cJe bent succesvol uitgelogt'
same_nick: Er is al iemand met jou gebruikersnaam online.
registered: '&cSuccesvol geregistreerd!'
pass_len: Je gekozen wachtwoord voldoet niet aan de minimum of maximum lengte
reload: Configuratie en database is opnieuw opgestard
timeout: Login time-out; het duurde telang voor je je inlogde.
usage_changepassword: 'Gebruik: /changepassword <oudWachtwoord> <nieuwWachtwoord>'
name_len: '&cJouw gebruikersnaam is te kort'
regex: '&cJouw gebruikersnaam bestaat uit illegale tekens. tegestaan chars: REG_EX'
add_email: '&cVoeg uw email toe Alstublieft met: /email add jouw wachtwoord herhaalwachtwoord'
bad_database_email: '[AuthMe] deze /email command is alleen beschikbaar met MySQL en SQLite, neem contact op met een Admin'
recovery_email: '&cWachtwoord vergeten? gebruik alstublieft /email recovery <Jouwemail>'
usage_captcha: '&cGebruik: /captcha <deCaptcha>'
wrong_captcha: '&cverkeerde Captcha, Gebruik alstublieft : /captcha THE_CAPTCHA'
valid_captcha: '&cJouw captcha is geldig!'
kick_forvip: '&cA VIP Gebruiker ga naar de volledige server!'
kick_fullserver: '&cDe server is eigenlijk vol, Sorry!'
usage_email_add: '&fGebruik: /email add <email> <herhaalEmail> '
usage_email_change: '&fGebruik: /email change <oudeEmail> <nieuweEmail> '
usage_email_recovery: '&fGebruik: /email recovery <Email>'
new_email_invalid: '[AuthMe] Nieuw email ongeldig!'
old_email_invalid: '[AuthMe] Oud email ongeldig!'
email_invalid: '[AuthMe] ongeldig Email'
email_added: '[AuthMe] Bevestig jouw Email !'
email_confirm: '[AuthMe] Bevestig jouw Email !'
email_changed: '[AuthMe] Email Veranderd !'
email_send: '[AuthMe] Herstel Email Verzonden !'
country_banned: 'Your country is banned from this server'
antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!'
antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes, hope invasion stopped'

View File

@ -51,3 +51,6 @@ email_added: '[AuthMe] Email dodany!'
email_confirm: '[AuthMe] Potwierdz swoj email!'
email_changed: '[AuthMe] Email zmieniony!'
email_send: '[AuthMe] Email z odzyskaniem wyslany!'
country_banned: 'Your country is banned from this server'
antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!'
antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes, hope invasion stopped'

View File

@ -52,3 +52,6 @@ email_added: 'Email adicionado com sucesso!'
email_confirm: 'Confirme o seu email!'
email_changed: 'Email alterado com sucesso!'
email_send: 'Nova palavra-passe enviada para o seu email!'
country_banned: 'Your country is banned from this server'
antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!'
antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes, hope invasion stopped'

View File

@ -1,58 +1,56 @@
unknown_user: '&cЭтого игрока нет в базе'
unsafe_spawn: '&6Твоё расположение перед выходом из игры было небезопасным - &aты
перенесён на спавн'
not_logged_in: '&cТы не в игре!'
reg_voluntarily: '&eЗарегистрируйся - &d/reg ПАРОЛЬ ПОВТОРАРОЛЯ &eили &d/register
ПАРОЛЬ ПОВТОРАРОЛЯ'
usage_log: '&eСинтаксис: &d/l ПАРОЛЬ &eили &d/login ПАРОЛЬ'
wrong_pwd: '&cНеправильный пароль'
unregistered: '&aРегистрация снята'
unknown_user: '&cТакой игрок не зарегестрирован'
unsafe_spawn: '&6Ваше расположение перед выходом было опасным - &aВы перенесены на спавн.'
not_logged_in: '&cВы еще не вошли!'
reg_voluntarily: '&eРегистрация - &d/reg ПАРОЛЬ ПОВТОРАРОЛЯ'
usage_log: '&eИспользование: &d/l ПАРОЛЬ'
wrong_pwd: '&cНеверный пароль'
unregistered: '&cВы успешно удалили свой аккаунт!'
reg_disabled: '&6Регистрация отключена'
valid_session: '&aСессия открыта'
login: '&aТы в игре'
vb_nonActiv: '&aТвой аккаунт активирован. &5Проверь свою электронную почту.'
user_regged: '&cЭтот игрок уже зарегистрирован'
usage_reg: '&eСинтаксис: &d/reg ПАРОЛЬ ПОВТОРАРОЛЯ &eили &d/register ПАРОЛЬ ПОВТОРАРОЛЯ'
max_reg: '&cТы превысил максимальное число регистраций'
no_perm: '&cНет разрешения'
error: '&cЧто-то пошло не так... &5Свяжись с администратором.'
login_msg: '&eВойди в игру - &d/l ПАРОЛЬ &eили &d/login ПАРОЛЬ'
reg_msg: '&eЗарегистрируйся - &d/reg ПАРОЛЬ ПОВТОРАРОЛЯ &eили &d/register ПАРОЛЬ
ПОВТОРАРОЛЯ'
reg_email_msg: '&cPlease register with "/register <email> <confirmEmail>"'
usage_unreg: '&eСинтаксис: &d/unregister ПАРОЛЬ'
pwd_changed: '&aПароль изменён'
valid_session: '&cСессия включена'
login: '&cУспешная авторизация!'
vb_nonActiv: '&aВаш аккаунт активирован. &5Проверьте свою электронную почту.'
user_regged: '&cТакой игрок уже зарегистрирован'
usage_reg: '&cИспользование: /reg ПАРОЛЬ ПОВТОРАРОЛЯ'
max_reg: '&fВы превысили максимальное количество регистраций на аккаунт'
no_perm: '&cУ Вас нет прав'
error: '&cЧто-то пошло не так; &5Свяжитесь с администратором.'
login_msg: '&cВойти в игру - /login ПАРОЛЬ'
reg_msg: '&eЗарегистрируйтесь - &d/reg ПАРОЛЬ ПОВТОРАРОЛЯ'
reg_email_msg: '&cЗарегистрируйтесь - /register ВАШ_EMAIL ВАШ_EMAIL'
usage_unreg: '&cИспользование: /unregister ПАРОЛЬ'
pwd_changed: '&cПароль успешно изменен!'
user_unknown: '&cТакой игрок не зарегистрирован'
password_error: '&cПароль не найден'
unvalid_session: '&cДата сессии некорректна. &5Дождись конца сессии.'
reg_only: '&cРегистрация только для игроков! &5Зайди на &dhttp://example.com &5для
регистрации.'
logged_in: '&cТы уже в матрице!'
logout: '&aТы вышел с сервера'
same_nick: '&cЭтот игрок уже играет'
registered: '&aУспешная регистрация'
password_error: '&fПароль не совпадает'
unvalid_session: '&cСессия некорректна. &5Дождитесь, пока сессия закончится.'
reg_only: '&fВход доступен только зарегистрированным игрокам! Зарегистрируйтесь здесь - http://example.com/?do=register'
logged_in: '&cВы уже вошли!'
logout: '&cВы успешно вышли'
same_nick: '&fТакой игрок уже играет на сервере'
registered: '&cУспешная регистрация!'
pass_len: '&cТвой пароль либо слишком длинный, либо слишком короткий'
reload: '&aКонфигурация и база данных перезагружена'
timeout: '&cТы не успел войти в игру'
usage_changepassword: '&eСинтаксис: &d/changepassword СТАРЫЙ_ПАРОЛЬ НОВЫЙ_ПАРОЛЬ'
name_len: '&cТвой ник либо слишком длинный, либо слишком короткий'
regex: '&cТвой ник содержит недопустимые символы. Разрешено использовать: REG_EX'
add_email: '&eДобавь свой email: &d/email add АДРЕСОЧТЫ ПОВТОР_АДРЕСАОЧТЫ'
bad_database_email: '&c[AuthMe] Команда &d/email&c доступна только при работе с MySQL
или SQLite'
recovery_email: '&cЗабыл пароль? Используй команду &d/email recovery <АДРЕСОЧТЫ>'
usage_captcha: '&cUsage: /captcha <theCaptcha>'
wrong_captcha: '&cWrong Captcha, please use : /captcha THE_CAPTCHA'
valid_captcha: '&cYour captcha is valid !'
kick_forvip: '&cA VIP Player join the full server!'
kick_fullserver: '&cThe server is actually full, Sorry!'
usage_email_add: '&fUsage: /email add <email> <confirmEmail> '
usage_email_change: '&fUsage: /email change <oldEmail> <newEmail> '
usage_email_recovery: '&fUsage: /email recovery <email>'
new_email_invalid: '[AuthMe] New email invalid!'
old_email_invalid: '[AuthMe] Old email invalid!'
email_invalid: '[AuthMe] Invalid Email'
email_added: '[AuthMe] Email Added !'
email_confirm: '[AuthMe] Confirm your Email !'
email_changed: '[AuthMe] Email Change !'
email_send: '[AuthMe] Recovery Email Send !'
reload: '&fКонфигурация и база данных перезагружены.'
timeout: '&fВремя входа истекло, попробуйте еще раз, но быстрее'
usage_changepassword: '&fИспользование: /changepassword СТАРЫЙ_ПАРОЛЬ НОВЫЙ_ПАРОЛЬ'
name_len: '&cВаш логин слишком длинный или слишком короткий'
regex: '&cВаш логин содержит запрещенные символы. Разрешенные символы: REG_EX'
add_email: '&cДобавьте свой email: /email add ВАШ_EMAIL ВАШ_EMAIL'
bad_database_email: '&c[AuthMe] Команда &d/email&c доступна только при работе с MySQL или SQLite'
recovery_email: '&cЗабыли пароль? Используйте /email recovery ВАШ_EMAIL'
usage_captcha: '&cИспользование: /captcha СИМВОЛЫ_ВЫШЕ'
wrong_captcha: '&cНеправильная капча: /captcha СИМВОЛЫ_ВЫШЕ'
valid_captcha: '&cКапча введена правильно!'
kick_forvip: '&cVIP игрок зашел на переполненный сервер!'
kick_fullserver: '&cСервер переполнен!'
usage_email_add: '&fИспользование: /email add ВАШ_EMAIL ВАШ_EMAIL '
usage_email_change: '&fИспользование: /email change СТАРЫЙ_EMAIL НОВЫЙ_EMAIL '
usage_email_recovery: '&fИспользование: /email recovery ВАШ_EMAIL'
new_email_invalid: '[AuthMe] Новый email недействителен!'
old_email_invalid: '[AuthMe] Старый email недействителен!'
email_invalid: '[AuthMe] Email неправильный'
email_added: '[AuthMe] Email добавлен!'
email_confirm: '[AuthMe] Подтвердите ваш email!'
email_changed: '[AuthMe] Email изменен!'
email_send: '[AuthMe] Восстановительное письмо отправлено!'
country_banned: 'Your country is banned from this server'
antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!'
antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes, hope invasion stopped'

View File

@ -54,4 +54,7 @@ email_invalid: '[AuthMe] Invalid Email'
email_added: '[AuthMe] Email Added !'
email_confirm: '[AuthMe] Confirm your Email !'
email_changed: '[AuthMe] Email Change !'
email_send: '[AuthMe] Recovery Email Send !'
email_send: '[AuthMe] Recovery Email Send !'
country_banned: 'Your country is banned from this server'
antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!'
antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes, hope invasion stopped'

View File

@ -51,3 +51,6 @@ email_added: '[AuthMe] Email Added !'
email_confirm: '[AuthMe] Confirm your Email !'
email_changed: '[AuthMe] Email Change !'
email_send: '[AuthMe] Recovery Email Send !'
country_banned: 'Your country is banned from this server'
antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!'
antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes, hope invasion stopped'

View File

@ -1,3 +1,5 @@
# Translator: uSoc_lifehome (http://lifeho.me) #
# -------------------------------------------- #
unknown_user: '&f用戶資料並不存在於資料庫中 。'
unsafe_spawn: '&f你的登出位置不安全 現在將傳送你到重生點 。'
not_logged_in: '&c你還沒有登入 '
@ -16,13 +18,13 @@ no_perm: '&c你並沒有這個權限 。'
error: '&f發生錯誤 請與管理員聯絡 。'
login_msg: '&c請使用這個指令來登入 《 /login <密碼> 》'
reg_msg: '&c請使用這個的指令來註冊 《 /register <密碼> <重覆密碼> 》'
reg_email_msg: '&cPlease register with "/register <email> <confirmEmail>"'
reg_email_msg: '&c請使用這個的指令來註冊 《 /register <電郵> <重覆電郵> 》'
usage_unreg: '&c用法 《 /unregister <密碼> 》'
pwd_changed: '&c你成功的更換了你的密碼 '
user_unknown: '&c此用戶名沒有已登記資料 。'
password_error: '&f密碼不符合 。'
unvalid_session: '&f登入階段資料已損壞 請等待登入階段結束 。'
reg_only: '&f限已註冊會員 請先到 http://example.com 註冊 。'
reg_only: '&f限已註冊會員 請先到 https://www.craftinghk.com/ 註冊 。'
logged_in: '&c你已經登入過了 。'
logout: '&b你成功的登出了 。'
same_nick: '&f同名玩家已在遊玩 。'
@ -39,15 +41,18 @@ recovery_email: '&c忘記密碼 請使用這個的指令來更新密碼
usage_captcha: '&c用法 《 /captcha <驗證碼> 》'
wrong_captcha: '&c你輸入了錯誤的驗證碼請使用 《 /captcha <驗證碼> 》 再次輸入 。'
valid_captcha: '&c你的驗證碼是無效的 '
kick_forvip: '&cA VIP Player join the full server!'
kick_fullserver: '&cThe server is actually full, Sorry!'
usage_email_add: '&fUsage: /email add <email> <confirmEmail> '
usage_email_change: '&fUsage: /email change <oldEmail> <newEmail> '
usage_email_recovery: '&fUsage: /email recovery <email>'
new_email_invalid: '[AuthMe] New email invalid!'
old_email_invalid: '[AuthMe] Old email invalid!'
email_invalid: '[AuthMe] Invalid Email'
email_added: '[AuthMe] Email Added !'
email_confirm: '[AuthMe] Confirm your Email !'
email_changed: '[AuthMe] Email Change !'
email_send: '[AuthMe] Recovery Email Send !'
kick_forvip: '&cA 因為有VIP玩家進入了伺服器 。'
kick_fullserver: '&c抱歉 這個伺服器滿人了也許你需要VIP會藉'
usage_email_add: '&f用法 《 /email add <電郵> <重覆電郵> 》'
usage_email_change: '&f用法 《 /email change <舊電郵> <新電郵> 》'
usage_email_recovery: '&f用法 《 /email recovery <電郵> 》'
new_email_invalid: '你所填寫的新電郵地址並不正確。'
old_email_invalid: '你所填寫的舊電郵地址並不正確。'
email_invalid: '你所填寫的電郵地址並不正確。'
email_added: '已加入你的電郵地址記錄。'
email_confirm: '請重覆輸入你的電郵地址。'
email_changed: '你的電郵地址記錄已更改。'
email_send: '忘記密碼確定信件已寄出,請查收。'
country_banned: 'Your country is banned from this server'
antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!'
antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes, hope invasion stopped'

View File

@ -3,7 +3,7 @@ author: Xephi59
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.
main: fr.xephi.authme.AuthMe
version: 3.0
version: 3.1.1
softdepend: [Vault, ChestShop, Spout, Multiverse-Core, Notifications, Citizens, CombatTag, Essentials, EssentialsSpawn]
commands:
register:
@ -60,6 +60,9 @@ permissions:
authme.admin.lastlogin: true
authme.admin.getemail: true
authme.admin.chgemail: true
authme.admin.purgelastpos: true
authme.admin.switchantibot: true
authme.bypassantibot: true
authme.register:
description: Register an account
default: true
@ -77,7 +80,7 @@ permissions:
default: true
authme.passpartu:
description: passpartu
default: true
default: true
authme.allow2accounts:
description: allow more accounts for same ip
default: false
@ -140,4 +143,16 @@ permissions:
default: op
authme.admin.flattosqlite:
description: Convert File to Sqlite method
default: op
authme.bypassforcesurvival:
description: Bypass all ForceSurvival features
default: false
authme.admin.purgelastpos:
description: Purge last pos of players
default: op
authme.admin.switchantibot:
description: Switch AntiBot mode on/off
default: op
authme.bypassantibot:
description: Bypass the AntiBot check
default: op