Skip to content

Add updatehome and updatewarp to update home/warp's location#10

Merged
EasterGhost merged 1 commit intomasterfrom
dev
Mar 24, 2026
Merged

Add updatehome and updatewarp to update home/warp's location#10
EasterGhost merged 1 commit intomasterfrom
dev

Conversation

@EasterGhost
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings March 24, 2026 19:08
@EasterGhost EasterGhost merged commit 9e90b59 into master Mar 24, 2026
2 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds new commands to update an existing Home/Warp’s stored location to the player’s current position, along with UI buttons and localized messages to support the workflow.

Changes:

  • Registers new /updatehome <name> and /updatewarp <name> commands and wires them into the command UI.
  • Enables mutating stored NamedLocation coordinates via a new setter to support updates.
  • Adds new translation keys/messages (EN + zh_CN) and whitelists the new commands for the client trusted-command bypass.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/main/resources/assets/teleport_commands_fabric/lang/zh_cn.json Adds zh_CN translations for home/warp update messages and a common “[update]” button label.
src/main/resources/assets/teleport_commands_fabric/lang/en_us.json Adds en_US translations for home/warp update messages and a common “[update]” button label.
src/main/java/org/AndrewElizabeth/teleportcommandsfabric/mixin/client/ClientPlayNetworkHandlerMixin.java Whitelists updatehome/updatewarp as trusted commands for unattended send.
src/main/java/org/AndrewElizabeth/teleportcommandsfabric/common/NamedLocation.java Makes coordinates mutable and adds setCoordinates(...) to support updating location.
src/main/java/org/AndrewElizabeth/teleportcommandsfabric/commands/warp/warp.java Registers the new updatewarp command node.
src/main/java/org/AndrewElizabeth/teleportcommandsfabric/commands/warp/WarpMutationActions.java Implements updateWarp mutation logic and “same location” detection.
src/main/java/org/AndrewElizabeth/teleportcommandsfabric/commands/warp/WarpFormatter.java Adds an “Update” action button to warp list entries (admin-only).
src/main/java/org/AndrewElizabeth/teleportcommandsfabric/commands/warp/WarpAdminFormatter.java Adds an “Update” button to the admin warp map list entries.
src/main/java/org/AndrewElizabeth/teleportcommandsfabric/commands/home/home.java Registers the new updatehome command node.
src/main/java/org/AndrewElizabeth/teleportcommandsfabric/commands/home/HomeMutationActions.java Implements updateHome mutation logic and “same location” detection.
src/main/java/org/AndrewElizabeth/teleportcommandsfabric/commands/home/HomeFormatter.java Adds an “Update” action button to home list entries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +71 to +78
Optional<NamedLocation> warpToReset = WarpCommandSupport.resolveWarpForCommand(warpName, player, false);
if (warpToReset.isPresent()) {
if (isSameLocation(player, warpToReset.get(), worldString)) {
WarpMessages.send(player, "commands.teleport_commands.warp.updateSame", ChatFormatting.AQUA);
return;
}

warpToReset.get().setCoordinates(
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

Local variable name warpToReset reads like a reset operation, but this method is performing an update. Renaming it (e.g., warpToUpdate / warpToMove) would make the intent clearer and align with the command name updatewarp.

Suggested change
Optional<NamedLocation> warpToReset = WarpCommandSupport.resolveWarpForCommand(warpName, player, false);
if (warpToReset.isPresent()) {
if (isSameLocation(player, warpToReset.get(), worldString)) {
WarpMessages.send(player, "commands.teleport_commands.warp.updateSame", ChatFormatting.AQUA);
return;
}
warpToReset.get().setCoordinates(
Optional<NamedLocation> warpToUpdate = WarpCommandSupport.resolveWarpForCommand(warpName, player, false);
if (warpToUpdate.isPresent()) {
if (isSameLocation(player, warpToUpdate.get(), worldString)) {
WarpMessages.send(player, "commands.teleport_commands.warp.updateSame", ChatFormatting.AQUA);
return;
}
warpToUpdate.get().setCoordinates(

Copilot uses AI. Check for mistakes.
Comment on lines +49 to +55
MutableComponent resetButton = CommandUiSupport.translatedButton(
player,
"commands.teleport_commands.common.update",
ChatFormatting.YELLOW,
new ClickEvent.RunCommand("updatewarp " + quotedName));

CommandUiSupport.appendNameLine(message, currentWarp.getName(), visibilityState, toggleButton);
CommandUiSupport.appendNameLine(message, currentWarp.getName(), visibilityState, toggleButton, resetButton);
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

Variable resetButton is wired to the updatewarp command and uses the translated label common.update, so the name is misleading. Renaming it to updateButton (or similar) will reduce confusion when maintaining the formatter.

Copilot uses AI. Check for mistakes.
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.

2 participants