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

1.20.4/dev #63

Merged
merged 5 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Java CI - Build on Push

on:
push:
branches: [ main, dev, "1.*" ]
branches: [ main, dev, "1.**" ]
workflow_dispatch:
inputs:
skip_maven_publish:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2004.1.3]

### Fixed
* Fixed `/tpaccept` command failing with "Invalid request!" error

## [2004.1.2]

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.commands.arguments.EntityArgument;
import net.minecraft.network.chat.*;
import net.minecraft.server.level.ServerPlayer;
import org.jetbrains.annotations.Nullable;

import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -104,7 +105,13 @@ public int tpa(ServerPlayer player, ServerPlayer target, boolean here) {
}

public int tpaccept(ServerPlayer player, String id) {
TPARequest request = REQUESTS.get(id);
var uuid = attemptUuid(id);
if (uuid == null) {
player.displayClientMessage(Component.literal("Invalid request!"), false);
return 0;
}

TPARequest request = REQUESTS.get(uuid);

if (request == null) {
player.displayClientMessage(Component.literal("Invalid request!"), false);
Expand All @@ -130,8 +137,13 @@ public int tpaccept(ServerPlayer player, String id) {
}

public int tpdeny(ServerPlayer player, String id) {
TPARequest request = REQUESTS.get(id);
var uuid = attemptUuid(id);
if (uuid == null) {
player.displayClientMessage(Component.literal("Invalid request!"), false);
return 0;
}

TPARequest request = REQUESTS.get(uuid);
if (request == null) {
player.displayClientMessage(Component.literal("Invalid request!"), false);
return 0;
Expand Down Expand Up @@ -161,6 +173,15 @@ public static void clearRequests() {
REQUESTS.clear();
}

@Nullable
private UUID attemptUuid(String id) {
try {
return UUID.fromString(id);
} catch (IllegalArgumentException e) {
return null;
}
}

public static HashMap<UUID, TPARequest> requests() {
return REQUESTS;
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod_id=ftbessentials
archives_base_name=ftb-essentials
maven_group=dev.ftb.mods
minecraft_version=1.20.4
mod_version=2004.1.2
mod_version=2004.1.3
mod_author=FTB Team

# Deps
Expand Down
Loading