Record Class PotionEffectWrapper
java.lang.Object
java.lang.Record
de.eldoria.jacksonbukkit.entities.PotionEffectWrapper
- Record Components:
amplifier
- Effect amplifierduration
- Effect durationtype
- Effect typeambient
- Indicates ambient effectparticles
- Indicates particles on effecticon
- Indicates effect with icon
public record PotionEffectWrapper(int amplifier, int duration, PotionEffectType type, boolean ambient, boolean particles, boolean icon)
extends Record
Class for wrapping a
PotionEffect
.-
Constructor Summary
ConstructorDescriptionPotionEffectWrapper
(int amplifier, int duration, PotionEffectType type, boolean ambient, boolean particles, boolean icon) Create a new base potion wrapper. -
Method Summary
Modifier and TypeMethodDescriptionboolean
ambient()
Indicates ambient effectint
Effect amplifierint
duration()
Effect durationfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
icon()
Indicates effect with iconstatic PotionEffectWrapper
of
(PotionEffect effect) Create a newPotionEffectWrapper
based on aPotionEffect
.boolean
Indicates particles on effectConstructs a newPotionEffect
based on wrapper values.final String
toString()
Returns a string representation of this record class.type()
Effect type
-
Constructor Details
-
PotionEffectWrapper
public PotionEffectWrapper(int amplifier, int duration, PotionEffectType type, boolean ambient, boolean particles, boolean icon) Create a new base potion wrapper.- Parameters:
amplifier
- the amplifier, seePotionEffect.getAmplifier()
duration
- measured in ticks, seePotionEffect.getDuration()
type
- effect type as id as defined inPotionEffectType.getId()
ambient
- the ambient status, seePotionEffect.isAmbient()
particles
- the particle status, seePotionEffect.hasParticles()
icon
- the icon status, seePotionEffect.hasIcon()
-
-
Method Details
-
amplifier
public int amplifier()Effect amplifier- Returns:
- amplifier
-
duration
public int duration()Effect duration- Returns:
- duration
-
type
Effect type- Returns:
- type
-
ambient
public boolean ambient()Indicates ambient effect- Returns:
- true when ambient
-
particles
public boolean particles()Indicates particles on effect- Returns:
- true when particles are visible
-
icon
public boolean icon()Indicates effect with icon- Returns:
- true when icon visible
-
of
Create a newPotionEffectWrapper
based on aPotionEffect
.- Parameters:
effect
- potion effect instance- Returns:
- new
PotionEffectWrapper
instance
-
toBukkitPotionEffect
Constructs a newPotionEffect
based on wrapper values.- Returns:
- new
PotionEffect
instance
-
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. -
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='.
-