mirror of
https://github.com/hyperdefined/ToolStats.git
synced 2025-12-06 06:41:44 +00:00
Compare commits
4 Commits
1.9.1
...
1.9.2-hotf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eeb6038b66 | ||
|
|
5e3e9f0825 | ||
|
|
11ee83773e | ||
|
|
9f5da738dd |
2
pom.xml
2
pom.xml
@@ -23,7 +23,7 @@
|
||||
|
||||
<groupId>lol.hyper</groupId>
|
||||
<artifactId>toolstats</artifactId>
|
||||
<version>1.9.1</version>
|
||||
<version>1.9.2-hotfix</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>ToolStats</name>
|
||||
|
||||
@@ -72,10 +72,11 @@ public class PlayerFish implements Listener {
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
boolean isMain = inventory.getItemInMainHand().getType() == Material.FISHING_ROD;
|
||||
boolean isOffHand = inventory.getItemInOffHand().getType() == Material.FISHING_ROD;
|
||||
if (isMain) {
|
||||
if (isMain && isOffHand) {
|
||||
inventory.getItemInMainHand().setItemMeta(newFishingRod);
|
||||
}
|
||||
if (isOffHand) {
|
||||
} else if (isMain) {
|
||||
inventory.getItemInMainHand().setItemMeta(newFishingRod);
|
||||
} else if (isOffHand) {
|
||||
inventory.getItemInOffHand().setItemMeta(newFishingRod);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,16 +65,17 @@ public class SheepShear implements Listener {
|
||||
}
|
||||
|
||||
// update the stats
|
||||
ItemMeta newItem = toolStats.itemLore.updateSheepSheared(heldShears, 1);
|
||||
if (newItem != null) {
|
||||
ItemMeta newShears = toolStats.itemLore.updateSheepSheared(heldShears, 1);
|
||||
if (newShears != null) {
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
boolean isMain = inventory.getItemInMainHand().getType() == Material.SHEARS;
|
||||
boolean isOffHand = inventory.getItemInOffHand().getType() == Material.SHEARS;
|
||||
if (isMain) {
|
||||
inventory.getItemInMainHand().setItemMeta(newItem);
|
||||
}
|
||||
if (isOffHand) {
|
||||
inventory.getItemInOffHand().setItemMeta(newItem);
|
||||
if (isMain && isOffHand) {
|
||||
inventory.getItemInMainHand().setItemMeta(newShears);
|
||||
} else if (isMain) {
|
||||
inventory.getItemInMainHand().setItemMeta(newShears);
|
||||
} else if (isOffHand) {
|
||||
inventory.getItemInOffHand().setItemMeta(newShears);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,16 +56,17 @@ public class ShootBow implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemMeta newItem = toolStats.itemLore.updateArrowsShot(heldBow, 1);
|
||||
if (newItem != null) {
|
||||
ItemMeta newBow = toolStats.itemLore.updateArrowsShot(heldBow, 1);
|
||||
if (newBow != null) {
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
boolean isMain = inventory.getItemInMainHand().getType() == Material.BOW || inventory.getItemInMainHand().getType() == Material.CROSSBOW;
|
||||
boolean isOffHand = inventory.getItemInOffHand().getType() == Material.BOW || inventory.getItemInOffHand().getType() == Material.CROSSBOW;
|
||||
if (isMain) {
|
||||
inventory.getItemInMainHand().setItemMeta(newItem);
|
||||
}
|
||||
if (isOffHand) {
|
||||
inventory.getItemInOffHand().setItemMeta(newItem);
|
||||
if (isMain && isOffHand) {
|
||||
inventory.getItemInMainHand().setItemMeta(newBow);
|
||||
} else if (isMain) {
|
||||
inventory.getItemInMainHand().setItemMeta(newBow);
|
||||
} else if (isOffHand) {
|
||||
inventory.getItemInOffHand().setItemMeta(newBow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,6 +220,9 @@ public class ItemChecker {
|
||||
// if the player is holding a bow in their main hand, use that one
|
||||
// if the bow is in their offhand instead, use that one after checking main hand
|
||||
// Minecraft prioritizes main hand if the player holds in both hands
|
||||
if (isMain && isOffHand) {
|
||||
return main;
|
||||
}
|
||||
if (isMain) {
|
||||
return main;
|
||||
}
|
||||
@@ -246,6 +249,9 @@ public class ItemChecker {
|
||||
// if the player is holding shears in their main hand, use that one
|
||||
// if the shears are in their offhand instead, use that one after checking main hand
|
||||
// Minecraft prioritizes main hand if the player holds in both hands
|
||||
if (isMain && isOffHand) {
|
||||
return main;
|
||||
}
|
||||
if (isMain) {
|
||||
return main;
|
||||
}
|
||||
@@ -272,6 +278,9 @@ public class ItemChecker {
|
||||
// if the player is holding a fishing rod in their main hand, use that one
|
||||
// if the fishing rod is in their offhand instead, use that one after checking main hand
|
||||
// Minecraft prioritizes main hand if the player holds in both hands
|
||||
if (isMain && isOffHand) {
|
||||
return main;
|
||||
}
|
||||
if (isMain) {
|
||||
return main;
|
||||
}
|
||||
|
||||
@@ -203,4 +203,4 @@ number-formats:
|
||||
# This has no use currently, but can be used for future features for dupe detection.
|
||||
generate-hash-for-items: false
|
||||
|
||||
config-version: 9
|
||||
config-version: 10
|
||||
Reference in New Issue
Block a user