File tree 5 files changed +27
-12
lines changed
src/main/java/lol/hyper/toolstats
5 files changed +27
-12
lines changed Original file line number Diff line number Diff line change 23
23
24
24
<groupId >lol.hyper</groupId >
25
25
<artifactId >toolstats</artifactId >
26
- <version >1.9.2</version >
26
+ <version >1.9.2-hotfix </version >
27
27
<packaging >jar</packaging >
28
28
29
29
<name >ToolStats</name >
Original file line number Diff line number Diff line change @@ -72,7 +72,9 @@ public void onFish(PlayerFishEvent event) {
72
72
PlayerInventory inventory = player .getInventory ();
73
73
boolean isMain = inventory .getItemInMainHand ().getType () == Material .FISHING_ROD ;
74
74
boolean isOffHand = inventory .getItemInOffHand ().getType () == Material .FISHING_ROD ;
75
- if (isMain ) {
75
+ if (isMain && isOffHand ) {
76
+ inventory .getItemInMainHand ().setItemMeta (newFishingRod );
77
+ } else if (isMain ) {
76
78
inventory .getItemInMainHand ().setItemMeta (newFishingRod );
77
79
} else if (isOffHand ) {
78
80
inventory .getItemInOffHand ().setItemMeta (newFishingRod );
Original file line number Diff line number Diff line change @@ -65,15 +65,17 @@ public void onShear(PlayerInteractEntityEvent event) {
65
65
}
66
66
67
67
// 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 ) {
70
70
PlayerInventory inventory = player .getInventory ();
71
71
boolean isMain = inventory .getItemInMainHand ().getType () == Material .SHEARS ;
72
72
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 );
75
77
} else if (isOffHand ) {
76
- inventory .getItemInOffHand ().setItemMeta (newItem );
78
+ inventory .getItemInOffHand ().setItemMeta (newShears );
77
79
}
78
80
}
79
81
}
Original file line number Diff line number Diff line change @@ -56,15 +56,17 @@ public void onShoot(EntityShootBowEvent event) {
56
56
return ;
57
57
}
58
58
59
- ItemMeta newItem = toolStats .itemLore .updateArrowsShot (heldBow , 1 );
60
- if (newItem != null ) {
59
+ ItemMeta newBow = toolStats .itemLore .updateArrowsShot (heldBow , 1 );
60
+ if (newBow != null ) {
61
61
PlayerInventory inventory = player .getInventory ();
62
62
boolean isMain = inventory .getItemInMainHand ().getType () == Material .BOW || inventory .getItemInMainHand ().getType () == Material .CROSSBOW ;
63
63
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 );
66
68
} else if (isOffHand ) {
67
- inventory .getItemInOffHand ().setItemMeta (newItem );
69
+ inventory .getItemInOffHand ().setItemMeta (newBow );
68
70
}
69
71
}
70
72
}
Original file line number Diff line number Diff line change @@ -220,6 +220,9 @@ public int getCost(String tokenType) {
220
220
// if the player is holding a bow in their main hand, use that one
221
221
// if the bow is in their offhand instead, use that one after checking main hand
222
222
// Minecraft prioritizes main hand if the player holds in both hands
223
+ if (isMain && isOffHand ) {
224
+ return main ;
225
+ }
223
226
if (isMain ) {
224
227
return main ;
225
228
}
@@ -246,6 +249,9 @@ public int getCost(String tokenType) {
246
249
// if the player is holding shears in their main hand, use that one
247
250
// if the shears are in their offhand instead, use that one after checking main hand
248
251
// Minecraft prioritizes main hand if the player holds in both hands
252
+ if (isMain && isOffHand ) {
253
+ return main ;
254
+ }
249
255
if (isMain ) {
250
256
return main ;
251
257
}
@@ -272,6 +278,9 @@ public int getCost(String tokenType) {
272
278
// if the player is holding a fishing rod in their main hand, use that one
273
279
// if the fishing rod is in their offhand instead, use that one after checking main hand
274
280
// Minecraft prioritizes main hand if the player holds in both hands
281
+ if (isMain && isOffHand ) {
282
+ return main ;
283
+ }
275
284
if (isMain ) {
276
285
return main ;
277
286
}
You can’t perform that action at this time.
0 commit comments