Skip to content

Commit

Permalink
fix: fix #1
Browse files Browse the repository at this point in the history
  • Loading branch information
KobeBryant114514 committed Jun 20, 2024
1 parent 463cbf6 commit 2d1f588
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/OffhandItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ void listenSwitchItem() {
ll::event::EventBus::getInstance().emplaceListener<ll::event::PlayerUseItemEvent>(
[](ll::event::PlayerUseItemEvent& ev) {
auto& config = DynamicLights::Entry::getInstance()->getConfig();
auto& item = ev.item();
auto mainhand = item.clone();
if (config.offhandItems.contains(item.getTypeName())) {
auto offhand = ev.self().getOffhandSlot().clone();
auto mainhand = ev.item().clone();
auto offhand = ev.self().getOffhandSlot().clone();
if (config.offhandItems.contains(mainhand.getTypeName()) && offhand.isNull()) {
ev.self().setOffhandSlot(mainhand);
ev.self().setCarriedItem(offhand);
ev.self().refreshInventory();
Expand Down

0 comments on commit 2d1f588

Please sign in to comment.