Skip to content

Commit

Permalink
Merge pull request #63 from FTBTeam/1.20.4/dev
Browse files Browse the repository at this point in the history
1.20.4/dev
  • Loading branch information
desht authored Jun 19, 2024
2 parents fa45e45 + 23ca1c3 commit 2fded25
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
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

0 comments on commit 2fded25

Please sign in to comment.