Skip to content
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

Merged
merged 4 commits into from
Oct 21, 2024
Merged

Conversation

VeritasDL
Copy link
Contributor

added Rouge Sword and Ink Wand

@LifeIsAParadox LifeIsAParadox added the reviews needed This PR needs reviews label Oct 7, 2024
kevinthegreat1
kevinthegreat1 previously approved these changes Oct 8, 2024
@LifeIsAParadox LifeIsAParadox added merge me please Pull requests that are ready to merge and removed reviews needed This PR needs reviews labels Oct 8, 2024
@LifeIsAParadox LifeIsAParadox added reviews needed This PR needs reviews and removed merge me please Pull requests that are ready to merge labels Oct 11, 2024
Copy link
Collaborator

@kevinthegreat1 kevinthegreat1 left a 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.

@VeritasDL
Copy link
Contributor Author

pardon my tism, this might be slightly better?

Comment on lines 115 to 117
if (player.fishHook != null) {
handleItemCooldown(GRAPPLING_HOOK_ID, 2000, !isWearingBatArmor(player));
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (player.fishHook != null) {
handleItemCooldown(GRAPPLING_HOOK_ID, 2000, !isWearingBatArmor(player));
}
handleItemCooldown(GRAPPLING_HOOK_ID, 2000, player.fishHook != null && !isWearingBatArmor(player));

Comment on lines 83 to 94
// 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);
}

Copy link
Collaborator

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) {
Copy link
Collaborator

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.

@LifeIsAParadox LifeIsAParadox added changes requested This PR need changes and removed reviews needed This PR needs reviews labels Oct 11, 2024
@LifeIsAParadox LifeIsAParadox added reviews needed This PR needs reviews and removed changes requested This PR need changes labels Oct 11, 2024
@VeritasDL
Copy link
Contributor Author

weeeee

Copy link
Collaborator

@kevinthegreat1 kevinthegreat1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks.

@LifeIsAParadox LifeIsAParadox added merge me please Pull requests that are ready to merge and removed reviews needed This PR needs reviews labels Oct 11, 2024
@AzureAaron AzureAaron merged commit 2e82772 into SkyblockerMod:master Oct 21, 2024
1 check passed
@LifeIsAParadox LifeIsAParadox removed the merge me please Pull requests that are ready to merge label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants