Class ZoneEffect
java.lang.Object
fr.multimc.api.spigot.common.worlds.locations.zones.effects.ZoneEffect
- All Implemented Interfaces:
ZoneListener
This class represents a zone effect that applies a set of effects to players or entities when they enter or exit a specified zone.
-
Constructor Summary
ConstructorsConstructorDescriptionZoneEffect(@NotNull Zone zone, IZoneEffect... zoneEffects) Create new ZoneEffect with a given zone, andIZoneEffectarrayZoneEffect(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull org.bukkit.Location center, @NotNull RelativeLocation location1, @NotNull RelativeLocation location2, IZoneEffect... zoneEffects) Constructs a new zone effect with a circular zone.ZoneEffect(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull org.bukkit.Location location1, @NotNull org.bukkit.Location location2, IZoneEffect... zoneEffects) Constructs a new zone effect with a rectangular zone. -
Method Summary
Modifier and TypeMethodDescriptionvoidonEntityEnter(io.papermc.paper.event.entity.EntityMoveEvent e) Applies the effects to the entity when they enter the zone.voidonEntityExit(io.papermc.paper.event.entity.EntityMoveEvent e) Removes the effects from the entity when they exit the zone.voidonPlayerEnter(org.bukkit.event.player.PlayerMoveEvent e) Applies the effects to the player when they enter the zone.voidonPlayerExit(org.bukkit.event.player.PlayerMoveEvent e) Removes the effects from the player when they exit the zone.voidupdate()Re-apply the zone effects to all entities (player includes) in the zone.voidupdateSync(org.bukkit.plugin.Plugin plugin) Synchronously re-apply the zone effects to all entities (player includes) in the zone.
-
Constructor Details
-
ZoneEffect
public ZoneEffect(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull org.bukkit.Location location1, @NotNull @NotNull org.bukkit.Location location2, IZoneEffect... zoneEffects) Constructs a new zone effect with a rectangular zone.- Parameters:
plugin-Plugincreating the zone effectlocation1-Locationthat represents the first corner of the rectanglelocation2-Locationthat represents the second corner of the rectanglezoneEffects-IZoneEffectto apply when players or entities enter or exit the zone
-
ZoneEffect
public ZoneEffect(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull org.bukkit.Location center, @NotNull @NotNull RelativeLocation location1, @NotNull @NotNull RelativeLocation location2, IZoneEffect... zoneEffects) Constructs a new zone effect with a circular zone.- Parameters:
plugin-Plugincreating the zone effectcenter-Locationthat represents the center of the circlelocation1-RelativeLocationlocation of the first radius pointlocation2-RelativeLocationthe relative location of the second radius pointzoneEffects-IZoneEffectto apply when players or entities enter or exit the zone
-
ZoneEffect
Create new ZoneEffect with a given zone, andIZoneEffectarray- Parameters:
zone- : givenZoneto be used as the zonezoneEffects-IZoneEffectto apply when players or entities enter or exit the zone
-
-
Method Details
-
update
public void update()Re-apply the zone effects to all entities (player includes) in the zone. Must be run synchronously. -
updateSync
public void updateSync(org.bukkit.plugin.Plugin plugin) Synchronously re-apply the zone effects to all entities (player includes) in the zone. -
onPlayerEnter
public void onPlayerEnter(org.bukkit.event.player.PlayerMoveEvent e) Applies the effects to the player when they enter the zone.- Specified by:
onPlayerEnterin interfaceZoneListener- Parameters:
e-PlayerMoveEventthat triggered the callback
-
onEntityEnter
public void onEntityEnter(io.papermc.paper.event.entity.EntityMoveEvent e) Applies the effects to the entity when they enter the zone.- Specified by:
onEntityEnterin interfaceZoneListener- Parameters:
e-EntityMoveEventthat triggered the callback
-
onPlayerExit
public void onPlayerExit(org.bukkit.event.player.PlayerMoveEvent e) Removes the effects from the player when they exit the zone.- Specified by:
onPlayerExitin interfaceZoneListener- Parameters:
e-PlayerMoveEventthat triggered the callback
-
onEntityExit
public void onEntityExit(io.papermc.paper.event.entity.EntityMoveEvent e) Removes the effects from the entity when they exit the zone.- Specified by:
onEntityExitin interfaceZoneListener- Parameters:
e-EntityMoveEventthat triggered the callback
-