Codestyle cleanup

This commit is contained in:
sgdc3 2017-09-27 15:16:33 +02:00
parent 83b5a3d66d
commit 920e65c4f4
10 changed files with 15 additions and 14 deletions

View File

@ -224,7 +224,7 @@ public class AuthMe extends JavaPlugin {
// Convert deprecated PLAINTEXT hash entries
MigrationService.changePlainTextToSha256(settings, database, new Sha256());
// TODO: does this still make sense? -sgdc3
//TODO: does this still make sense? -sgdc3
// If the server is empty (fresh start) just set all the players as unlogged
if (bukkitService.getOnlinePlayers().isEmpty()) {
database.purgeLogged();

View File

@ -18,7 +18,6 @@ import org.bukkit.entity.Player;
import javax.inject.Inject;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;

View File

@ -430,8 +430,9 @@ public class SQLite implements DataSource {
try (PreparedStatement pst = con.prepareStatement(sql)) {
pst.setString(1, user);
try (ResultSet rs = pst.executeQuery()) {
if (rs.next())
if (rs.next()) {
return rs.getInt(col.IS_LOGGED) == 1;
}
}
} catch (SQLException ex) {
logSqlException(ex);
@ -454,7 +455,7 @@ public class SQLite implements DataSource {
@Override
public void setUnlogged(String user) {
String sql = "UPDATE " + tableName + " SET " + col.IS_LOGGED + "=? WHERE LOWER(" + col.NAME + ")=?;";
if (user != null)
if (user != null) {
try (PreparedStatement pst = con.prepareStatement(sql)) {
pst.setInt(1, 0);
pst.setString(2, user);
@ -462,6 +463,7 @@ public class SQLite implements DataSource {
} catch (SQLException ex) {
logSqlException(ex);
}
}
}
@Override

View File

@ -40,7 +40,7 @@ public class RakamakConverter implements Converter {
}
@Override
// TODO ljacqu 20151229: Restructure this into smaller portions
//TODO ljacqu 20151229: Restructure this into smaller portions
public void execute(CommandSender sender) {
boolean useIp = settings.getProperty(ConverterSettings.RAKAMAK_USE_IP);
String fileName = settings.getProperty(ConverterSettings.RAKAMAK_FILE_NAME);

View File

@ -49,7 +49,7 @@ public class XAuthConverter implements Converter {
sender.sendMessage("[AuthMe] xAuth plugin not found");
return;
}
// TODO ljacqu 20160702: xAuthDb is not used except for the existence check -- is this intended?
//TODO ljacqu 20160702: xAuthDb is not used except for the existence check -- is this intended?
File xAuthDb = new File(dataFolder.getParent(), makePath("xAuth", "xAuth.h2.db"));
if (!xAuthDb.exists()) {
sender.sendMessage("[AuthMe] xAuth H2 database not found, checking for MySQL or SQLite data...");
@ -86,8 +86,9 @@ public class XAuthConverter implements Converter {
ps = conn.prepareStatement(sql);
ps.setInt(1, id);
rs = ps.executeQuery();
if (!rs.next())
if (!rs.next()) {
return null;
}
realPass = rs.getString("playername").toLowerCase();
} catch (SQLException e) {
xAuthLog.severe("Failed to retrieve name for account: " + id, e);
@ -131,8 +132,9 @@ public class XAuthConverter implements Converter {
ps = conn.prepareStatement(sql);
ps.setInt(1, accountId);
rs = ps.executeQuery();
if (!rs.next())
if (!rs.next()) {
return null;
}
realPass = rs.getString("password");
} catch (SQLException e) {
xAuthLog.severe("Failed to retrieve password hash for account: " + accountId, e);

View File

@ -399,7 +399,7 @@ public class PlayerListener implements Listener {
}
}
// TODO: check this, why do we need to update the quit loc? -sgdc3
//TODO: check this, why do we need to update the quit loc? -sgdc3
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onPlayerRespawn(PlayerRespawnEvent event) {
if (settings.getProperty(RestrictionSettings.NO_TELEPORT)) {

View File

@ -4,11 +4,9 @@ import fr.xephi.authme.permission.PermissionNode;
import fr.xephi.authme.permission.PermissionsSystemType;
import fr.xephi.authme.util.Utils;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import java.util.Collection;
public interface PermissionHandler {
/**

View File

@ -3,7 +3,6 @@ package fr.xephi.authme.permission.handlers;
import fr.xephi.authme.permission.PermissionNode;
import fr.xephi.authme.permission.PermissionsSystemType;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import ru.tehkode.permissions.PermissionManager;
import ru.tehkode.permissions.PermissionUser;
import ru.tehkode.permissions.bukkit.PermissionsEx;

View File

@ -9,6 +9,7 @@ import fr.xephi.authme.service.GeoIpService;
import fr.xephi.authme.util.PlayerUtils;
import fr.xephi.authme.util.lazytags.Tag;
import fr.xephi.authme.util.lazytags.TagReplacer;
import org.bukkit.ChatColor;
import org.bukkit.Server;
import org.bukkit.entity.Player;
@ -48,7 +49,7 @@ public class WelcomeMessageConfiguration implements Reloadable {
/** List of all supported tags for the welcome message. */
private final List<Tag<Player>> availableTags = Arrays.asList(
createTag("&", () -> "\u00a7"),
createTag("&", () -> String.valueOf(ChatColor.COLOR_CHAR)),
createTag("{PLAYER}", pl -> pl.getName()),
createTag("{ONLINE}", () -> Integer.toString(bukkitService.getOnlinePlayers().size())),
createTag("{MAXPLAYERS}", () -> Integer.toString(server.getMaxPlayers())),

View File

@ -91,7 +91,7 @@ public class PurgeExecutor {
*/
synchronized void purgeFromAuthMe(Collection<String> names) {
dataSource.purgeRecords(names);
// TODO ljacqu 20160717: We shouldn't output namedBanned.size() but the actual total that was deleted
//TODO ljacqu 20160717: We shouldn't output namedBanned.size() but the actual total that was deleted
ConsoleLogger.info(ChatColor.GOLD + "Deleted " + names.size() + " user accounts");
}