com.sucy.skill.dynamic.trigger.ItemSwapTrigger 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.PlayerSwapHandItemsEvent;
import java.util.Map;
public class ItemSwapTrigger implements Trigger {
/**
* {@inheritDoc}
*/
@Override
public String getKey() {
return "ITEM_SWAP";
}
/**
* {@inheritDoc}
*/
@Override
public Class getEvent() {
return PlayerSwapHandItemsEvent.class;
}
/**
* {@inheritDoc}
*/
@Override
public boolean shouldTrigger(final PlayerSwapHandItemsEvent event, int level, Settings settings) {
boolean cancelEvent = settings.getBool("cancel");
if (cancelEvent) {
event.setCancelled(true);
}
return true;
}
/**
* {@inheritDoc}
*/
@Override
public void setValues(final PlayerSwapHandItemsEvent event, final Map data) {}
/**
* {@inheritDoc}
*/
@Override
public LivingEntity getCaster(final PlayerSwapHandItemsEvent event) {
return event.getPlayer();
}
/**
* {@inheritDoc}
*/
@Override
public LivingEntity getTarget(PlayerSwapHandItemsEvent event, Settings settings) {
return event.getPlayer();
}
}