Skip to content

Commit

Permalink
ExprArmorChange - fix
Browse files Browse the repository at this point in the history
- Fix an issue with loading on Spigot
- Ref #19
  • Loading branch information
ShaneBeee committed May 9, 2020
1 parent 1c50508 commit 81d9a43
Showing 1 changed file with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import ch.njol.util.Kleenean;
import ch.njol.util.coll.CollectionUtils;
import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent;
import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent.SlotType;
import org.bukkit.event.Event;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
Expand Down Expand Up @@ -80,19 +81,15 @@ public void change(Event e, @Nullable Object[] delta, Changer.ChangeMode mode) {

ItemStack itemStack = item.getRandom();
PlayerInventory playerInv = ((PlayerArmorChangeEvent) e).getPlayer().getInventory();
switch (((PlayerArmorChangeEvent) e).getSlotType()) {
case HEAD:
playerInv.setHelmet(itemStack);
break;
case CHEST:
playerInv.setChestplate(itemStack);
break;
case LEGS:
playerInv.setLeggings(itemStack);
break;
case FEET:
playerInv.setBoots(itemStack);
break;
SlotType type = ((PlayerArmorChangeEvent) e).getSlotType();
if (type == SlotType.HEAD) {
playerInv.setHelmet(itemStack);
} else if (type == SlotType.CHEST) {
playerInv.setChestplate(itemStack);
} else if (type == SlotType.LEGS) {
playerInv.setLeggings(itemStack);
} else if (type == SlotType.FEET) {
playerInv.setBoots(itemStack);
}
}

Expand Down

0 comments on commit 81d9a43

Please sign in to comment.