Update 3.3 + fix permission error
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package fr.xephi.authme.converter;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
|
||||
public class RoyalAuthConverter extends Thread {
|
||||
|
||||
public AuthMe plugin;
|
||||
private DataSource data;
|
||||
|
||||
public RoyalAuthConverter(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.data = plugin.database;
|
||||
this.start();
|
||||
}
|
||||
|
||||
public void run() {
|
||||
for (OfflinePlayer o : plugin.getServer().getOfflinePlayers()) {
|
||||
try {
|
||||
String name = o.getName().toLowerCase();
|
||||
String separator = File.separator;
|
||||
File file = new File("." + separator + "plugins" + separator + "RoyalAuth" + separator + "userdata" + separator + name + ".yml");
|
||||
if (data.isAuthAvailable(name))
|
||||
continue;
|
||||
if (!file.exists())
|
||||
continue;
|
||||
RoyalAuthYamlReader ra = new RoyalAuthYamlReader(file);
|
||||
PlayerAuth auth = new PlayerAuth(name, ra.getHash(), "127.0.0.1", ra.getLastLogin(), "your@email.com", o.getName());
|
||||
data.saveAuth(auth);
|
||||
} catch (Exception e) {
|
||||
ConsoleLogger.showError("Error while trying to import "+ o.getName() + " RoyalAuth datas");
|
||||
}
|
||||
}
|
||||
this.interrupt();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package fr.xephi.authme.converter;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import fr.xephi.authme.settings.CustomConfiguration;
|
||||
|
||||
public class RoyalAuthYamlReader extends CustomConfiguration {
|
||||
|
||||
public RoyalAuthYamlReader(File file) {
|
||||
super(file);
|
||||
load();
|
||||
save();
|
||||
}
|
||||
|
||||
public long getLastLogin() {
|
||||
return getLong("timestamps.quit");
|
||||
}
|
||||
|
||||
public String getHash() {
|
||||
return getString("login.password");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user