Minor cleanups
- Fix line length violations - Add JavaDoc to some longer methods - Remove unused imports
This commit is contained in:
parent
83e247afe9
commit
7864bb06ac
@ -12,7 +12,6 @@ import fr.xephi.authme.settings.Settings;
|
|||||||
import fr.xephi.authme.settings.properties.DatabaseSettings;
|
import fr.xephi.authme.settings.properties.DatabaseSettings;
|
||||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||||
import fr.xephi.authme.util.StringUtils;
|
import fr.xephi.authme.util.StringUtils;
|
||||||
import fr.xephi.authme.util.Utils;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.DatabaseMetaData;
|
import java.sql.DatabaseMetaData;
|
||||||
@ -344,7 +343,8 @@ public class MySQL implements DataSource {
|
|||||||
|
|
||||||
if (!columnOthers.isEmpty()) {
|
if (!columnOthers.isEmpty()) {
|
||||||
for (String column : columnOthers) {
|
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(1, auth.getRealName());
|
||||||
pst.setString(2, auth.getNickname());
|
pst.setString(2, auth.getNickname());
|
||||||
pst.executeUpdate();
|
pst.executeUpdate();
|
||||||
|
|||||||
@ -85,6 +85,7 @@ class XfBcryptExtension extends MySqlExtension {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void extendAuth(PlayerAuth auth, int id, Connection con) throws SQLException {
|
public void extendAuth(PlayerAuth auth, int id, Connection con) throws SQLException {
|
||||||
try (PreparedStatement pst = con.prepareStatement(
|
try (PreparedStatement pst = con.prepareStatement(
|
||||||
"SELECT data FROM " + xfPrefix + "user_authenticate WHERE " + col.ID + "=?;")) {
|
"SELECT data FROM " + xfPrefix + "user_authenticate WHERE " + col.ID + "=?;")) {
|
||||||
|
|||||||
@ -83,6 +83,10 @@ public class OnStartupTasks {
|
|||||||
logger.addFilter(new Log4JFilter());
|
logger.addFilter(new Log4JFilter());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts a task that regularly reminds players without a defined email to set their email,
|
||||||
|
* if enabled.
|
||||||
|
*/
|
||||||
public void scheduleRecallEmailTask() {
|
public void scheduleRecallEmailTask() {
|
||||||
if (!settings.getProperty(RECALL_PLAYERS)) {
|
if (!settings.getProperty(RECALL_PLAYERS)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -258,6 +258,15 @@ public class PermissionsManager implements Reloadable {
|
|||||||
return handler.hasPermissionOffline(player.getName(), permissionNode);
|
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) {
|
public boolean hasPermissionOffline(String name, PermissionNode permissionNode) {
|
||||||
if (permissionNode == null) {
|
if (permissionNode == null) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -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.register.executors.RegistrationParameters;
|
||||||
import fr.xephi.authme.process.unregister.AsynchronousUnregister;
|
import fr.xephi.authme.process.unregister.AsynchronousUnregister;
|
||||||
import fr.xephi.authme.service.BukkitService;
|
import fr.xephi.authme.service.BukkitService;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,6 @@ import fr.xephi.authme.settings.properties.RegistrationSettings;
|
|||||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||||
import fr.xephi.authme.util.PlayerUtils;
|
import fr.xephi.authme.util.PlayerUtils;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
|||||||
@ -98,6 +98,9 @@ public class AntiBotService implements SettingsDependent {
|
|||||||
disableTask = bukkitService.runTaskLater(this::stopProtection, duration * TICKS_PER_MINUTE);
|
disableTask = bukkitService.runTaskLater(this::stopProtection, duration * TICKS_PER_MINUTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transitions the anti bot service from active status back to listening.
|
||||||
|
*/
|
||||||
private void stopProtection() {
|
private void stopProtection() {
|
||||||
if (antiBotStatus != AntiBotStatus.ACTIVE) {
|
if (antiBotStatus != AntiBotStatus.ACTIVE) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -79,7 +79,8 @@ public class TeleportationService implements Reloadable {
|
|||||||
&& settings.getProperty(TELEPORT_UNAUTHED_TO_SPAWN)) {
|
&& settings.getProperty(TELEPORT_UNAUTHED_TO_SPAWN)) {
|
||||||
final Location location = spawnLoader.getSpawnLocation(player);
|
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);
|
bukkitService.callEvent(event);
|
||||||
if(!isEventValid(event)) {
|
if(!isEventValid(event)) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -12,7 +12,6 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.plugin.messaging.Messenger;
|
import org.bukkit.plugin.messaging.Messenger;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import java.io.Console;
|
|
||||||
|
|
||||||
public class BungeeSender implements SettingsDependent {
|
public class BungeeSender implements SettingsDependent {
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user