A better way to display the current IP (#186)

a better dev did this
This commit is contained in:
Nathan Curran 2020-02-06 13:11:07 +11:00 committed by GitHub
parent 046bebe54c
commit 682145eb13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View File

@ -45,7 +45,6 @@ public class Ban implements ConfigLoadable, ConfigSavable, Validatable
@Getter
@Setter
private long expiryUnix = -1;
private Player player;
public Ban()
{
@ -172,7 +171,7 @@ public class Ban implements ConfigLoadable, ConfigSavable, Validatable
return hasExpiry() && expiryUnix < FUtil.getUnixTime();
}
public String bakeKickMessage()
public String bakeKickMessage(String ip)
{
final StringBuilder message = new StringBuilder(ChatColor.GOLD + "You");
@ -205,7 +204,7 @@ public class Ban implements ConfigLoadable, ConfigSavable, Validatable
}
message.append("\n").append(ChatColor.RED).append("IP Address: ").append(ChatColor.GOLD)
.append(FUtil.getFuzzyIp(Ips.getIp(player)));
.append(ip);
return message.toString();
}

View File

@ -246,7 +246,7 @@ public class BanManager extends FreedomService
if (ban != null && !ban.isExpired())
{
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, ban.bakeKickMessage());
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, ban.bakeKickMessage(ip));
}
}

View File

@ -8,11 +8,12 @@ import me.totalfreedom.totalfreedommod.punishments.Punishment;
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.util.Ips;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.ChatColor;
import static me.totalfreedom.totalfreedommod.util.FUtil.playerMsg;
@ -103,7 +104,7 @@ public class Command_glist extends FreedomCommand
if (player != null)
{
player.kickPlayer(playerBan.bakeKickMessage());
player.kickPlayer(playerBan.bakeKickMessage(Ips.getIp(player)));
}
plugin.pul.logPunishment(new Punishment(username, ips.get(0), sender.getName(), PunishmentType.BAN, null));
@ -148,7 +149,7 @@ public class Command_glist extends FreedomCommand
if (player != null)
{
player.kickPlayer(nameBan.bakeKickMessage());
player.kickPlayer(nameBan.bakeKickMessage(Ips.getIp(player)));
}
return true;

View File

@ -183,7 +183,7 @@ public class Command_gtfo extends FreedomCommand
// Kick player and handle others on IP
if (player != null)
{
player.kickPlayer(ban.bakeKickMessage());
player.kickPlayer(ban.bakeKickMessage(Ips.getIp(player)));
for (Player p : Bukkit.getOnlinePlayers())
{
if (Ips.getIp(p).equals(Ips.getIp(player)))