Drop old supports
This commit is contained in:
parent
5fe8ece0b3
commit
d2cc60db78
Binary file not shown.
BIN
libs/xAuth.jar
BIN
libs/xAuth.jar
Binary file not shown.
27
pom.xml
27
pom.xml
@ -140,7 +140,7 @@
|
|||||||
<!-- Essentials Repo -->
|
<!-- Essentials Repo -->
|
||||||
<repository>
|
<repository>
|
||||||
<id>ess-repo</id>
|
<id>ess-repo</id>
|
||||||
<url>http://repo.ess3.net/content/groups/public</url>
|
<url>http://repo.ess3.net/content/groups/essentials</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
||||||
<!-- CombatTagPlus Repo -->
|
<!-- CombatTagPlus Repo -->
|
||||||
@ -187,13 +187,6 @@
|
|||||||
<version>3.8.10.1</version>
|
<version>3.8.10.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Database Library -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.h2database</groupId>
|
|
||||||
<artifactId>h2</artifactId>
|
|
||||||
<version>1.4.187</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Java Email API -->
|
<!-- Java Email API -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sun.mail</groupId>
|
<groupId>com.sun.mail</groupId>
|
||||||
@ -382,23 +375,5 @@
|
|||||||
<systemPath>${project.basedir}/libs/ChestShop.jar</systemPath>
|
<systemPath>${project.basedir}/libs/ChestShop.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Citizens 1.X (No API) -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.citizensnpcs</groupId>
|
|
||||||
<artifactId>citizens</artifactId>
|
|
||||||
<version>1.2.4</version>
|
|
||||||
<scope>system</scope>
|
|
||||||
<systemPath>${project.basedir}/libs/Citizens.jar</systemPath>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Old version of xAuth by Cypherx -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.cypherx</groupId>
|
|
||||||
<artifactId>xauth</artifactId>
|
|
||||||
<version>2.0.26</version>
|
|
||||||
<scope>system</scope>
|
|
||||||
<systemPath>${project.basedir}/libs/xAuth.jar</systemPath>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -73,7 +73,6 @@ import fr.xephi.authme.settings.OtherAccounts;
|
|||||||
import fr.xephi.authme.settings.PlayersLogs;
|
import fr.xephi.authme.settings.PlayersLogs;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import fr.xephi.authme.settings.Spawn;
|
import fr.xephi.authme.settings.Spawn;
|
||||||
import net.citizensnpcs.Citizens;
|
|
||||||
import net.milkbowl.vault.permission.Permission;
|
import net.milkbowl.vault.permission.Permission;
|
||||||
|
|
||||||
public class AuthMe extends JavaPlugin {
|
public class AuthMe extends JavaPlugin {
|
||||||
@ -90,9 +89,9 @@ public class AuthMe extends JavaPlugin {
|
|||||||
private Utils utils = Utils.getInstance();
|
private Utils utils = Utils.getInstance();
|
||||||
private FileCache playerBackup = new FileCache(this);
|
private FileCache playerBackup = new FileCache(this);
|
||||||
public CitizensCommunicator citizens;
|
public CitizensCommunicator citizens;
|
||||||
|
public boolean isCitizensActive = false;
|
||||||
public SendMailSSL mail = null;
|
public SendMailSSL mail = null;
|
||||||
public int CitizensVersion = 0;
|
public boolean CombatTag = false;
|
||||||
public int CombatTag = 0;
|
|
||||||
public double ChestShop = 0;
|
public double ChestShop = 0;
|
||||||
public boolean BungeeCord = false;
|
public boolean BungeeCord = false;
|
||||||
public Essentials ess;
|
public Essentials ess;
|
||||||
@ -390,25 +389,16 @@ public class AuthMe extends JavaPlugin {
|
|||||||
|
|
||||||
public void combatTag() {
|
public void combatTag() {
|
||||||
if (this.getServer().getPluginManager().getPlugin("CombatTag") != null && this.getServer().getPluginManager().getPlugin("CombatTag").isEnabled()) {
|
if (this.getServer().getPluginManager().getPlugin("CombatTag") != null && this.getServer().getPluginManager().getPlugin("CombatTag").isEnabled()) {
|
||||||
this.CombatTag = 1;
|
this.CombatTag = true;
|
||||||
} else {
|
} else {
|
||||||
this.CombatTag = 0;
|
this.CombatTag = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void citizensVersion() {
|
public void citizensVersion() {
|
||||||
if (this.getServer().getPluginManager().getPlugin("Citizens") != null && this.getServer().getPluginManager().getPlugin("Citizens").isEnabled()) {
|
if (this.getServer().getPluginManager().getPlugin("Citizens") != null && this.getServer().getPluginManager().getPlugin("Citizens").isEnabled())
|
||||||
Citizens cit = (Citizens) this.getServer().getPluginManager().getPlugin("Citizens");
|
this.isCitizensActive = true;
|
||||||
String ver = cit.getDescription().getVersion();
|
else this.isCitizensActive = false;
|
||||||
String[] args = ver.split("\\.");
|
|
||||||
if (args[0].contains("1")) {
|
|
||||||
this.CitizensVersion = 1;
|
|
||||||
} else {
|
|
||||||
this.CitizensVersion = 2;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.CitizensVersion = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,132 +0,0 @@
|
|||||||
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 com.cypherx.xauth.xAuth;
|
|
||||||
import com.cypherx.xauth.database.Table;
|
|
||||||
import com.cypherx.xauth.utils.xAuthLog;
|
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
|
||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Xephi59
|
|
||||||
*/
|
|
||||||
public class oldxAuthToFlat {
|
|
||||||
|
|
||||||
public AuthMe instance;
|
|
||||||
public DataSource database;
|
|
||||||
public CommandSender sender;
|
|
||||||
|
|
||||||
public oldxAuthToFlat(AuthMe instance, DataSource database,
|
|
||||||
CommandSender sender) {
|
|
||||||
this.instance = instance;
|
|
||||||
this.database = database;
|
|
||||||
this.sender = sender;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean convert() {
|
|
||||||
if (instance.getServer().getPluginManager().getPlugin("xAuth") == null) {
|
|
||||||
sender.sendMessage("[AuthMe] xAuth plugin not found");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!(new File(instance.getDataFolder().getParent() + File.separator + "xAuth" + File.separator + "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");
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -21,17 +21,11 @@ public class xAuthConverter implements Converter {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
Class.forName("com.cypherx.xauth.xAuth");
|
Class.forName("de.luricos.bukkit.xAuth.xAuth");
|
||||||
oldxAuthToFlat converter = new oldxAuthToFlat(plugin, database, sender);
|
xAuthToFlat converter = new xAuthToFlat(plugin, database, sender);
|
||||||
converter.convert();
|
converter.convert();
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException ce) {
|
||||||
try {
|
sender.sendMessage("xAuth has not been found, please put xAuth.jar in your plugin folder and restart!");
|
||||||
Class.forName("de.luricos.bukkit.xAuth.xAuth");
|
|
||||||
newxAuthToFlat converter = new newxAuthToFlat(plugin, database, sender);
|
|
||||||
converter.convert();
|
|
||||||
} catch (ClassNotFoundException ce) {
|
|
||||||
sender.sendMessage("xAuth has not been found, please put xAuth.jar in your plugin folder and restart!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,13 +17,13 @@ import fr.xephi.authme.AuthMe;
|
|||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
|
|
||||||
public class newxAuthToFlat {
|
public class xAuthToFlat {
|
||||||
|
|
||||||
public AuthMe instance;
|
public AuthMe instance;
|
||||||
public DataSource database;
|
public DataSource database;
|
||||||
public CommandSender sender;
|
public CommandSender sender;
|
||||||
|
|
||||||
public newxAuthToFlat(AuthMe instance, DataSource database,
|
public xAuthToFlat(AuthMe instance, DataSource database,
|
||||||
CommandSender sender) {
|
CommandSender sender) {
|
||||||
this.instance = instance;
|
this.instance = instance;
|
||||||
this.database = database;
|
this.database = database;
|
||||||
@ -61,11 +61,11 @@ public class AuthMeServerListener implements Listener {
|
|||||||
ConsoleLogger.info("ChestShop has been disabled, unhook!");
|
ConsoleLogger.info("ChestShop has been disabled, unhook!");
|
||||||
}
|
}
|
||||||
if (pluginName.equalsIgnoreCase("CombatTag")) {
|
if (pluginName.equalsIgnoreCase("CombatTag")) {
|
||||||
plugin.CombatTag = 0;
|
plugin.CombatTag = false;
|
||||||
ConsoleLogger.info("CombatTag has been disabled, unhook!");
|
ConsoleLogger.info("CombatTag has been disabled, unhook!");
|
||||||
}
|
}
|
||||||
if (pluginName.equalsIgnoreCase("Citizens")) {
|
if (pluginName.equalsIgnoreCase("Citizens")) {
|
||||||
plugin.CitizensVersion = 0;
|
plugin.isCitizensActive = false;
|
||||||
ConsoleLogger.info("Citizens has been disabled, unhook!");
|
ConsoleLogger.info("Citizens has been disabled, unhook!");
|
||||||
}
|
}
|
||||||
if (pluginName.equalsIgnoreCase("Vault")) {
|
if (pluginName.equalsIgnoreCase("Vault")) {
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
package fr.xephi.authme.plugin.manager;
|
package fr.xephi.authme.plugin.manager;
|
||||||
|
|
||||||
import net.citizensnpcs.api.CitizensAPI;
|
|
||||||
import net.citizensnpcs.api.CitizensManager;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
|
import net.citizensnpcs.api.CitizensAPI;
|
||||||
|
|
||||||
public class CitizensCommunicator {
|
public class CitizensCommunicator {
|
||||||
|
|
||||||
@ -16,14 +14,10 @@ public class CitizensCommunicator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNPC(final Entity player, AuthMe instance) {
|
public boolean isNPC(final Entity player, AuthMe instance) {
|
||||||
|
if (!this.instance.isCitizensActive)
|
||||||
|
return false;
|
||||||
try {
|
try {
|
||||||
if (instance.CitizensVersion == 1) {
|
return CitizensAPI.getNPCRegistry().isNPC(player);
|
||||||
return CitizensManager.isNPC(player);
|
|
||||||
} else if (instance.CitizensVersion == 2) {
|
|
||||||
return CitizensAPI.getNPCRegistry().isNPC(player);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} catch (NoClassDefFoundError ncdfe) {
|
} catch (NoClassDefFoundError ncdfe) {
|
||||||
return false;
|
return false;
|
||||||
} catch (Exception npe) {
|
} catch (Exception npe) {
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
package fr.xephi.authme.plugin.manager;
|
package fr.xephi.authme.plugin.manager;
|
||||||
|
|
||||||
import net.minelink.ctplus.CombatTagPlus;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -10,6 +8,9 @@ import org.bukkit.plugin.Plugin;
|
|||||||
import com.trc202.CombatTag.CombatTag;
|
import com.trc202.CombatTag.CombatTag;
|
||||||
import com.trc202.CombatTagApi.CombatTagApi;
|
import com.trc202.CombatTagApi.CombatTagApi;
|
||||||
|
|
||||||
|
import fr.xephi.authme.AuthMe;
|
||||||
|
import net.minelink.ctplus.CombatTagPlus;
|
||||||
|
|
||||||
public abstract class CombatTagComunicator {
|
public abstract class CombatTagComunicator {
|
||||||
|
|
||||||
public static CombatTagApi combatApi;
|
public static CombatTagApi combatApi;
|
||||||
@ -21,6 +22,8 @@ public abstract class CombatTagComunicator {
|
|||||||
* @return true if the player is an NPC
|
* @return true if the player is an NPC
|
||||||
*/
|
*/
|
||||||
public static boolean isNPC(Entity player) {
|
public static boolean isNPC(Entity player) {
|
||||||
|
if (!AuthMe.getInstance().CombatTag)
|
||||||
|
return false;
|
||||||
try {
|
try {
|
||||||
if (Bukkit.getServer().getPluginManager().getPlugin("CombatTag") != null) {
|
if (Bukkit.getServer().getPluginManager().getPlugin("CombatTag") != null) {
|
||||||
combatApi = new CombatTagApi((CombatTag) Bukkit.getServer().getPluginManager().getPlugin("CombatTag"));
|
combatApi = new CombatTagApi((CombatTag) Bukkit.getServer().getPluginManager().getPlugin("CombatTag"));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user