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,10 +26,13 @@ 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("-", "");
if (!bans.contains(compressedUUID)) {
bans.add(compressedUUID);
this.plugin.getConfig().set("Varo.Bans", bans); this.plugin.getConfig().set("Varo.Bans", bans);
this.plugin.saveConfig(); this.plugin.saveConfig();
} }
}
public void removeBan(final String compressedUuid) { public void removeBan(final String compressedUuid) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")