Skip to content

Commit

Permalink
Fixed bug where MainHand item disappearing on Armor Stand swap
Browse files Browse the repository at this point in the history
  • Loading branch information
toonystank committed Feb 27, 2022
1 parent f8f434e commit f5a54d5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/com/toonystank/armorswap/Events/ClickEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,22 @@ public void onArmorStandRightClickEvent(PlayerInteractAtEntityEvent event) {
PlayerData.storeData(stand, map);
// armor stand set armor
for (DataType dataType : DataType.values()) {
if (dataType.equals(DataType.ARMOR_STAND_SWAP)
|| dataType.equals(DataType.ITEM_FRAME_SWAP)
|| dataType.equals(DataType.MAIN_HAND_SWAP))
continue;
if (!stand.hasArms()) {
if (dataType.equals(DataType.PLAYER_MAIN_HAND) || dataType.equals(DataType.PLAYER_OFF_HAND) || dataType.equals(DataType.STAND_OFF_HAND))
if (dataType.equals(DataType.PLAYER_MAIN_HAND)
|| dataType.equals(DataType.STAND_MAIN_HAND)
|| dataType.equals(DataType.PLAYER_OFF_HAND)
|| dataType.equals(DataType.STAND_OFF_HAND))
continue;
}
if (PlayerData.canMove(dataType, map)) {
PlayerData.setEquipment(dataType, stand, map);
PlayerData.setEquipment(dataType, player, map);
}

}
player.playSound(player.getLocation(), Sound.valueOf(sound), 1.0F, 1.0F);
}
Expand Down

1 comment on commit f5a54d5

@NoJokeFNA
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general: You may want to take a look at this Google Java Style, it's actually a pretty nice code-style which I also used just few months ago.

Please sign in to comment.