Record Class MuteEntry
java.lang.Object
java.lang.Record
me.github.simonplays15.betterbansystem.core.mute.MuteEntry
- All Implemented Interfaces:
IMuteEntry
public record MuteEntry(UUID uuid, String name, String source, Date created, Object expires, String reason)
extends Record
implements IMuteEntry
Represents a mute entry for a player.
Implements the IMuteEntry interface.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe IMuteEntryAdapter class is a Gson TypeAdapter for serializing and deserializing IMuteEntry objects. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreated()Returns the value of thecreatedrecord component.final booleanIndicates whether some other object is "equal to" this one.expires()Returns the value of theexpiresrecord component.static IMuteEntryFinds an entry in the list of mute entries with the specified target UUID.static @NotNull List<IMuteEntry>Retrieves a list of all mute entries.final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.reason()Returns the value of thereasonrecord component.static voidremoveEntry(@NotNull IMuteEntry entry) Removes an entry from the system.static voidremoveFromJson(UUID targetUUID) Removes a mute entry with the given UUID from a JSON file or database.static voidsaveToJson(IMuteEntry entry) Saves an IMuteEntry object to JSON.source()Returns the value of thesourcerecord component.toString()Returns a string representation of the mute entry.uuid()Returns the value of theuuidrecord component.
-
Constructor Details
-
Method Details
-
saveToJson
Saves an IMuteEntry object to JSON.- Parameters:
entry- The IMuteEntry object to save.
-
removeEntry
Removes an entry from the system.- Parameters:
entry- The entry to be removed.- Throws:
NullPointerException- if the entry is null.
-
removeFromJson
Removes a mute entry with the given UUID from a JSON file or database.- Parameters:
targetUUID- The UUID of the mute entry to be removed.
-
getAllEntries
Retrieves a list of all mute entries.- Returns:
- A list of all mute entries, represented as
IMuteEntry. If no entries are found, an empty list is returned. - Throws:
IOException- if there is an error reading the mute entries from the file
-
findEntry
Finds an entry in the list of mute entries with the specified target UUID.- Parameters:
targetUUID- The UUID of the target entry.- Returns:
- The first mute entry with the specified UUID, or null if no such entry is found.
-
toString
Returns a string representation of the mute entry. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
uuid
Returns the value of theuuidrecord component.- Specified by:
uuidin interfaceIMuteEntry- Returns:
- the value of the
uuidrecord component
-
name
Returns the value of thenamerecord component.- Specified by:
namein interfaceIMuteEntry- Returns:
- the value of the
namerecord component
-
source
Returns the value of thesourcerecord component.- Specified by:
sourcein interfaceIMuteEntry- Returns:
- the value of the
sourcerecord component
-
created
Returns the value of thecreatedrecord component.- Specified by:
createdin interfaceIMuteEntry- Returns:
- the value of the
createdrecord component
-
expires
Returns the value of theexpiresrecord component.- Specified by:
expiresin interfaceIMuteEntry- Returns:
- the value of the
expiresrecord component
-
reason
Returns the value of thereasonrecord component.- Specified by:
reasonin interfaceIMuteEntry- Returns:
- the value of the
reasonrecord component
-