Added warp effect
This commit is contained in:
@@ -6,6 +6,7 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.willfp.ecoweapons.effects.effects.EffectArrowStorm;
|
||||
import com.willfp.ecoweapons.effects.effects.EffectRailgun;
|
||||
import com.willfp.ecoweapons.effects.effects.EffectStrikeLightning;
|
||||
import com.willfp.ecoweapons.effects.effects.EffectWarp;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -23,6 +24,7 @@ public class Effects {
|
||||
public static final Effect STRIKE_LIGHTNING = new EffectStrikeLightning();
|
||||
public static final Effect RAILGUN = new EffectRailgun();
|
||||
public static final Effect ARROW_STORM = new EffectArrowStorm();
|
||||
public static final Effect WARP = new EffectWarp();
|
||||
|
||||
/**
|
||||
* Get effect matching name.
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.willfp.ecoweapons.effects.effects;
|
||||
|
||||
import com.willfp.eco.core.config.interfaces.JSONConfig;
|
||||
import com.willfp.ecoweapons.effects.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.util.RayTraceResult;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class EffectWarp extends Effect {
|
||||
public EffectWarp() {
|
||||
super("warp");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMeleeAttack(@NotNull final Player player,
|
||||
@NotNull final LivingEntity victim,
|
||||
@NotNull final EntityDamageByEntityEvent event,
|
||||
@NotNull final JSONConfig args) {
|
||||
handle(player, victim.getLocation(), args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleProjectileHitEntity(@NotNull final Player player,
|
||||
@NotNull final LivingEntity victim,
|
||||
@NotNull final Projectile projectile,
|
||||
@NotNull final ProjectileHitEvent event,
|
||||
@NotNull final JSONConfig args) {
|
||||
handle(player, victim.getLocation(), args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleProjectileHit(@NotNull final Player player,
|
||||
@NotNull final Projectile projectile,
|
||||
@NotNull final ProjectileHitEvent event,
|
||||
@NotNull final JSONConfig args) {
|
||||
handle(player, projectile.getLocation(), args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleAltClick(@NotNull final Player player,
|
||||
@NotNull final RayTraceResult blockRay,
|
||||
@NotNull final RayTraceResult entityRay,
|
||||
@NotNull final PlayerInteractEvent event,
|
||||
@NotNull final JSONConfig args) {
|
||||
handle(player, blockRay.getHitPosition().toLocation(player.getWorld()), args);
|
||||
}
|
||||
|
||||
private void handle(@NotNull final Player player,
|
||||
@NotNull final Location location,
|
||||
@NotNull final JSONConfig args) {
|
||||
player.teleport(location);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user