diff --git a/common/src/main/java/me/confuser/banmanager/common/listeners/CommonJoinListener.java b/common/src/main/java/me/confuser/banmanager/common/listeners/CommonJoinListener.java index dc561d18..5407a59b 100755 --- a/common/src/main/java/me/confuser/banmanager/common/listeners/CommonJoinListener.java +++ b/common/src/main/java/me/confuser/banmanager/common/listeners/CommonJoinListener.java @@ -13,6 +13,7 @@ import java.io.IOException; import java.sql.SQLException; +import java.sql.SQLIntegrityConstraintViolationException; import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -541,7 +542,12 @@ private void punishAlts(List duplicates, UUID uuid) throws SQLExcept ban.isSilent(), ban.getExpires()); - plugin.getPlayerBanStorage().ban(newBan); + try { + plugin.getPlayerBanStorage().ban(newBan); + } catch (SQLIntegrityConstraintViolationException e) { + // Ignore duplicate entry errors + plugin.getPlayerBanStorage().addBan(newBan); + } plugin.getScheduler().runSync(() -> { CommonPlayer bukkitPlayer = plugin.getServer().getPlayer(newBan.getPlayer().getUUID()); @@ -575,7 +581,12 @@ private void punishAlts(List duplicates, UUID uuid) throws SQLExcept mute.isSoft(), mute.getExpires()); - plugin.getPlayerMuteStorage().mute(newMute); + try { + plugin.getPlayerMuteStorage().mute(newMute); + } catch (SQLIntegrityConstraintViolationException e) { + // Ignore duplicate entry errors + plugin.getPlayerMuteStorage().addMute(newMute); + } } } }