mirror of
https://github.com/Minestom/Minestom.git
synced 2024-06-25 05:54:53 +02:00
50 lines
1.3 KiB
Java
50 lines
1.3 KiB
Java
|
package net.minestom.server.entity;
|
||
|
|
||
|
import net.minestom.server.event.item.ArmorEquipEvent;
|
||
|
import net.minestom.server.item.attribute.AttributeSlot;
|
||
|
import org.jetbrains.annotations.NotNull;
|
||
|
|
||
|
public enum EquipmentSlot {
|
||
|
MAIN_HAND,
|
||
|
OFF_HAND,
|
||
|
BOOTS,
|
||
|
LEGGINGS,
|
||
|
CHESTPLATE,
|
||
|
HELMET;
|
||
|
|
||
|
@NotNull
|
||
|
public static EquipmentSlot fromArmorSlot(ArmorEquipEvent.ArmorSlot armorSlot) {
|
||
|
switch (armorSlot) {
|
||
|
case HELMET:
|
||
|
return HELMET;
|
||
|
case CHESTPLATE:
|
||
|
return CHESTPLATE;
|
||
|
case LEGGINGS:
|
||
|
return LEGGINGS;
|
||
|
case BOOTS:
|
||
|
return BOOTS;
|
||
|
}
|
||
|
throw new IllegalStateException("Something weird happened");
|
||
|
}
|
||
|
|
||
|
@NotNull
|
||
|
public static EquipmentSlot fromAttributeSlot(AttributeSlot attributeSlot) {
|
||
|
switch (attributeSlot) {
|
||
|
case MAINHAND:
|
||
|
return MAIN_HAND;
|
||
|
case OFFHAND:
|
||
|
return OFF_HAND;
|
||
|
case FEET:
|
||
|
return BOOTS;
|
||
|
case LEGS:
|
||
|
return LEGGINGS;
|
||
|
case CHEST:
|
||
|
return CHESTPLATE;
|
||
|
case HEAD:
|
||
|
return HELMET;
|
||
|
}
|
||
|
throw new IllegalStateException("Something weird happened");
|
||
|
}
|
||
|
|
||
|
}
|