Creating Effects
How to create your own effects using the API
Create your own effect class
public class Example extends CustomEffect {
public Example(Plugin plugin) {
super(plugin, "EXAMPLE", "This is an example effect", "EXAMPLE:[VALUE]");
}
@Override
public void run(LivingEntity player, @Nullable LivingEntity target, String[] arguments, Event event) {
player.sendMessage("HELLO");
}
}public class Example extends CustomEffect {
public Example(Plugin plugin) {
super(plugin, "EXAMPLE", "This is an example effect", "EXAMPLE:[VALUE]");
}
@Override
public void run(LivingEntity player, @Nullable LivingEntity target, String[] arguments, Event event) {
if (!(event instanceof BlockBreakEvent)) return;
BlockBreakEvent breakEvent = (BlockBreakEvent) event;
Player breaker = breakEvent.getPlayer();
if (breaker.getUniqueId() != player.getUniqueId()) return;
breakEvent.setCancelled(true);
breaker.sendMessage("BROKEN");
}
}Registering effect
Last updated