Minor cleanups

- Fix line length violations
- Add JavaDoc to some longer methods
- Remove unused imports
This commit is contained in:
ljacqu 2018-02-23 23:23:24 +01:00
parent 83e247afe9
commit 7864bb06ac
9 changed files with 21 additions and 6 deletions

View File

@ -12,7 +12,6 @@ import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.DatabaseSettings;
import fr.xephi.authme.settings.properties.HooksSettings;
import fr.xephi.authme.util.StringUtils;
import fr.xephi.authme.util.Utils;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
@ -344,7 +343,8 @@ public class MySQL implements DataSource {
if (!columnOthers.isEmpty()) {
for (String column : columnOthers) {
try (PreparedStatement pst = con.prepareStatement("UPDATE " + tableName + " SET " + column + "=? WHERE " + col.NAME + "=?;")) {
try (PreparedStatement pst = con.prepareStatement(
"UPDATE " + tableName + " SET " + column + "=? WHERE " + col.NAME + "=?;")) {
pst.setString(1, auth.getRealName());
pst.setString(2, auth.getNickname());
pst.executeUpdate();

View File

@ -85,6 +85,7 @@ class XfBcryptExtension extends MySqlExtension {
}
}
@Override
public void extendAuth(PlayerAuth auth, int id, Connection con) throws SQLException {
try (PreparedStatement pst = con.prepareStatement(
"SELECT data FROM " + xfPrefix + "user_authenticate WHERE " + col.ID + "=?;")) {

View File

@ -83,6 +83,10 @@ public class OnStartupTasks {
logger.addFilter(new Log4JFilter());
}
/**
* Starts a task that regularly reminds players without a defined email to set their email,
* if enabled.
*/
public void scheduleRecallEmailTask() {
if (!settings.getProperty(RECALL_PLAYERS)) {
return;

View File

@ -258,6 +258,15 @@ public class PermissionsManager implements Reloadable {
return handler.hasPermissionOffline(player.getName(), permissionNode);
}
/**
* Check whether the offline player with the given name has permission for the given permission node.
* This method is used as a last resort when nothing besides the name is known.
*
* @param name The name of the player
* @param permissionNode The permission node to verify
*
* @return true if the player has permission, false otherwise
*/
public boolean hasPermissionOffline(String name, PermissionNode permissionNode) {
if (permissionNode == null) {
return true;

View File

@ -12,7 +12,6 @@ import fr.xephi.authme.process.register.executors.RegistrationMethod;
import fr.xephi.authme.process.register.executors.RegistrationParameters;
import fr.xephi.authme.process.unregister.AsynchronousUnregister;
import fr.xephi.authme.service.BukkitService;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -20,7 +20,6 @@ import fr.xephi.authme.settings.properties.RegistrationSettings;
import fr.xephi.authme.settings.properties.RestrictionSettings;
import fr.xephi.authme.util.PlayerUtils;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;

View File

@ -98,6 +98,9 @@ public class AntiBotService implements SettingsDependent {
disableTask = bukkitService.runTaskLater(this::stopProtection, duration * TICKS_PER_MINUTE);
}
/**
* Transitions the anti bot service from active status back to listening.
*/
private void stopProtection() {
if (antiBotStatus != AntiBotStatus.ACTIVE) {
return;

View File

@ -79,7 +79,8 @@ public class TeleportationService implements Reloadable {
&& settings.getProperty(TELEPORT_UNAUTHED_TO_SPAWN)) {
final Location location = spawnLoader.getSpawnLocation(player);
SpawnTeleportEvent event = new SpawnTeleportEvent(player, location, playerCache.isAuthenticated(player.getName()));
SpawnTeleportEvent event = new SpawnTeleportEvent(player, location,
playerCache.isAuthenticated(player.getName()));
bukkitService.callEvent(event);
if(!isEventValid(event)) {
return null;

View File

@ -12,7 +12,6 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.Messenger;
import javax.inject.Inject;
import java.io.Console;
public class BungeeSender implements SettingsDependent {