-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added 2 items to ItemCooldowns #1018
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have a lot of duplicate code, can you use a method please.
pardon my tism, this might be slightly better? |
if (player.fishHook != null) { | ||
handleItemCooldown(GRAPPLING_HOOK_ID, 2000, !isWearingBatArmor(player)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (player.fishHook != null) { | |
handleItemCooldown(GRAPPLING_HOOK_ID, 2000, !isWearingBatArmor(player)); | |
} | |
handleItemCooldown(GRAPPLING_HOOK_ID, 2000, player.fishHook != null && !isWearingBatArmor(player)); |
// Method to handle item cooldowns with optional condition | ||
private static void handleItemCooldown(String itemId, int cooldownTime, boolean additionalCondition) { | ||
if (!isOnCooldown(itemId) && additionalCondition) { | ||
ITEM_COOLDOWNS.put(itemId, new CooldownEntry(cooldownTime)); | ||
} | ||
} | ||
|
||
// Overloaded method for cases without additional conditions | ||
private static void handleItemCooldown(String itemId, int cooldownTime) { | ||
handleItemCooldown(itemId, cooldownTime, true); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't make sense to place these two methods here. Maybe after onItemInteract
?
if (!SkyblockerConfigManager.get().uiAndVisuals.itemCooldown.enableItemCooldowns) | ||
return TypedActionResult.pass(ItemStack.EMPTY); | ||
String usedItemId = ItemUtils.getItemId(player.getMainHandStack()); | ||
switch (usedItemId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you sort this switch by the time while you're at it? You also have two entries for 30000
.
weeeee |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks.
added Rouge Sword and Ink Wand