Remove some warnings
This commit is contained in:
parent
140a807a59
commit
8d8ce1c4eb
@ -3,7 +3,6 @@ package fr.xephi.authme;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.milkbowl.vault.Vault;
|
|
||||||
import net.milkbowl.vault.permission.Permission;
|
import net.milkbowl.vault.permission.Permission;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -121,6 +120,7 @@ public class DataManager extends Thread {
|
|||||||
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " EssentialsFiles");
|
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " EssentialsFiles");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void purgePermissions(List<String> cleared, Permission permission) {
|
public void purgePermissions(List<String> cleared, Permission permission) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (String name : cleared) {
|
for (String name : cleared) {
|
||||||
|
|||||||
@ -33,6 +33,7 @@ public class Utils {
|
|||||||
setGroup(player.getName(), group);
|
setGroup(player.getName(), group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void setGroup(String player, groupType group) {
|
public void setGroup(String player, groupType group) {
|
||||||
if (!Settings.isPermissionCheckEnabled)
|
if (!Settings.isPermissionCheckEnabled)
|
||||||
return;
|
return;
|
||||||
@ -81,6 +82,7 @@ public class Utils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public boolean addNormal(Player player, String group) {
|
public boolean addNormal(Player player, String group) {
|
||||||
if (!useGroupSystem()) {
|
if (!useGroupSystem()) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package fr.xephi.authme.commands;
|
package fr.xephi.authme.commands;
|
||||||
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
|||||||
@ -120,10 +120,11 @@ public class LogoutCommand implements CommandExecutor {
|
|||||||
player.setAllowFlight(true);
|
player.setAllowFlight(true);
|
||||||
player.setFlying(true);
|
player.setFlying(true);
|
||||||
// Player is now logout... Time to fire event !
|
// Player is now logout... Time to fire event !
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||||
@Override
|
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new LogoutEvent(player));
|
Bukkit.getServer().getPluginManager().callEvent(new LogoutEvent(player));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
m.send(player, "logout");
|
m.send(player, "logout");
|
||||||
|
|||||||
@ -256,6 +256,7 @@ public class MySQLThread extends Thread implements DataSource {
|
|||||||
pst.setString(3, auth.getIp());
|
pst.setString(3, auth.getIp());
|
||||||
pst.setLong(4, auth.getLastLogin());
|
pst.setLong(4, auth.getLastLogin());
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
|
pst.close();
|
||||||
} else {
|
} else {
|
||||||
pst = con.prepareStatement("INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + "," + columnIp + "," + columnLastLogin + "," + columnSalt + ") VALUES (?,?,?,?,?);");
|
pst = con.prepareStatement("INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + "," + columnIp + "," + columnLastLogin + "," + columnSalt + ") VALUES (?,?,?,?,?);");
|
||||||
pst.setString(1, auth.getNickname());
|
pst.setString(1, auth.getNickname());
|
||||||
@ -264,6 +265,7 @@ public class MySQLThread extends Thread implements DataSource {
|
|||||||
pst.setLong(4, auth.getLastLogin());
|
pst.setLong(4, auth.getLastLogin());
|
||||||
pst.setString(5, auth.getSalt());
|
pst.setString(5, auth.getSalt());
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
|
pst.close();
|
||||||
}
|
}
|
||||||
if (!columnOthers.isEmpty()) {
|
if (!columnOthers.isEmpty()) {
|
||||||
for (String column : columnOthers) {
|
for (String column : columnOthers) {
|
||||||
@ -271,14 +273,15 @@ public class MySQLThread extends Thread implements DataSource {
|
|||||||
pst.setString(1, auth.getNickname());
|
pst.setString(1, auth.getNickname());
|
||||||
pst.setString(2, auth.getNickname());
|
pst.setString(2, auth.getNickname());
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
|
pst.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Settings.getPasswordHash == HashAlgorithm.PHPBB) {
|
if (Settings.getPasswordHash == HashAlgorithm.PHPBB) {
|
||||||
int id;
|
int id;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnName + "=?;");
|
PreparedStatement pst2 = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnName + "=?;");
|
||||||
pst.setString(1, auth.getNickname());
|
pst2.setString(1, auth.getNickname());
|
||||||
rs = pst.executeQuery();
|
rs = pst2.executeQuery();
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
id = rs.getInt(columnID);
|
id = rs.getInt(columnID);
|
||||||
// Insert player in phpbb_user_group
|
// Insert player in phpbb_user_group
|
||||||
@ -288,16 +291,19 @@ public class MySQLThread extends Thread implements DataSource {
|
|||||||
pst.setInt(3, 0);
|
pst.setInt(3, 0);
|
||||||
pst.setInt(4, 0);
|
pst.setInt(4, 0);
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
|
pst.close();
|
||||||
// Update username_clean in phpbb_users
|
// Update username_clean in phpbb_users
|
||||||
pst = con.prepareStatement("UPDATE " + tableName + " SET " + tableName + ".username_clean=? WHERE " + columnName + "=?;");
|
pst = con.prepareStatement("UPDATE " + tableName + " SET " + tableName + ".username_clean=? WHERE " + columnName + "=?;");
|
||||||
pst.setString(1, auth.getNickname().toLowerCase());
|
pst.setString(1, auth.getNickname().toLowerCase());
|
||||||
pst.setString(2, auth.getNickname());
|
pst.setString(2, auth.getNickname());
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
|
pst.close();
|
||||||
// Update player group in phpbb_users
|
// Update player group in phpbb_users
|
||||||
pst = con.prepareStatement("UPDATE " + tableName + " SET " + tableName + ".group_id=? WHERE " + columnName + "=?;");
|
pst = con.prepareStatement("UPDATE " + tableName + " SET " + tableName + ".group_id=? WHERE " + columnName + "=?;");
|
||||||
pst.setInt(1, Settings.getPhpbbGroup);
|
pst.setInt(1, Settings.getPhpbbGroup);
|
||||||
pst.setString(2, auth.getNickname());
|
pst.setString(2, auth.getNickname());
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
|
pst.close();
|
||||||
// Get current time without ms
|
// Get current time without ms
|
||||||
long time = System.currentTimeMillis() / 1000;
|
long time = System.currentTimeMillis() / 1000;
|
||||||
// Update user_regdate
|
// Update user_regdate
|
||||||
@ -305,15 +311,19 @@ public class MySQLThread extends Thread implements DataSource {
|
|||||||
pst.setLong(1, time);
|
pst.setLong(1, time);
|
||||||
pst.setString(2, auth.getNickname());
|
pst.setString(2, auth.getNickname());
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
|
pst.close();
|
||||||
// Update user_lastvisit
|
// Update user_lastvisit
|
||||||
pst = con.prepareStatement("UPDATE " + tableName + " SET " + tableName + ".user_lastvisit=? WHERE " + columnName + "=?;");
|
pst = con.prepareStatement("UPDATE " + tableName + " SET " + tableName + ".user_lastvisit=? WHERE " + columnName + "=?;");
|
||||||
pst.setLong(1, time);
|
pst.setLong(1, time);
|
||||||
pst.setString(2, auth.getNickname());
|
pst.setString(2, auth.getNickname());
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
|
pst.close();
|
||||||
// Increment num_users
|
// Increment num_users
|
||||||
pst = con.prepareStatement("UPDATE " + Settings.getPhpbbPrefix + "config SET config_value = config_value + 1 WHERE config_name = 'num_users';");
|
pst = con.prepareStatement("UPDATE " + Settings.getPhpbbPrefix + "config SET config_value = config_value + 1 WHERE config_name = 'num_users';");
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
|
pst.close();
|
||||||
}
|
}
|
||||||
|
pst2.close();
|
||||||
}
|
}
|
||||||
if (Settings.getPasswordHash == HashAlgorithm.WORDPRESS) {
|
if (Settings.getPasswordHash == HashAlgorithm.WORDPRESS) {
|
||||||
int id;
|
int id;
|
||||||
@ -439,6 +449,7 @@ public class MySQLThread extends Thread implements DataSource {
|
|||||||
pst.setString(1, auth.getHash());
|
pst.setString(1, auth.getHash());
|
||||||
pst.setString(2, auth.getNickname());
|
pst.setString(2, auth.getNickname());
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
|
pst.close();
|
||||||
if (Settings.getPasswordHash == HashAlgorithm.XENFORO) {
|
if (Settings.getPasswordHash == HashAlgorithm.XENFORO) {
|
||||||
int id;
|
int id;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
@ -533,6 +544,7 @@ public class MySQLThread extends Thread implements DataSource {
|
|||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
list.add(rs.getString(columnName));
|
list.add(rs.getString(columnName));
|
||||||
}
|
}
|
||||||
|
pst.close();
|
||||||
pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE " + columnLastLogin + "<?;");
|
pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE " + columnLastLogin + "<?;");
|
||||||
pst.setLong(1, until);
|
pst.setLong(1, until);
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
@ -565,10 +577,14 @@ public class MySQLThread extends Thread implements DataSource {
|
|||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
id = rs.getInt(columnID);
|
id = rs.getInt(columnID);
|
||||||
// Remove data
|
// Remove data
|
||||||
pst = con.prepareStatement("DELETE FROM xf_user_authenticate WHERE " + columnID + "=?;");
|
PreparedStatement pst2 = con.prepareStatement("DELETE FROM xf_user_authenticate WHERE " + columnID + "=?;");
|
||||||
pst.setInt(1, id);
|
pst2.setInt(1, id);
|
||||||
|
pst2.executeUpdate();
|
||||||
|
pst2.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (pst != null && !pst.isClosed())
|
||||||
|
pst.close();
|
||||||
pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE LOWER(" + columnName + ")=?;");
|
pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE LOWER(" + columnName + ")=?;");
|
||||||
pst.setString(1, user);
|
pst.setString(1, user);
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
|
|||||||
@ -2,8 +2,10 @@ package fr.xephi.authme.settings;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
|
|
||||||
@ -25,6 +27,7 @@ public class Messages extends CustomConfiguration {
|
|||||||
* @param filename
|
* @param filename
|
||||||
* The filename to open
|
* The filename to open
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public final void loadDefaults(File file) {
|
public final void loadDefaults(File file) {
|
||||||
InputStream stream = AuthMe.getInstance().getResource(file.getName());
|
InputStream stream = AuthMe.getInstance().getResource(file.getName());
|
||||||
if (stream == null)
|
if (stream == null)
|
||||||
|
|||||||
@ -700,6 +700,7 @@ public final class Settings extends YamlConfiguration {
|
|||||||
* @param filename
|
* @param filename
|
||||||
* The filename to open
|
* The filename to open
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public final void loadDefaults(String filename) {
|
public final void loadDefaults(String filename) {
|
||||||
InputStream stream = plugin.getResource(filename);
|
InputStream stream = plugin.getResource(filename);
|
||||||
if (stream == null)
|
if (stream == null)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user