Class PlayerMuteStorage

java.lang.Object
me.confuser.banmanager.common.ormlite.dao.BaseDaoImpl<PlayerMuteData,Integer>
me.confuser.banmanager.common.storage.BaseStorage<PlayerMuteData,Integer>
me.confuser.banmanager.common.storage.PlayerMuteStorage
All Implemented Interfaces:
Iterable<PlayerMuteData>, me.confuser.banmanager.common.ormlite.dao.CloseableIterable<PlayerMuteData>, me.confuser.banmanager.common.ormlite.dao.Dao<PlayerMuteData,Integer>

public class PlayerMuteStorage extends BaseStorage<PlayerMuteData,Integer>
  • Constructor Details

  • Method Details

    • getMutes

    • isMuted

      public boolean isMuted(UUID uuid)
    • retrieveMute

      public PlayerMuteData retrieveMute(UUID uuid) throws SQLException
      Throws:
      SQLException
    • isMuted

      public boolean isMuted(String playerName)
    • getMute

      public PlayerMuteData getMute(UUID uuid)
    • getMute

      public PlayerMuteData getMute(String playerName)
    • addMute

      public void addMute(PlayerMuteData mute)
    • updateMuteState

      public void updateMuteState(PlayerMuteData mute)
      Updates the in-memory mute state without firing PlayerMutedEvent. Used for syncing pause/resume state changes from other servers.
      Parameters:
      mute - the mute with updated state
    • mute

      public boolean mute(PlayerMuteData mute) throws SQLException
      Throws:
      SQLException
    • mute

      public boolean mute(PlayerMuteData mute, boolean fromSync) throws SQLException
      Throws:
      SQLException
    • removeMute

      public void removeMute(UUID uuid)
    • removeMute

      public void removeMute(PlayerMuteData mute)
    • unmute

      public boolean unmute(PlayerMuteData mute, PlayerData actor) throws SQLException
      Throws:
      SQLException
    • unmute

      public boolean unmute(PlayerMuteData mute, PlayerData actor, String reason) throws SQLException
      Throws:
      SQLException
    • unmute

      public boolean unmute(PlayerMuteData mute, PlayerData actor, String reason, boolean skipRecord) throws SQLException
      Throws:
      SQLException
    • unmute

      public boolean unmute(PlayerMuteData mute, PlayerData actor, String reason, boolean skipRecord, boolean silent) throws SQLException
      Throws:
      SQLException
    • unmuteIfExpired

      public boolean unmuteIfExpired(PlayerMuteData mute, PlayerData actor) throws SQLException
      Conditionally unmutes a mute only if it has truly expired (expires > 0 AND expires invalid input: '<'= now). This prevents race conditions where a mute is paused (expires set to 0) between the ExpiresSync query and the delete operation. The delete and record creation are performed atomically in a transaction.
      Parameters:
      mute - the mute to expire
      actor - the actor performing the unmute
      Returns:
      true if the mute was deleted, false if it was already paused/modified or event was cancelled
      Throws:
      SQLException
    • findMutes

      public me.confuser.banmanager.common.ormlite.dao.CloseableIterator<PlayerMuteData> findMutes(long fromTime) throws SQLException
      Throws:
      SQLException
    • isRecentlyMuted

      public boolean isRecentlyMuted(PlayerData player, long cooldown) throws SQLException
      Throws:
      SQLException
    • pauseMute

      public boolean pauseMute(PlayerMuteData mute, long remaining) throws SQLException
      Pauses an online-only mute when the player goes offline. Uses conditional update with optimistic concurrency (updated timestamp) to prevent race conditions during fast server transfers.
      Parameters:
      mute - the mute to pause (must have current updated timestamp)
      remaining - the remaining seconds to store
      Returns:
      true if the mute was paused, false if it was already paused, modified, or conditions not met
      Throws:
      SQLException
    • resumeMute

      public boolean resumeMute(PlayerMuteData mute) throws SQLException
      Resumes an online-only mute when the player comes online. Uses conditional update with optimistic concurrency (updated timestamp) to prevent race conditions during fast server transfers. Uses database time (UNIX_TIMESTAMP()) to avoid JVM clock drift issues.
      Parameters:
      mute - the mute to resume (must have current updated timestamp)
      Returns:
      true if the mute was resumed, false if it was already active, modified, or conditions not met
      Throws:
      SQLException