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>
-
Nested Class Summary
Nested classes/interfaces inherited from interface me.confuser.banmanager.common.ormlite.dao.Dao
me.confuser.banmanager.common.ormlite.dao.Dao.CreateOrUpdateStatus, me.confuser.banmanager.common.ormlite.dao.Dao.DaoObserver -
Field Summary
Fields inherited from class me.confuser.banmanager.common.storage.BaseStorage
pluginFields inherited from class me.confuser.banmanager.common.ormlite.dao.BaseDaoImpl
connectionSource, databaseType, dataClass, lastIterator, objectFactory, statementExecutor, tableConfig, tableInfo -
Constructor Summary
ConstructorsConstructorDescriptionPlayerMuteStorage(BanManagerPlugin plugin) PlayerMuteStorage(BanManagerPlugin plugin, me.confuser.banmanager.common.ormlite.support.ConnectionSource connection, me.confuser.banmanager.common.ormlite.table.DatabaseTableConfig<?> table) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMute(PlayerMuteData mute) me.confuser.banmanager.common.ormlite.dao.CloseableIterator<PlayerMuteData> findMutes(long fromTime) getMutes()booleanbooleanbooleanisRecentlyMuted(PlayerData player, long cooldown) booleanmute(PlayerMuteData mute) booleanmute(PlayerMuteData mute, boolean fromSync) booleanpauseMute(PlayerMuteData mute, long remaining) Pauses an online-only mute when the player goes offline.voidremoveMute(UUID uuid) voidremoveMute(PlayerMuteData mute) booleanresumeMute(PlayerMuteData mute) Resumes an online-only mute when the player comes online.retrieveMute(UUID uuid) booleanunmute(PlayerMuteData mute, PlayerData actor) booleanunmute(PlayerMuteData mute, PlayerData actor, String reason) booleanunmute(PlayerMuteData mute, PlayerData actor, String reason, boolean skipRecord) booleanunmute(PlayerMuteData mute, PlayerData actor, String reason, boolean skipRecord, boolean silent) booleanunmuteIfExpired(PlayerMuteData mute, PlayerData actor) Conditionally unmutes a mute only if it has truly expired (expires > 0 AND expires invalid input: '<'= now).voidUpdates the in-memory mute state without firing PlayerMutedEvent.Methods inherited from class me.confuser.banmanager.common.storage.BaseStorage
create, createPreservingTimestamps, getBmTableName, getDatabaseConfig, hasUpdatedColumn, update, updatePreservingTimestampsMethods inherited from class me.confuser.banmanager.common.ormlite.dao.BaseDaoImpl
assignEmptyForeignCollection, callBatchTasks, checkForInitialized, clearAllInternalObjectCaches, clearObjectCache, closeableIterator, closeLastIterator, commit, countOf, countOf, create, createIfNotExists, createOrUpdate, delete, delete, delete, deleteBuilder, deleteById, deleteIds, endThreadConnection, executeRaw, executeRawNoArgs, extractId, findForeignFieldType, getConnectionSource, getDataClass, getEmptyForeignCollection, getObjectCache, getObjectFactory, getRawRowMapper, getSelectStarRowMapper, getTableConfig, getTableInfo, getTableName, getWrappedIterable, getWrappedIterable, idExists, initialize, isAutoCommit, isTableExists, isUpdatable, iterator, iterator, iterator, iterator, mapSelectStarRow, notifyChanges, objectsEqual, objectToString, query, queryBuilder, queryForAll, queryForEq, queryForFieldValues, queryForFieldValuesArgs, queryForFirst, queryForId, queryForMatching, queryForMatchingArgs, queryForSameId, queryRaw, queryRaw, queryRaw, queryRaw, queryRaw, queryRawValue, refresh, registerObserver, rollBack, setAutoCommit, setConnectionSource, setObjectCache, setObjectCache, setObjectFactory, setTableConfig, startThreadConnection, unregisterObserver, update, updateBuilder, updateId, updateRawMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
PlayerMuteStorage
- Throws:
SQLException
-
PlayerMuteStorage
public PlayerMuteStorage(BanManagerPlugin plugin, me.confuser.banmanager.common.ormlite.support.ConnectionSource connection, me.confuser.banmanager.common.ormlite.table.DatabaseTableConfig<?> table) throws SQLException - Throws:
SQLException
-
-
Method Details
-
getMutes
-
isMuted
-
retrieveMute
- Throws:
SQLException
-
isMuted
-
getMute
-
getMute
-
addMute
-
updateMuteState
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
- Throws:
SQLException
-
mute
- Throws:
SQLException
-
removeMute
-
removeMute
-
unmute
- Throws:
SQLException
-
unmute
- 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
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 expireactor- 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
- Throws:
SQLException
-
pauseMute
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
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
-