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

Feature: Reopen last storage command #2900

Merged
merged 24 commits into from
Dec 15, 2024
Merged

Conversation

aphased
Copy link
Contributor

@aphased aphased commented Nov 6, 2024

What

This PR adds three new sub-commands as a (configless/always-on) feature. Example: /bp - (the single dash). Executing it will re-open the backpack that was last opened using /bp [int].
The inspiration for this comes from Unix-style cd - for going to the previous current directory. Also, I'm using /bp and /ec for brevity everywhere, /backpack and /enderchest work as well of course.

The new command /shlo (and /shlastopened) will always open the last-used storage irrespective of whether it was an ender chest or backpack page.

The key/command combinations are not yet taken AFAIK.
Currently in an unmodded client, executing

  • /bp - gives Command Failed: Non-Numeric argument!.
  • /ec - opens the first ender chest page, which is also still reachable via /ec or /ec 1
  • /shlastopened (and its short-form variant /shlo) are of course also still unregistered

Apart from typing it out as a command (or repeatedly accessing it via the up arrow), this feature also has the advantage that a single hotkey from any number of mods may be defined and used the same way every time you need to access any storage page multiple times in a row for removing/adding some items to it.

Also potentially noteworthy regarding the implementation, I made the explicit decision against resetting the most recent backpack/ender chest slot value in case of a non-integer argument. In this case, it will just keep the previous valid integer backpack number "active".

This feature was first suggested here.

Changelog New Features

  • Added commands "/bp -", "/ec -" and "/shlastopened" to reopen last opened storage pages. - aphased

@github-actions github-actions bot added the Detekt Has detekt problem label Nov 6, 2024
Copy link

github-actions bot commented Nov 6, 2024

One or more Detekt Failures were detected:

@lunaynx
Copy link
Contributor

lunaynx commented Nov 6, 2024

Cool idea, can we have the same thing for ender chest as well?

@github-actions github-actions bot removed the Detekt Has detekt problem label Nov 6, 2024
@Xclipsen
Copy link

Xclipsen commented Nov 7, 2024

Thank you for your hard work on this feature! I really hope it gets accepted, as it would make me genuinely happy to use it actively. I believe it has a lot of potential, and I appreciate the effort you’ve put into it.

@hannibal002 hannibal002 added this to the Version 0.28 milestone Nov 7, 2024
@hannibal002 hannibal002 added the Soon This Pull Request will be merged within the next couple of betas label Dec 5, 2024
@aphased aphased marked this pull request as draft December 7, 2024 11:53
@aphased aphased changed the title Feature: Reopen last backpack command Feature: Reopen last storage command Dec 7, 2024
@aphased
Copy link
Contributor Author

aphased commented Dec 7, 2024

Converting to draft since I would still like to add @lunaynx's suggestion (see above) first.

The newly-added `/lo` will always open the last-used storage irrespective of whether it was an ender chest or backpack page.
@github-actions github-actions bot added the Detekt Has detekt problem label Dec 7, 2024
Copy link

github-actions bot commented Dec 7, 2024

One or more Detekt Failures were detected:

(`/ec -1` works Hypixel-side, but not in the `/ec -` command logic)
Copy link

github-actions bot commented Dec 7, 2024

One or more Detekt Failures were detected:

Copy link

github-actions bot commented Dec 7, 2024

One or more Detekt Failures were detected:

@github-actions github-actions bot removed the Detekt Has detekt problem label Dec 7, 2024
@aphased aphased marked this pull request as ready for review December 7, 2024 20:19
Copy link
Owner

@hannibal002 hannibal002 left a comment

Choose a reason for hiding this comment

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

as you can see in this comparison, the two functions handleBackpack and handleEnderChest are doing the same thing, just with different values. please try using only one function for both
image

This drastically reduces repetitiveness.
Also, crucially, fixed not updating the last stored _type_ of storage (backpack vs. ender chest), only the page number/index; and this time in the correct location.
Also trimmed use of `event.message.startsWith(x, ignoreCase = true)` where possible.
@github-actions github-actions bot added the Detekt Has detekt problem label Dec 8, 2024
Copy link

github-actions bot commented Dec 8, 2024

One or more Detekt Failures were detected:

Copy link

github-actions bot commented Dec 8, 2024

One or more Detekt Failures were detected:

Copy link

github-actions bot commented Dec 8, 2024

One or more Detekt Failures were detected:

As advised in the #coding channel on Discord.
Also renamed both new commands to be prefixed with "sh"
(`/shlastopened`, `/shlo`)
Copy link

github-actions bot commented Dec 8, 2024

One or more Detekt Failures were detected:

Copy link

github-actions bot commented Dec 8, 2024

One or more Detekt Failures were detected:

@github-actions github-actions bot removed the Detekt Has detekt problem label Dec 8, 2024
Copy link
Collaborator

@CalMWolfs CalMWolfs left a comment

Choose a reason for hiding this comment

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

Worked for me

@hannibal002 hannibal002 self-requested a review December 13, 2024 08:32
Copy link
Owner

@hannibal002 hannibal002 left a comment

Choose a reason for hiding this comment

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

Please add a toggle to disable this behaviour.

@hannibal002 hannibal002 merged commit ce0f411 into hannibal002:beta Dec 15, 2024
6 checks passed
@github-actions github-actions bot removed the Soon This Pull Request will be merged within the next couple of betas label Dec 15, 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.

5 participants