-
-
Notifications
You must be signed in to change notification settings - Fork 21
GH-1192 Extend /back functionality to per-death and per-teleport #1192
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
base: master
Are you sure you want to change the base?
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.
Code Review
This pull request extends the /back command to differentiate between death and teleport locations, which is a great feature enhancement. The implementation is mostly solid, but I've found a critical issue in the configuration migration that could lead to data loss for users. Additionally, there are several opportunities for refactoring to reduce code duplication and improve readability, particularly in BackCommand and BackService. I've also noted a design consideration regarding a shared configuration setting that could be improved.
...eternalcode/core/configuration/migrations/Migration_0010_Move_back_to_dedicated_section.java
Outdated
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/BackCommand.java
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/BackCommand.java
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/BackService.java
Outdated
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/BackService.java
Outdated
Show resolved
Hide resolved
…ion/migrations/Migration_0010_Move_back_to_dedicated_section.java Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/BackCommand.java
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/BackService.java
Outdated
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/BackService.java
Outdated
Show resolved
Hide resolved
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.
TeleportService ma stare metody jeszcze
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/BackService.java
Outdated
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/BackService.java
Outdated
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/BackService.java
Outdated
Show resolved
Hide resolved
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.
Follow the instructions of others and it will look good :)
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.
The code would become much simpler if you stopped using Pairs. They are not required.
...eternalcode/core/configuration/migrations/Migration_0010_Move_back_to_dedicated_section.java
Outdated
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/BackService.java
Outdated
Show resolved
Hide resolved
|
@vLuckyyy you would have two caches then and the only "simplification" is that you put stuff into a separate cache rather than a Pair |
Imo better create object for it, simple and easy access. |
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/messages/BackMessages.java
Outdated
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/messages/BackMessages.java
Outdated
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/BackCommand.java
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/BackCommand.java
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/BackService.java
Outdated
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/messages/BackMessages.java
Outdated
Show resolved
Hide resolved
...e-core/src/main/java/com/eternalcode/core/feature/teleportrequest/TeleportRequestConfig.java
Outdated
Show resolved
Hide resolved
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.
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/BackService.java
Outdated
Show resolved
Hide resolved
...e-core/src/main/java/com/eternalcode/core/feature/teleportrequest/TeleportRequestConfig.java
Outdated
Show resolved
Hide resolved
...eternalcode/core/configuration/migrations/Migration_0030_Move_back_to_dedicated_section.java
Outdated
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/BackCommand.java
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/BackCommand.java
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/BackCommand.java
Outdated
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/feature/back/BackService.java
Show resolved
Hide resolved
...e-core/src/main/java/com/eternalcode/core/feature/teleportrequest/TeleportRequestConfig.java
Outdated
Show resolved
Hide resolved
| Optional<Position> deathLocation = this.backService.getDeathLocation(target.getUniqueId()); | ||
|
|
||
| if (deathLocation.isPresent()) { | ||
| this.backService.teleportBack(target, PositionAdapter.convert(deathLocation.get())); |
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.
te dwie metody idealnie nadają się do serwisu a gettery można wywalić :D
| "# Specify world name to always teleport to that world" | ||
| }) | ||
| public String world = "world"; | ||
| public String world = "world_nether"; |
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.
hmm czemu tak?


Described in #1133
Resolves #1133