#432 #547 Remove public IP cache map; make processes use ProcessService

- Create IP address manager for handling and caching IP addresses -> outside of the manager I do not want to care about caching details
- Make more processes use the ProcessService in favor of statically injected objects
This commit is contained in:
ljacqu
2016-03-01 22:41:32 +01:00
parent 86042070e9
commit aeb8307a46
20 changed files with 330 additions and 296 deletions
@@ -1,21 +1,18 @@
package fr.xephi.authme.command.executable.authme;
import java.util.List;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.properties.HooksSettings;
import fr.xephi.authme.util.Utils;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.util.Utils;
import java.util.List;
public class GetIpCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
final AuthMe plugin = AuthMe.getInstance();
// Get the player query
String playerName = (arguments.size() >= 1) ? arguments.get(0) : sender.getName();
@@ -25,9 +22,12 @@ public class GetIpCommand implements ExecutableCommand {
return;
}
// TODO ljacqu 20151212: Revise the messages (actual IP vs. real IP...?)
sender.sendMessage(player.getName() + "'s actual IP is : " + player.getAddress().getAddress().getHostAddress()
sender.sendMessage(player.getName() + "'s IP is: " + player.getAddress().getAddress().getHostAddress()
+ ":" + player.getAddress().getPort());
sender.sendMessage(player.getName() + "'s real IP is : " + plugin.getIP(player));
if (commandService.getProperty(HooksSettings.ENABLE_VERYGAMES_IP_CHECK)) {
sender.sendMessage(player.getName() + "'s real IP is: "
+ commandService.getIpAddressManager().getPlayerIp(player));
}
}
}