mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-09-06 20:28:06 +02:00
Remove the IPManager
We don't need it anymore
This commit is contained in:
parent
4ec98e5b3d
commit
ee177e8a3a
@ -2,7 +2,6 @@ package fr.xephi.authme;
|
||||
|
||||
import fr.xephi.authme.api.API;
|
||||
import fr.xephi.authme.api.NewAPI;
|
||||
import fr.xephi.authme.cache.IpAddressManager;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.cache.backup.JsonCache;
|
||||
@ -135,7 +134,6 @@ public class AuthMe extends JavaPlugin {
|
||||
private JsonCache playerBackup;
|
||||
private PasswordSecurity passwordSecurity;
|
||||
private DataSource database;
|
||||
private IpAddressManager ipAddressManager;
|
||||
private PluginHooks pluginHooks;
|
||||
private SpawnLoader spawnLoader;
|
||||
private AntiBot antiBot;
|
||||
@ -253,7 +251,6 @@ public class AuthMe extends JavaPlugin {
|
||||
|
||||
MigrationService.changePlainTextToSha256(newSettings, database, new SHA256());
|
||||
passwordSecurity = new PasswordSecurity(getDataSource(), newSettings, Bukkit.getPluginManager());
|
||||
ipAddressManager = new IpAddressManager(newSettings);
|
||||
|
||||
// Initialize spawn loader
|
||||
spawnLoader = new SpawnLoader(getDataFolder(), newSettings, pluginHooks);
|
||||
@ -262,7 +259,7 @@ public class AuthMe extends JavaPlugin {
|
||||
// Set up the permissions manager and command handler
|
||||
permsMan = initializePermissionsManager();
|
||||
ValidationService validationService = new ValidationService(newSettings, database, permsMan);
|
||||
commandHandler = initializeCommandHandler(permsMan, messages, passwordSecurity, newSettings, ipAddressManager,
|
||||
commandHandler = initializeCommandHandler(permsMan, messages, passwordSecurity, newSettings,
|
||||
pluginHooks, spawnLoader, antiBot, validationService);
|
||||
|
||||
// AntiBot delay
|
||||
@ -300,12 +297,12 @@ public class AuthMe extends JavaPlugin {
|
||||
setupApi();
|
||||
|
||||
// Set up the management
|
||||
ProcessService processService = new ProcessService(newSettings, messages, this, database, ipAddressManager,
|
||||
ProcessService processService = new ProcessService(newSettings, messages, this, database,
|
||||
passwordSecurity, pluginHooks, spawnLoader, validationService);
|
||||
management = new Management(this, processService, database, PlayerCache.getInstance());
|
||||
|
||||
// Set up the BungeeCord hook
|
||||
setupBungeeCordHook(newSettings, ipAddressManager);
|
||||
setupBungeeCordHook(newSettings);
|
||||
|
||||
// Reload support hook
|
||||
reloadSupportHook();
|
||||
@ -423,24 +420,23 @@ public class AuthMe extends JavaPlugin {
|
||||
/**
|
||||
* Set up the BungeeCord hook.
|
||||
*/
|
||||
private void setupBungeeCordHook(NewSetting settings, IpAddressManager ipAddressManager) {
|
||||
private void setupBungeeCordHook(NewSetting settings) {
|
||||
if (settings.getProperty(HooksSettings.BUNGEECORD)) {
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||
Bukkit.getMessenger().registerIncomingPluginChannel(
|
||||
this, "BungeeCord", new BungeeCordMessage(this, ipAddressManager));
|
||||
this, "BungeeCord", new BungeeCordMessage(this));
|
||||
}
|
||||
}
|
||||
|
||||
private CommandHandler initializeCommandHandler(PermissionsManager permissionsManager, Messages messages,
|
||||
PasswordSecurity passwordSecurity, NewSetting settings,
|
||||
IpAddressManager ipAddressManager, PluginHooks pluginHooks,
|
||||
SpawnLoader spawnLoader, AntiBot antiBot,
|
||||
ValidationService validationService) {
|
||||
PluginHooks pluginHooks, SpawnLoader spawnLoader,
|
||||
AntiBot antiBot, ValidationService validationService) {
|
||||
HelpProvider helpProvider = new HelpProvider(permissionsManager, settings.getProperty(HELP_HEADER));
|
||||
Set<CommandDescription> baseCommands = CommandInitializer.buildCommands();
|
||||
CommandMapper mapper = new CommandMapper(baseCommands, permissionsManager);
|
||||
CommandService commandService = new CommandService(this, mapper, helpProvider, messages, passwordSecurity,
|
||||
permissionsManager, settings, ipAddressManager, pluginHooks, spawnLoader, antiBot, validationService);
|
||||
permissionsManager, settings, pluginHooks, spawnLoader, antiBot, validationService);
|
||||
return new CommandHandler(commandService);
|
||||
}
|
||||
|
||||
@ -775,7 +771,7 @@ public class AuthMe extends JavaPlugin {
|
||||
|
||||
public String replaceAllInfo(String message, Player player) {
|
||||
String playersOnline = Integer.toString(Utils.getOnlinePlayers().size());
|
||||
String ipAddress = ipAddressManager.getPlayerIp(player);
|
||||
String ipAddress = Utils.getPlayerIp(player);
|
||||
return message
|
||||
.replace("&", "\u00a7")
|
||||
.replace("{PLAYER}", player.getName())
|
||||
@ -792,7 +788,7 @@ public class AuthMe extends JavaPlugin {
|
||||
public boolean isLoggedIp(String name, String ip) {
|
||||
int count = 0;
|
||||
for (Player player : Utils.getOnlinePlayers()) {
|
||||
if (ip.equalsIgnoreCase(ipAddressManager.getPlayerIp(player))
|
||||
if (ip.equalsIgnoreCase(Utils.getPlayerIp(player))
|
||||
&& database.isLogged(player.getName().toLowerCase())
|
||||
&& !player.getName().equalsIgnoreCase(name)) {
|
||||
++count;
|
||||
|
@ -1,109 +0,0 @@
|
||||
package fr.xephi.authme.cache;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.common.io.Resources;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.settings.NewSetting;
|
||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||
import fr.xephi.authme.util.StringUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* Stateful manager for looking up IP address appropriately, including caching.
|
||||
*/
|
||||
public class IpAddressManager {
|
||||
/**
|
||||
* Whether or not to use the VeryGames API or BungeeCord for IP lookups.
|
||||
*/
|
||||
private final boolean useVeryGamesIpCheck;
|
||||
private final boolean useBungee;
|
||||
/**
|
||||
* Cache for lookups.
|
||||
*/
|
||||
private final ConcurrentHashMap<String, String> ipCache;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param settings The settings instance
|
||||
*/
|
||||
public IpAddressManager(NewSetting settings) {
|
||||
this.useVeryGamesIpCheck = settings.getProperty(HooksSettings.ENABLE_VERYGAMES_IP_CHECK);
|
||||
this.useBungee = settings.getProperty(HooksSettings.BUNGEECORD);
|
||||
this.ipCache = new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the player's IP address. If enabled in the settings, the IP address returned by the
|
||||
* VeryGames API will be returned.
|
||||
*
|
||||
* @param player The player to look up
|
||||
*
|
||||
* @return The IP address of the player
|
||||
*/
|
||||
public String getPlayerIp(Player player) {
|
||||
final String playerName = player.getName().toLowerCase();
|
||||
final String cachedValue = ipCache.get(playerName);
|
||||
if (cachedValue != null) {
|
||||
return cachedValue;
|
||||
}
|
||||
|
||||
final String plainIp = player.getAddress().getAddress().getHostAddress();
|
||||
if (useBungee) {
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
out.writeUTF("IP");
|
||||
player.sendPluginMessage(AuthMe.getInstance(), "BungeeCord", out.toByteArray());
|
||||
}
|
||||
if (useVeryGamesIpCheck) {
|
||||
String veryGamesResult = getVeryGamesIp(plainIp, player.getAddress().getPort());
|
||||
if (veryGamesResult != null) {
|
||||
ipCache.put(playerName, veryGamesResult);
|
||||
return veryGamesResult;
|
||||
}
|
||||
}
|
||||
return plainIp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a player to the IP address cache.
|
||||
*
|
||||
* @param player The player to add or update the cache entry for
|
||||
* @param ip The IP address to add
|
||||
*/
|
||||
public void addCache(String player, String ip) {
|
||||
ipCache.put(player.toLowerCase(), ip);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a player's cache entry.
|
||||
*
|
||||
* @param player The player to remove
|
||||
*/
|
||||
public void removeCache(String player) {
|
||||
ipCache.remove(player.toLowerCase());
|
||||
}
|
||||
|
||||
// returns null if IP could not be looked up
|
||||
private String getVeryGamesIp(final String plainIp, final int port) {
|
||||
final String sUrl = String.format("http://monitor-1.verygames.net/api/?action=ipclean-real-ip"
|
||||
+ "&out=raw&ip=%s&port=%d", plainIp, port);
|
||||
|
||||
try {
|
||||
String result = Resources.toString(new URL(sUrl), Charsets.UTF_8);
|
||||
if (!StringUtils.isEmpty(result) && !result.contains("error")) {
|
||||
return result;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
ConsoleLogger.logException("Could not fetch Very Games API with URL '" + sUrl + "':", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -5,7 +5,6 @@ import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.command.help.HelpProvider;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.cache.IpAddressManager;
|
||||
import fr.xephi.authme.hooks.PluginHooks;
|
||||
import fr.xephi.authme.output.MessageKey;
|
||||
import fr.xephi.authme.output.Messages;
|
||||
@ -33,7 +32,6 @@ public class CommandService {
|
||||
private final PasswordSecurity passwordSecurity;
|
||||
private final PermissionsManager permissionsManager;
|
||||
private final NewSetting settings;
|
||||
private final IpAddressManager ipAddressManager;
|
||||
private final PluginHooks pluginHooks;
|
||||
private final SpawnLoader spawnLoader;
|
||||
private final AntiBot antiBot;
|
||||
@ -44,8 +42,7 @@ public class CommandService {
|
||||
*/
|
||||
public CommandService(AuthMe authMe, CommandMapper commandMapper, HelpProvider helpProvider, Messages messages,
|
||||
PasswordSecurity passwordSecurity, PermissionsManager permissionsManager, NewSetting settings,
|
||||
IpAddressManager ipAddressManager, PluginHooks pluginHooks, SpawnLoader spawnLoader,
|
||||
AntiBot antiBot, ValidationService validationService) {
|
||||
PluginHooks pluginHooks, SpawnLoader spawnLoader, AntiBot antiBot, ValidationService validationService) {
|
||||
this.authMe = authMe;
|
||||
this.messages = messages;
|
||||
this.helpProvider = helpProvider;
|
||||
@ -53,7 +50,6 @@ public class CommandService {
|
||||
this.passwordSecurity = passwordSecurity;
|
||||
this.permissionsManager = permissionsManager;
|
||||
this.settings = settings;
|
||||
this.ipAddressManager = ipAddressManager;
|
||||
this.pluginHooks = pluginHooks;
|
||||
this.spawnLoader = spawnLoader;
|
||||
this.antiBot = antiBot;
|
||||
@ -191,10 +187,6 @@ public class CommandService {
|
||||
return settings;
|
||||
}
|
||||
|
||||
public IpAddressManager getIpAddressManager() {
|
||||
return ipAddressManager;
|
||||
}
|
||||
|
||||
public PlayerCache getPlayerCache() {
|
||||
return PlayerCache.getInstance();
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class GetIpCommand implements ExecutableCommand {
|
||||
|
||||
if (commandService.getProperty(HooksSettings.ENABLE_VERYGAMES_IP_CHECK)) {
|
||||
sender.sendMessage(player.getName() + "'s real IP is: "
|
||||
+ commandService.getIpAddressManager().getPlayerIp(player));
|
||||
+ Utils.getPlayerIp(player));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.cache.IpAddressManager;
|
||||
import fr.xephi.authme.security.crypts.HashedPassword;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
@ -17,17 +16,14 @@ import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
public class BungeeCordMessage implements PluginMessageListener {
|
||||
|
||||
private final AuthMe plugin;
|
||||
private final IpAddressManager ipAddressManager;
|
||||
|
||||
/**
|
||||
* Constructor for BungeeCordMessage.
|
||||
*
|
||||
* @param plugin The plugin instance
|
||||
* @param ipAddressManager The IP address manager
|
||||
*/
|
||||
public BungeeCordMessage(AuthMe plugin, IpAddressManager ipAddressManager) {
|
||||
public BungeeCordMessage(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.ipAddressManager = ipAddressManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -37,11 +33,6 @@ public class BungeeCordMessage implements PluginMessageListener {
|
||||
}
|
||||
ByteArrayDataInput in = ByteStreams.newDataInput(message);
|
||||
String subChannel = in.readUTF();
|
||||
if ("IP".equals(subChannel)) { // We need only the IP channel
|
||||
String ip = in.readUTF();
|
||||
// Put the IP (only the ip not the port) in the hashMap
|
||||
ipAddressManager.addCache(player.getName(), ip);
|
||||
}
|
||||
if ("AuthMe".equalsIgnoreCase(subChannel)) {
|
||||
String str = in.readUTF();
|
||||
final String[] args = str.split(";");
|
||||
|
@ -1,7 +1,6 @@
|
||||
package fr.xephi.authme.process;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.cache.IpAddressManager;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.hooks.PluginHooks;
|
||||
import fr.xephi.authme.output.MessageKey;
|
||||
@ -25,20 +24,18 @@ public class ProcessService {
|
||||
private final Messages messages;
|
||||
private final AuthMe authMe;
|
||||
private final DataSource dataSource;
|
||||
private final IpAddressManager ipAddressManager;
|
||||
private final PasswordSecurity passwordSecurity;
|
||||
private final PluginHooks pluginHooks;
|
||||
private final SpawnLoader spawnLoader;
|
||||
private final ValidationService validationService;
|
||||
|
||||
public ProcessService(NewSetting settings, Messages messages, AuthMe authMe, DataSource dataSource,
|
||||
IpAddressManager ipAddressManager, PasswordSecurity passwordSecurity, PluginHooks pluginHooks,
|
||||
PasswordSecurity passwordSecurity, PluginHooks pluginHooks,
|
||||
SpawnLoader spawnLoader, ValidationService validationService) {
|
||||
this.settings = settings;
|
||||
this.messages = messages;
|
||||
this.authMe = authMe;
|
||||
this.dataSource = dataSource;
|
||||
this.ipAddressManager = ipAddressManager;
|
||||
this.passwordSecurity = passwordSecurity;
|
||||
this.pluginHooks = pluginHooks;
|
||||
this.spawnLoader = spawnLoader;
|
||||
@ -155,15 +152,6 @@ public class ProcessService {
|
||||
return authMe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the IP address manager.
|
||||
*
|
||||
* @return the ip address manager
|
||||
*/
|
||||
public IpAddressManager getIpAddressManager() {
|
||||
return ipAddressManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the hash for the given password.
|
||||
*
|
||||
|
@ -69,7 +69,7 @@ public class AsynchronousJoin implements Process {
|
||||
service.getPluginHooks().setEssentialsSocialSpyStatus(player, false);
|
||||
}
|
||||
|
||||
final String ip = service.getIpAddressManager().getPlayerIp(player);
|
||||
final String ip = Utils.getPlayerIp(player);
|
||||
if (isNameRestricted(name, ip, player.getAddress().getHostName(), service.getSettings())) {
|
||||
service.scheduleSyncDelayedTask(new Runnable() {
|
||||
@Override
|
||||
@ -305,7 +305,7 @@ public class AsynchronousJoin implements Process {
|
||||
private boolean hasJoinedIp(String name, String ip, NewSetting settings) {
|
||||
int count = 0;
|
||||
for (Player player : Utils.getOnlinePlayers()) {
|
||||
if (ip.equalsIgnoreCase(service.getIpAddressManager().getPlayerIp(player))
|
||||
if (ip.equalsIgnoreCase(Utils.getPlayerIp(player))
|
||||
&& !player.getName().equalsIgnoreCase(name)) {
|
||||
count++;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public class AsynchronousLogin implements Process {
|
||||
this.forceLogin = forceLogin;
|
||||
this.plugin = plugin;
|
||||
this.database = data;
|
||||
this.ip = service.getIpAddressManager().getPlayerIp(player);
|
||||
this.ip = Utils.getPlayerIp(player);
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class AsynchronousQuit implements Process {
|
||||
return;
|
||||
}
|
||||
|
||||
String ip = service.getIpAddressManager().getPlayerIp(player);
|
||||
String ip = Utils.getPlayerIp(player);
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
if (service.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
|
||||
@ -94,7 +94,6 @@ public class AsynchronousQuit implements Process {
|
||||
database.setUnlogged(name);
|
||||
}
|
||||
|
||||
service.getIpAddressManager().removeCache(player.getName());
|
||||
if (plugin.isEnabled()) {
|
||||
service.scheduleSyncDelayedTask(new ProcessSyncronousPlayerQuit(plugin, player, isOp, needToChange));
|
||||
}
|
||||
|
@ -17,6 +17,8 @@ import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||
import fr.xephi.authme.util.StringUtils;
|
||||
import fr.xephi.authme.util.Utils;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -44,7 +46,7 @@ public class AsyncRegister implements Process {
|
||||
this.email = email;
|
||||
this.plugin = plugin;
|
||||
this.database = data;
|
||||
this.ip = service.getIpAddressManager().getPlayerIp(player);
|
||||
this.ip = Utils.getPlayerIp(player);
|
||||
this.playerCache = playerCache;
|
||||
this.service = service;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class ProcessSyncEmailRegister implements Process {
|
||||
|
||||
player.saveData();
|
||||
if (!service.getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE)) {
|
||||
ConsoleLogger.info(player.getName() + " registered " + service.getIpAddressManager().getPlayerIp(player));
|
||||
ConsoleLogger.info(player.getName() + " registered " + Utils.getPlayerIp(player));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ public class ProcessSyncPasswordRegister implements Process {
|
||||
player.saveData();
|
||||
|
||||
if (!Settings.noConsoleSpam) {
|
||||
ConsoleLogger.info(player.getName() + " registered " + service.getIpAddressManager().getPlayerIp(player));
|
||||
ConsoleLogger.info(player.getName() + " registered " + Utils.getPlayerIp(player));
|
||||
}
|
||||
|
||||
// Kick Player after Registration is enabled, kick the player
|
||||
|
@ -35,6 +35,7 @@ public class HooksSettings implements SettingsClass {
|
||||
public static final Property<Boolean> CACHE_CUSTOM_ATTRIBUTES =
|
||||
newProperty("Hooks.customAttributes", false);
|
||||
|
||||
// TODO REMOVE ME
|
||||
@Comment("These features are only available on VeryGames Server Provider")
|
||||
public static final Property<Boolean> ENABLE_VERYGAMES_IP_CHECK =
|
||||
newProperty("VeryGames.enableIpCheck", false);
|
||||
|
@ -265,4 +265,11 @@ public final class Utils {
|
||||
NOTLOGGEDIN,
|
||||
LOGGEDIN
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the IP of the given player.
|
||||
*/
|
||||
public static String getPlayerIp(Player p) {
|
||||
return p.getAddress().getAddress().getHostAddress();
|
||||
}
|
||||
}
|
||||
|
@ -3,13 +3,9 @@ package fr.xephi.authme.cache;
|
||||
import fr.xephi.authme.settings.NewSetting;
|
||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
@ -35,29 +31,4 @@ public class IpAddressManagerTest {
|
||||
return player;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldRetrieveFromCache() {
|
||||
// given
|
||||
IpAddressManager ipAddressManager = new IpAddressManager(mockSettings(true, true));
|
||||
ipAddressManager.addCache("Test", "my test IP");
|
||||
|
||||
// when
|
||||
String result = ipAddressManager.getPlayerIp(mockPlayer("test", "123.123.123.123"));
|
||||
|
||||
// then
|
||||
assertThat(result, equalTo("my test IP"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReturnPlainIp() {
|
||||
// given
|
||||
IpAddressManager ipAddressManager = new IpAddressManager(mockSettings(false, false));
|
||||
|
||||
// when
|
||||
String result = ipAddressManager.getPlayerIp(mockPlayer("bobby", "8.8.8.8"));
|
||||
|
||||
// then
|
||||
assertThat(result, equalTo("8.8.8.8"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package fr.xephi.authme.command;
|
||||
|
||||
import fr.xephi.authme.AntiBot;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.cache.IpAddressManager;
|
||||
import fr.xephi.authme.command.help.HelpProvider;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.hooks.PluginHooks;
|
||||
@ -57,8 +56,6 @@ public class CommandServiceTest {
|
||||
@Mock
|
||||
private NewSetting settings;
|
||||
@Mock
|
||||
private IpAddressManager ipAddressManager;
|
||||
@Mock
|
||||
private PluginHooks pluginHooks;
|
||||
@Mock
|
||||
private SpawnLoader spawnLoader;
|
||||
@ -70,7 +67,7 @@ public class CommandServiceTest {
|
||||
@Before
|
||||
public void setUpService() {
|
||||
commandService = new CommandService(authMe, commandMapper, helpProvider, messages, passwordSecurity,
|
||||
permissionsManager, settings, ipAddressManager, pluginHooks, spawnLoader, antiBot, validationService);
|
||||
permissionsManager, settings, pluginHooks, spawnLoader, antiBot, validationService);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -223,15 +220,6 @@ public class CommandServiceTest {
|
||||
assertThat(result, equalTo(authMe));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReturnIpAddressManager() {
|
||||
// given/when
|
||||
IpAddressManager ipManager = commandService.getIpAddressManager();
|
||||
|
||||
// then
|
||||
assertThat(ipManager, equalTo(ipAddressManager));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldValidatePassword() {
|
||||
// given
|
||||
|
@ -1,7 +1,6 @@
|
||||
package fr.xephi.authme.process;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.cache.IpAddressManager;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.hooks.PluginHooks;
|
||||
import fr.xephi.authme.output.MessageKey;
|
||||
@ -39,8 +38,6 @@ public class ProcessServiceTest {
|
||||
@Mock
|
||||
private Messages messages;
|
||||
@Mock
|
||||
private IpAddressManager ipAddressManager;
|
||||
@Mock
|
||||
private PasswordSecurity passwordSecurity;
|
||||
@Mock
|
||||
private AuthMe authMe;
|
||||
@ -53,7 +50,7 @@ public class ProcessServiceTest {
|
||||
|
||||
@Before
|
||||
public void setUpService() {
|
||||
processService = new ProcessService(settings, messages, authMe, dataSource, ipAddressManager, passwordSecurity,
|
||||
processService = new ProcessService(settings, messages, authMe, dataSource, passwordSecurity,
|
||||
pluginHooks, spawnLoader, validationService);
|
||||
}
|
||||
|
||||
@ -154,15 +151,6 @@ public class ProcessServiceTest {
|
||||
assertThat(result, equalTo(pluginHooks));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReturnIpAddressManager() {
|
||||
// given / when
|
||||
IpAddressManager result = processService.getIpAddressManager();
|
||||
|
||||
// then
|
||||
assertThat(result, equalTo(ipAddressManager));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReturnSpawnLoader() {
|
||||
// given / when
|
||||
|
Loading…
Reference in New Issue
Block a user