Move IP on join from prelogin event to join event

This commit is contained in:
Business Goose 2022-03-29 23:06:33 +01:00
parent be57759e6c
commit c2e4d2939d
No known key found for this signature in database
GPG Key ID: 77DCA801362E9645
2 changed files with 12 additions and 12 deletions

View File

@ -82,18 +82,6 @@ public class Server
{
final String ip = event.getAddress().getHostAddress().trim();
final boolean isAdmin = AdminList.isSuperAdminSafe(null, ip);
TextComponent textComponent = new TextComponent(String.format("%s is attempting to join with IP %s.", event.getName(), Utilities.getFuzzyIp(ip)));
textComponent.setColor(ChatColor.GRAY.asBungee());
for (org.bukkit.entity.Player player : Bukkit.getOnlinePlayers())
{
if (AdminList.isSuperAdmin(player))
{
player.spigot().sendMessage(textComponent);
}
}
DiscordBridge.transmitAdminMessage(textComponent.getText());
// Check if the player is already online
for (Player onlinePlayer : TotalFreedomMod.server.getOnlinePlayers())

View File

@ -774,6 +774,18 @@ public class PlayerListener implements Listener {
final String ip = Utilities.getIp(player);
final Player playerEntry;
Log.info("[JOIN] " + Utilities.formatPlayer(player) + " joined the game with IP address: " + ip, true);
TextComponent textComponent = new TextComponent(String.format("%s is joining with IP %s.", player.getName(), Utilities.getFuzzyIp(ip)));
textComponent.setColor(ChatColor.GRAY.asBungee());
for (org.bukkit.entity.Player onlinePlayer : Bukkit.getOnlinePlayers())
{
if (AdminList.isSuperAdmin(player))
{
onlinePlayer.spigot().sendMessage(textComponent);
}
}
DiscordBridge.transmitAdminMessage(textComponent.getText());
// Check absolute value to account for negatives
if (Math.abs(player.getLocation().getX()) >= MAX_XY_COORD || Math.abs(player.getLocation().getZ()) >= MAX_XY_COORD)