Class TriggerData

package me.leo_s.featheredelection.objects.trigger;

import lombok.Getter;
import lombok.Setter;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.inventory.ItemStack;

@Getter
@Setter
public class TriggerData {
    private Player player;
    private Entity entity;
    private Block block;
    private ItemStack[] items;
    private Event event;
    private double[] doubles;
    private float[] floats;
    private int[] ints;

    public TriggerData player(Player player){
        this.player = player;
        return this;
    }

    public TriggerData entity(Entity entity) {
        this.entity = entity;
        return this;
    }

    public TriggerData items(ItemStack... items) {
        this.items = items;
        return this;
    }

    public TriggerData doubles(double... doubles) {
        this.doubles = doubles;
        return this;
    }

    public TriggerData floats(float... floats) {
        this.floats = floats;
        return this;
    }

    public TriggerData ints(int... ints) {
        this.ints = ints;
        return this;
    }

    public TriggerData block(Block block) {
        this.block = block;
        return this;
    }

    public TriggerData event(Event event){
        this.event = event;
        return this;
    }
}

TriggerData Class Description

The TriggerData class is a fundamental part of the API, designed to manage data related to events and triggers in the game. This class allows you to encapsulate and transport relevant information about specific events that may occur during the execution of the plugin. Below is a detailed explanation of the key elements of this class:

Properties

  • player:Stores the instance of the player associated with the event. May be null if the event is not related to a player.

  • entity: Stores the entity instance (Entity) associated with the event. It can represent various entities present in the game, such as mobs or players.

  • block: Stores the block instance (Block) associated with the event. This is useful for events that involve interactions with blocks in the game world.

  • items: Stores an ItemStack array, allowing you to handle multiple items associated with the event.

  • doubles: Stores an array of values of type double. It can be used to transport decimal numeric data related to the event.

  • floats: Stores an array of values of type float. Similar to doubles, but with lower decimal precision.

  • ints: Stores an array of values of type int. Used for integer numeric data associated with the event.

  • event: Stores the event instance (Event) itself. This property allows you to access specific details of the event that triggered the action.

Last updated