64 lines
1.9 KiB
Java
64 lines
1.9 KiB
Java
/*
|
|
* Copyright (c) 2017 univento.eu - All rights reserved
|
|
* You are not allowed to use, distribute or modify this code
|
|
*/
|
|
|
|
package eu.univento.core.customitems.weapons.closecombat;
|
|
|
|
import eu.univento.core.api.customitems.swords.CustomSword;
|
|
import eu.univento.core.api.customitems.swords.CustomSwordManager;
|
|
import eu.univento.core.api.items.ItemBuilder;
|
|
import eu.univento.core.api.player.CustomPlayer;
|
|
import org.bukkit.Material;
|
|
import org.bukkit.enchantments.Enchantment;
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.inventory.ItemStack;
|
|
import org.bukkit.potion.PotionEffect;
|
|
import org.bukkit.potion.PotionEffectType;
|
|
|
|
/**
|
|
* @author joethei
|
|
* @version 0.1
|
|
*/
|
|
public class ThiefsDagger implements CustomSword{
|
|
|
|
private CustomPlayer player;
|
|
|
|
public ThiefsDagger(CustomPlayer player) {
|
|
this.player = player;
|
|
CustomSwordManager.add(player, this);
|
|
}
|
|
|
|
@Override
|
|
public void primaryAttack() {
|
|
player.getNearbyEntities(5.0D, 5.0D, 5.0D).stream().filter(entity -> entity instanceof Player).forEach(entity -> {
|
|
CustomPlayer p = CustomPlayer.getPlayer((Player) entity);
|
|
p.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 5, 10));
|
|
});
|
|
player.sendMessage("Primäre Attacke genutzt");
|
|
}
|
|
|
|
@Override
|
|
public void secondaryAttack() {
|
|
player.sendMessage("Sekundäre Attacke genutzt");
|
|
}
|
|
|
|
@Override
|
|
public void sneakingAttack() {
|
|
player.sendMessage("Sneakende Attacke genutzt");
|
|
}
|
|
|
|
@Override
|
|
public ItemStack getItem() {
|
|
return getItemStack();
|
|
}
|
|
|
|
public static ItemStack getItemStack() {
|
|
return new ItemBuilder(Material.DIAMOND_SWORD).name("§cDolch des Diebes").durability((short) 20).enchantment(Enchantment.KNOCKBACK, 2).enchantment(Enchantment.SWEEPING_EDGE, 1).build();
|
|
}
|
|
|
|
@Override
|
|
public void addItem() {
|
|
player.getInventory().addItem(getItem());
|
|
}
|
|
} |