- Баллы
- 76
- Имя в Minecraft
- Jusik
JavaScript:
@EventHandler
public void SETLEVEL(PlayerInteractEvent e){
if(e.getAction()==Action.PHYSICAL)return;
if(e.getItem()!=null)
if(e.getItem().getType()==Material.WOOD_SWORD){
ItemStack stack = e.getItem();
net.minecraft.server.v1_11_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(stack);
NBTTagCompound compound = nmsStack.getTag();
if (compound == null) {
compound = new NBTTagCompound();
((net.minecraft.server.v1_11_R1.ItemStack) nmsStack).setTag(compound);
compound = nmsStack.getTag();
}
NBTTagList modifiers = new NBTTagList();
NBTTagCompound healthboost = new NBTTagCompound();
healthboost.set("AttributeName", new NBTTagString("generic.attackDamage"));
healthboost.set("Name", new NBTTagString("generic.attackDamage"));
healthboost.set("Amount", new NBTTagInt(1));
healthboost.set("Operation", new NBTTagInt(0));
healthboost.set("UUIDLeast", new NBTTagInt(894654));
healthboost.set("UUIDMost", new NBTTagInt(2872));
modifiers.add(healthboost);
compound.set("AttributeModifiers", modifiers);
nmsStack.setTag(compound);
stack = CraftItemStack.asBukkitCopy(nmsStack);
}
}