com.sucy.skill.dynamic.trigger.HealTrigger Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of proskillapi Show documentation
Show all versions of proskillapi Show documentation
A Minecraft Bukkit plugin aiming to provide an easy code API and skill editor for all server owners to
create unique and fully custom classes and skills.
package com.sucy.skill.dynamic.trigger;
import com.sucy.skill.api.Settings;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import java.util.Map;
public class HealTrigger implements Trigger {
/**
* {@inheritDoc}
*/
@Override
public String getKey() {
return "HEAL";
}
/**
* {@inheritDoc}
*/
@Override
public Class getEvent() {return EntityRegainHealthEvent.class;}
/**
* {@inheritDoc}
*/
@Override
public boolean shouldTrigger(EntityRegainHealthEvent event, int level, Settings settings) {
final double min = settings.getDouble("heal-min");
final double max = settings.getDouble("heal-max");
return event.getAmount() >= min && event.getAmount() <= max;
}
/**
* {@inheritDoc}
*/
@Override
public void setValues(EntityRegainHealthEvent event, Map data) {
data.put("api-heal", event.getAmount());
}
/**
* {@inheritDoc}
*/
@Override
public LivingEntity getCaster(EntityRegainHealthEvent event) {
return (LivingEntity) event.getEntity();
}
/**
* {@inheritDoc}
*/
@Override
public LivingEntity getTarget(EntityRegainHealthEvent event, Settings settings) {
return (LivingEntity) event.getEntity();
}
}