Update from Git Manager GUI
This commit is contained in:
32
src/main/java/de/nexuslobby/modules/gadgets/ShieldTask.java
Normal file
32
src/main/java/de/nexuslobby/modules/gadgets/ShieldTask.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package de.nexuslobby.modules.gadgets;
|
||||
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class ShieldTask {
|
||||
|
||||
public static void handleShield(Player owner) {
|
||||
// Erzeuge einen Partikel-Ring um den Spieler
|
||||
for (double i = 0; i < Math.PI * 2; i += Math.PI / 8) {
|
||||
double x = Math.cos(i) * 2.2;
|
||||
double z = Math.sin(i) * 2.2;
|
||||
owner.getWorld().spawnParticle(Particle.WITCH, owner.getLocation().add(x, 0.5, z), 1, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
// Stoße andere Spieler weg
|
||||
for (Entity entity : owner.getNearbyEntities(2.2, 2.0, 2.2)) {
|
||||
if (entity instanceof Player && entity != owner) {
|
||||
Player target = (Player) entity;
|
||||
|
||||
Vector direction = target.getLocation().toVector().subtract(owner.getLocation().toVector()).normalize();
|
||||
direction.multiply(0.4).setY(0.2);
|
||||
|
||||
target.setVelocity(direction);
|
||||
target.playSound(target.getLocation(), Sound.ENTITY_CHICKEN_EGG, 0.5f, 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user