Update 3.3.5

//Changes 3.3.5://
* Now Support our sponsor ipClean feature ( Get player real ip through
their servers )
* Now Cache correctly Item Custom Names and Lores
* Fix FlatToSQL converter
* Add /authme getip <playername> command, perm : authme.admin.getip
* Implement correctly XenForo Support
* Fix maxregperip
* Fix maxloginperip
* Preparation for next features, coming soon !
This commit is contained in:
Xephi
2014-04-01 10:32:27 +02:00
parent b659d8968e
commit 8c3dc12658
23 changed files with 489 additions and 341 deletions
@@ -29,10 +29,12 @@ public class FlatToSql {
private static String lastlocZ;
private static String lastlocWorld;
private static String columnEmail;
private static String columnLogged;
private static String columnID;
private static File source;
private static File output;
public static void FlatToSqlConverter() throws IOException {
public FlatToSql() {
tableName = Settings.getMySQLTablename;
columnName = Settings.getMySQLColumnName;
columnPassword = Settings.getMySQLColumnPassword;
@@ -43,7 +45,11 @@ public class FlatToSql {
lastlocZ = Settings.getMySQLlastlocZ;
lastlocWorld = Settings.getMySQLlastlocWorld;
columnEmail = Settings.getMySQLColumnEmail;
columnLogged = Settings.getMySQLColumnLogged;
columnID = Settings.getMySQLColumnId;
}
public boolean convert() throws IOException {
try {
source = new File(AuthMe.getInstance().getDataFolder() + File.separator + "auths.db");
source.createNewFile();
@@ -53,45 +59,46 @@ public class FlatToSql {
br = new BufferedReader(new FileReader(source));
sql = new BufferedWriter(new FileWriter(output));
String createDB = " CREATE TABLE IF NOT EXISTS " + tableName + " ("
+ "id INTEGER AUTO_INCREMENT,"
+ columnName + " VARCHAR(255) NOT NULL UNIQUE,"
+ columnPassword + " VARCHAR(255) NOT NULL,"
+ columnIp + " VARCHAR(40) NOT NULL,"
+ columnLastLogin + " BIGINT,"
+ lastlocX + " smallint(6) DEFAULT '0',"
+ lastlocY + " smallint(6) DEFAULT '0',"
+ lastlocZ + " smallint(6) DEFAULT '0',"
+ lastlocWorld + " VARCHAR(255) DEFAULT 'world',"
+ columnEmail + " VARCHAR(255) NOT NULL,"
+ "CONSTRAINT table_const_prim PRIMARY KEY (id));";
+ columnID + " INTEGER AUTO_INCREMENT,"
+ columnName + " VARCHAR(255) NOT NULL UNIQUE,"
+ columnPassword + " VARCHAR(255) NOT NULL,"
+ columnIp + " VARCHAR(40) NOT NULL DEFAULT '127.0.0.1',"
+ columnLastLogin + " BIGINT DEFAULT '0',"
+ lastlocX + " DOUBLE NOT NULL DEFAULT '0.0',"
+ lastlocY + " DOUBLE NOT NULL DEFAULT '0.0',"
+ lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0',"
+ lastlocWorld + " VARCHAR(255) DEFAULT 'world',"
+ columnEmail + " VARCHAR(255) DEFAULT 'your@email.com',"
+ columnLogged + " SMALLINT NOT NULL DEFAULT '0',"
+ "CONSTRAINT table_const_prim PRIMARY KEY (" + columnID + "));";
sql.write(createDB);
String line;
int i = 1;
String newline;
while ((line = br.readLine()) != null) {
sql.newLine();
String[] args = line.split(":");
if (args.length == 4)
newline = "INSERT INTO " + tableName + " VALUES (" + i + ", '" + args[0] + "', '" + args[1] + "', '" + args[2] + "', " + args[3] + ", 0, 0, 0, 'world', 'your@email.com');";
newline = "INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + "," + columnIp + "," + columnLastLogin + "," + lastlocX + "," + lastlocY + "," + lastlocZ + "," + lastlocWorld + "," + columnEmail + "," + columnLogged + ") VALUES ('" + args[0] + "', '" + args[1] + "', '" + args[2] + "', " + args[3] + ", 0.0, 0.0, 0.0, 'world', 'your@email.com', 0);";
else if (args.length == 7)
newline = "INSERT INTO " + tableName + " VALUES (" + i + ", '" + args[0] + "', '" + args[1] + "', '" + args[2] + "', " + args[3] + ", " + args[4] + ", " + args[5] + ", " + args[6] + ", 'world', 'your@email.com');";
newline = "INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + "," + columnIp + "," + columnLastLogin + "," + lastlocX + "," + lastlocY + "," + lastlocZ + "," + lastlocWorld + "," + columnEmail + "," + columnLogged + ") VALUES ('" + args[0] + "', '" + args[1] + "', '" + args[2] + "', " + args[3] + ", " + args[4] + ", " + args[5] + ", " + args[6] + ", 'world', 'your@email.com', 0);";
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');";
newline = "INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + "," + columnIp + "," + columnLastLogin + "," + lastlocX + "," + lastlocY + "," + lastlocZ + "," + lastlocWorld + "," + columnEmail + "," + columnLogged + ") VALUES ('" + args[0] + "', '" + args[1] + "', '" + args[2] + "', " + args[3] + ", " + args[4] + ", " + args[5] + ", " + args[6] + ", '" + args[7] + "', 'your@email.com', 0);";
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] + "');";
newline = "INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + "," + columnIp + "," + columnLastLogin + "," + lastlocX + "," + lastlocY + "," + lastlocZ + "," + lastlocWorld + "," + columnEmail + "," + columnLogged + ") VALUES ('" + args[0] + "', '" + args[1] + "', '" + args[2] + "', " + args[3] + ", " + args[4] + ", " + args[5] + ", " + args[6] + ", '" + args[7] + "', '" + args[8] + "', 0);";
else
newline = "";
if (newline != "")
sql.write(newline);
i = i + 1;
}
sql.close();
br.close();
ConsoleLogger.info("The FlatFile has been converted to authme.sql file");
return true;
} catch (FileNotFoundException ex) {
ConsoleLogger.showError(ex.getMessage());
} catch (IOException ex) {
ConsoleLogger.showError(ex.getMessage());
}
return false;
}
}