#1227: Refinements to new ban API for improved compatibility and correctness

By: Doc <nachito94@msn.com>
This commit is contained in:
CraftBukkit/Spigot
2023-07-04 06:50:47 +10:00
parent 7f5ff95fe4
commit 3c49f90bdc
5 changed files with 46 additions and 21 deletions

View File

@@ -11,6 +11,7 @@ import it.unimi.dsi.fastutil.shorts.ShortSet;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.ArrayList;
@@ -1208,9 +1209,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
@Override
public BanEntry<InetSocketAddress> banIp(String reason, Date expires, String source, boolean kickPlayer) {
public BanEntry<InetAddress> banIp(String reason, Date expires, String source, boolean kickPlayer) {
Preconditions.checkArgument(getAddress() != null, "The Address of this Player is null");
BanEntry<InetSocketAddress> banEntry = ((IpBanList) server.getBanList(BanList.Type.IP)).addBan(getAddress(), reason, expires, source);
BanEntry<InetAddress> banEntry = ((IpBanList) server.getBanList(BanList.Type.IP)).addBan(getAddress().getAddress(), reason, expires, source);
if (kickPlayer) {
this.kickPlayer(reason);
}