Record Class BukkitEventApplication
java.lang.Object
java.lang.Record
kr.toxicity.model.api.bukkit.event.BukkitEventApplication
- Record Components:
name- the name of the pluginpluginRef- a weak reference to the plugin instance
- All Implemented Interfaces:
kr.toxicity.model.api.event.ModelEventApplication
public record BukkitEventApplication(@NotNull String name, @NotNull WeakReference<org.bukkit.plugin.Plugin> pluginRef)
extends Record
implements kr.toxicity.model.api.event.ModelEventApplication
An implementation of
ModelEventApplication for Bukkit plugins.
This record holds a weak reference to a Bukkit plugin to prevent memory leaks and checks if the plugin is enabled.
- Since:
- 2.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionBukkitEventApplication(@NotNull String name, @NotNull WeakReference<org.bukkit.plugin.Plugin> pluginRef) Creates an instance of aBukkitEventApplicationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether some other object is "equal to" this one.inthashCode()Returns a hash code value for this object.boolean@NotNull Stringname()Returns the value of thenamerecord component.static @NotNull BukkitEventApplicationof(@NotNull org.bukkit.plugin.Plugin plugin) Creates a new BukkitEventApplication for the given plugin.@NotNull WeakReference<org.bukkit.plugin.Plugin> Returns the value of thepluginRefrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
BukkitEventApplication
public BukkitEventApplication(@NotNull @NotNull String name, @NotNull @NotNull WeakReference<org.bukkit.plugin.Plugin> pluginRef) Creates an instance of aBukkitEventApplicationrecord class.
-
-
Method Details
-
of
@NotNull public static @NotNull BukkitEventApplication of(@NotNull @NotNull org.bukkit.plugin.Plugin plugin) Creates a new BukkitEventApplication for the given plugin.- Parameters:
plugin- the Bukkit plugin- Returns:
- the event application wrapper
- Since:
- 2.0.0
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfacekr.toxicity.model.api.event.ModelEventApplication
-
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). -
hashCode
public int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
pluginRef
Returns the value of thepluginRefrecord component.- Returns:
- the value of the
pluginRefrecord component
-