fix: prevent player from beeing banned multiple times

This commit is contained in:
Simon Giesel 2020-05-09 15:51:37 +02:00
parent 37e2e9d8e7
commit 143476ec9f

View file

@ -26,9 +26,12 @@ public class BanUtils {
public void addBann(final UUID uuid) { public void addBann(final UUID uuid) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final ArrayList<String> bans = (ArrayList<String>) this.plugin.getConfig().get("Varo.Bans"); final ArrayList<String> bans = (ArrayList<String>) this.plugin.getConfig().get("Varo.Bans");
bans.add(uuid.toString().replace("-", "")); final String compressedUUID = uuid.toString().replace("-", "");
this.plugin.getConfig().set("Varo.Bans", bans); if (!bans.contains(compressedUUID)) {
this.plugin.saveConfig(); bans.add(compressedUUID);
this.plugin.getConfig().set("Varo.Bans", bans);
this.plugin.saveConfig();
}
} }
public void removeBan(final String compressedUuid) { public void removeBan(final String compressedUuid) {