From 143476ec9f66a9f92fd81829cc99263ba6e5ad28 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 9 May 2020 15:51:37 +0200 Subject: [PATCH] fix: prevent player from beeing banned multiple times --- .../src/main/java/de/cliffbreak/varo/uitls/BanUtils.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/varo/src/main/java/de/cliffbreak/varo/uitls/BanUtils.java b/varo/src/main/java/de/cliffbreak/varo/uitls/BanUtils.java index b301302..efd1506 100644 --- a/varo/src/main/java/de/cliffbreak/varo/uitls/BanUtils.java +++ b/varo/src/main/java/de/cliffbreak/varo/uitls/BanUtils.java @@ -26,9 +26,12 @@ public class BanUtils { public void addBann(final UUID uuid) { @SuppressWarnings("unchecked") final ArrayList bans = (ArrayList) this.plugin.getConfig().get("Varo.Bans"); - bans.add(uuid.toString().replace("-", "")); - this.plugin.getConfig().set("Varo.Bans", bans); - this.plugin.saveConfig(); + final String compressedUUID = uuid.toString().replace("-", ""); + if (!bans.contains(compressedUUID)) { + bans.add(compressedUUID); + this.plugin.getConfig().set("Varo.Bans", bans); + this.plugin.saveConfig(); + } } public void removeBan(final String compressedUuid) {