Add traits to EntityEquipEvent

This commit is contained in:
TheMode 2021-06-10 11:57:13 +02:00
parent 3b80335134
commit 74d323126f

View File

@ -2,11 +2,12 @@ package net.minestom.server.event.item;
import net.minestom.server.entity.Entity; import net.minestom.server.entity.Entity;
import net.minestom.server.entity.EquipmentSlot; import net.minestom.server.entity.EquipmentSlot;
import net.minestom.server.event.Event; import net.minestom.server.event.trait.EntityEvent;
import net.minestom.server.event.trait.ItemEvent;
import net.minestom.server.item.ItemStack; import net.minestom.server.item.ItemStack;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
public class EntityEquipEvent implements Event { public class EntityEquipEvent implements EntityEvent, ItemEvent {
private final Entity entity; private final Entity entity;
private ItemStack equippedItem; private ItemStack equippedItem;
@ -18,13 +19,7 @@ public class EntityEquipEvent implements Event {
this.slot = slot; this.slot = slot;
} }
@NotNull public @NotNull ItemStack getEquippedItem() {
public Entity getEntity() {
return entity;
}
@NotNull
public ItemStack getEquippedItem() {
return equippedItem; return equippedItem;
} }
@ -32,8 +27,20 @@ public class EntityEquipEvent implements Event {
this.equippedItem = armorItem; this.equippedItem = armorItem;
} }
@NotNull public @NotNull EquipmentSlot getSlot() {
public EquipmentSlot getSlot() {
return slot; return slot;
} }
/**
* Same as {@link #getEquippedItem()}.
*/
@Override
public @NotNull ItemStack getItemStack() {
return equippedItem;
}
@Override
public @NotNull Entity getEntity() {
return entity;
}
} }