com.sucy.skill.dynamic.trigger.MoveTrigger 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.player.PlayerMoveEvent;
import java.util.Map;
/**
* ProSkillAPI © 2023
* com.sucy.skill.dynamic.trigger.BlockBreakTrigger
*/
public class MoveTrigger implements Trigger {
/**
* {@inheritDoc}
*/
@Override
public String getKey() {
return "MOVE";
}
/**
* {@inheritDoc}
*/
@Override
public Class getEvent() {
return PlayerMoveEvent.class;
}
/**
* {@inheritDoc}
*/
@Override
public boolean shouldTrigger(final PlayerMoveEvent event, final int level, final Settings settings) {
return event.getFrom().getWorld() == event.getTo().getWorld();
}
/**
* {@inheritDoc}
*/
@Override
public void setValues(final PlayerMoveEvent event, final Map data) {
final double distance = event.getTo().distance(event.getFrom());
data.put("api-distance", distance);
}
/**
* {@inheritDoc}
*/
@Override
public LivingEntity getCaster(final PlayerMoveEvent event) {
return event.getPlayer();
}
/**
* {@inheritDoc}
*/
@Override
public LivingEntity getTarget(final PlayerMoveEvent event, final Settings settings) {
return event.getPlayer();
}
}