Skip to content

Commit eeb6038

Browse files
committed
1.9.2-hotfix
1 parent 5e3e9f0 commit eeb6038

File tree

5 files changed

+27
-12
lines changed

5 files changed

+27
-12
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
<groupId>lol.hyper</groupId>
2525
<artifactId>toolstats</artifactId>
26-
<version>1.9.2</version>
26+
<version>1.9.2-hotfix</version>
2727
<packaging>jar</packaging>
2828

2929
<name>ToolStats</name>

src/main/java/lol/hyper/toolstats/events/PlayerFish.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ public void onFish(PlayerFishEvent event) {
7272
PlayerInventory inventory = player.getInventory();
7373
boolean isMain = inventory.getItemInMainHand().getType() == Material.FISHING_ROD;
7474
boolean isOffHand = inventory.getItemInOffHand().getType() == Material.FISHING_ROD;
75-
if (isMain) {
75+
if (isMain && isOffHand) {
76+
inventory.getItemInMainHand().setItemMeta(newFishingRod);
77+
} else if (isMain) {
7678
inventory.getItemInMainHand().setItemMeta(newFishingRod);
7779
} else if (isOffHand) {
7880
inventory.getItemInOffHand().setItemMeta(newFishingRod);

src/main/java/lol/hyper/toolstats/events/SheepShear.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,17 @@ public void onShear(PlayerInteractEntityEvent event) {
6565
}
6666

6767
// update the stats
68-
ItemMeta newItem = toolStats.itemLore.updateSheepSheared(heldShears, 1);
69-
if (newItem != null) {
68+
ItemMeta newShears = toolStats.itemLore.updateSheepSheared(heldShears, 1);
69+
if (newShears != null) {
7070
PlayerInventory inventory = player.getInventory();
7171
boolean isMain = inventory.getItemInMainHand().getType() == Material.SHEARS;
7272
boolean isOffHand = inventory.getItemInOffHand().getType() == Material.SHEARS;
73-
if (isMain) {
74-
inventory.getItemInMainHand().setItemMeta(newItem);
73+
if (isMain && isOffHand) {
74+
inventory.getItemInMainHand().setItemMeta(newShears);
75+
} else if (isMain) {
76+
inventory.getItemInMainHand().setItemMeta(newShears);
7577
} else if (isOffHand) {
76-
inventory.getItemInOffHand().setItemMeta(newItem);
78+
inventory.getItemInOffHand().setItemMeta(newShears);
7779
}
7880
}
7981
}

src/main/java/lol/hyper/toolstats/events/ShootBow.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,17 @@ public void onShoot(EntityShootBowEvent event) {
5656
return;
5757
}
5858

59-
ItemMeta newItem = toolStats.itemLore.updateArrowsShot(heldBow, 1);
60-
if (newItem != null) {
59+
ItemMeta newBow = toolStats.itemLore.updateArrowsShot(heldBow, 1);
60+
if (newBow != null) {
6161
PlayerInventory inventory = player.getInventory();
6262
boolean isMain = inventory.getItemInMainHand().getType() == Material.BOW || inventory.getItemInMainHand().getType() == Material.CROSSBOW;
6363
boolean isOffHand = inventory.getItemInOffHand().getType() == Material.BOW || inventory.getItemInOffHand().getType() == Material.CROSSBOW;
64-
if (isMain) {
65-
inventory.getItemInMainHand().setItemMeta(newItem);
64+
if (isMain && isOffHand) {
65+
inventory.getItemInMainHand().setItemMeta(newBow);
66+
} else if (isMain) {
67+
inventory.getItemInMainHand().setItemMeta(newBow);
6668
} else if (isOffHand) {
67-
inventory.getItemInOffHand().setItemMeta(newItem);
69+
inventory.getItemInOffHand().setItemMeta(newBow);
6870
}
6971
}
7072
}

src/main/java/lol/hyper/toolstats/tools/ItemChecker.java

+9
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ public int getCost(String tokenType) {
220220
// if the player is holding a bow in their main hand, use that one
221221
// if the bow is in their offhand instead, use that one after checking main hand
222222
// Minecraft prioritizes main hand if the player holds in both hands
223+
if (isMain && isOffHand) {
224+
return main;
225+
}
223226
if (isMain) {
224227
return main;
225228
}
@@ -246,6 +249,9 @@ public int getCost(String tokenType) {
246249
// if the player is holding shears in their main hand, use that one
247250
// if the shears are in their offhand instead, use that one after checking main hand
248251
// Minecraft prioritizes main hand if the player holds in both hands
252+
if (isMain && isOffHand) {
253+
return main;
254+
}
249255
if (isMain) {
250256
return main;
251257
}
@@ -272,6 +278,9 @@ public int getCost(String tokenType) {
272278
// if the player is holding a fishing rod in their main hand, use that one
273279
// if the fishing rod is in their offhand instead, use that one after checking main hand
274280
// Minecraft prioritizes main hand if the player holds in both hands
281+
if (isMain && isOffHand) {
282+
return main;
283+
}
275284
if (isMain) {
276285
return main;
277286
}

0 commit comments

Comments
 (0)