From 61c73ee83e4462133089f80436bf8eba67e4762f Mon Sep 17 00:00:00 2001 From: Yannick Lamprecht Date: Sat, 10 Feb 2024 20:50:01 +0100 Subject: [PATCH] improve BanList types --- .../java/org/bukkit/craftbukkit/CraftServer.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java index b4a823a62d..0d62694e2f 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2272,6 +2272,21 @@ public final class CraftServer implements Server { }; } + // Paper start - add BanListType (which has a generic) + @SuppressWarnings("unchecked") + @Override + public , E> B getBanList(final io.papermc.paper.ban.BanListType type) { + Preconditions.checkArgument(type != null, "BanList.BanType cannot be null"); + if (type == io.papermc.paper.ban.BanListType.IP) { + return (B) new CraftIpBanList(this.playerList.getIpBans()); + } else if (type == io.papermc.paper.ban.BanListType.PROFILE) { + return (B) new CraftProfileBanList(this.playerList.getBans()); + } else { + throw new IllegalArgumentException("Unknown BanListType: " + type); + } + } + // Paper end - add BanListType (which has a generic) + @Override public void setWhitelist(boolean value) { this.playerList.setUsingWhiteList(value);