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 class
The IMuteEntryAdapter class is a Gson TypeAdapter for serializing and deserializing IMuteEntry objects. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreated()
Returns the value of thecreated
record component.final boolean
Indicates whether some other object is "equal to" this one.expires()
Returns the value of theexpires
record component.static IMuteEntry
Finds 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 int
hashCode()
Returns a hash code value for this object.name()
Returns the value of thename
record component.reason()
Returns the value of thereason
record component.static void
removeEntry
(@NotNull IMuteEntry entry) Removes an entry from the system.static void
removeFromJson
(UUID targetUUID) Removes a mute entry with the given UUID from a JSON file or database.static void
saveToJson
(IMuteEntry entry) Saves an IMuteEntry object to JSON.source()
Returns the value of thesource
record component.toString()
Returns a string representation of the mute entry.uuid()
Returns the value of theuuid
record 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 theuuid
record component.- Specified by:
uuid
in interfaceIMuteEntry
- Returns:
- the value of the
uuid
record component
-
name
Returns the value of thename
record component.- Specified by:
name
in interfaceIMuteEntry
- Returns:
- the value of the
name
record component
-
source
Returns the value of thesource
record component.- Specified by:
source
in interfaceIMuteEntry
- Returns:
- the value of the
source
record component
-
created
Returns the value of thecreated
record component.- Specified by:
created
in interfaceIMuteEntry
- Returns:
- the value of the
created
record component
-
expires
Returns the value of theexpires
record component.- Specified by:
expires
in interfaceIMuteEntry
- Returns:
- the value of the
expires
record component
-
reason
Returns the value of thereason
record component.- Specified by:
reason
in interfaceIMuteEntry
- Returns:
- the value of the
reason
record component
-