mirror of
https://github.com/hyperdefined/ToolStats.git
synced 2026-04-22 19:11:23 +00:00
add logs stripped
This commit is contained in:
@@ -306,6 +306,35 @@ public class ItemChecker {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the player's axe.
|
||||
*
|
||||
* @param inventory Their inventory.
|
||||
* @return Their axe, either main or offhand.
|
||||
*/
|
||||
public @Nullable ItemStack getAxe(PlayerInventory inventory) {
|
||||
ItemStack main = inventory.getItemInMainHand();
|
||||
ItemStack offHand = inventory.getItemInOffHand();
|
||||
|
||||
boolean isMain = main.getType().toString().endsWith("_AXE");
|
||||
boolean isOffHand = offHand.getType().toString().endsWith("_AXE");
|
||||
|
||||
// if the player is holding an axe in their main hand, use that one
|
||||
// if the axe 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;
|
||||
}
|
||||
if (isOffHand) {
|
||||
return offHand;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the keys of the item and returns the tokens we should add.
|
||||
* If the server swaps token systems this should allow compatability.
|
||||
@@ -363,6 +392,9 @@ public class ItemChecker {
|
||||
if (container.has(toolStats.toolStatsKeys.getTridentThrows())) {
|
||||
tokens.add("trident-throws");
|
||||
}
|
||||
if (container.has(toolStats.toolStatsKeys.getLogsStripped())) {
|
||||
tokens.add("logs-stripped");
|
||||
}
|
||||
if (tokens.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user