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

[Bug]: FTBChunks kicks players for NoSuchElementException on invalid command sent #1457

Closed
JustArion opened this issue Jan 10, 2025 · 4 comments
Assignees
Labels
1: Bug Problem with the usage of a mod. FTB Teams state: Fixed in Dev 🛠️ An issue is fixed in-dev and pending for release.

Comments

@JustArion
Copy link

Mod

FTB Chunks

Mod version

ftb-chunks-forge:2001.3.4

NeoForge / Forge / Fabric version

Forge 47.3.12

Modpack & version

No response

What issue are you having?

The player sends a seemingly valid command but gets kicked for it.

FTB Teams is involved as its the target of the command.

Prior name of team: Reserved#d053f2cd

Current name of team: _Server_Spawn_#d053f2cd

/ftbchunks admin claim_as Reserved#d053f2cd <arbitrary_radius>

The command was originally registered as valid so it bypasses client-side protections for valid arguments and sends it to the server.
The server errors on receiving the command, kicking the player.

Crashlogs

No response

Steps to reproduce

  1. Rename a team
  2. Use previous team name as valid argument to /ftbchunks admin claim_as auto_filled_old_name <arbitrary_radius>
  3. Get kicked

Anything else to note?

[Server thread/INFO]: [USER: Set Display Name to "Server Spawn"]
[Server thread/ERROR]: Command exception: /chunks admin claim_as Reserved#d053f2cd 25
java.util.NoSuchElementException: No value present
        at java.util.Optional.orElseThrow(Unknown Source) ~[?:?]
        at dev.ftb.mods.ftbteams.data.TeamArgument$IDProvider.getTeam(TeamArgument.java:93) ~[ftb-teams-forge-2001.3.0.jar%23516!/:2001.3.0]
        at dev.ftb.mods.ftbteams.data.TeamArgument.get(TeamArgument.java:51) ~[ftb-teams-forge-2001.3.0.jar%23516!/:2001.3.0]
        at dev.ftb.mods.ftbchunks.FTBChunksCommands.lambda$registerCommands$22(FTBChunksCommands.java:139) ~[ftb-chunks-forge-2001.3.4.jar%23513!/:2001.3.4]
        at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) ~[brigadier-1.1.8.jar%2376!/:?]
        at net.minecraft.commands.Commands.m_242674_(Commands.java:257) ~[server-1.20.1-20230612.114412-srg.jar%23689!/:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.m_246958_(ServerGamePacketListenerImpl.java:1244) ~[server-1.20.1-20230612.114412-srg.jar%23689!/:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.m_244885_(ServerGamePacketListenerImpl.java:1221) ~[server-1.20.1-20230612.114412-srg.jar%23689!/:?]
        at net.minecraft.util.thread.BlockableEventLoop.m_18693_(BlockableEventLoop.java:67) ~[server-1.20.1-20230612.114412-srg.jar%23689!/:?]
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source) ~[?:?]
        at net.minecraft.server.TickTask.run(TickTask.java:18) ~[server-1.20.1-20230612.114412-srg.jar%23689!/:?]
        at net.minecraft.util.thread.BlockableEventLoop.m_6367_(BlockableEventLoop.java:156) ~[server-1.20.1-20230612.114412-srg.jar%23689!/:?]
        at net.minecraft.util.thread.ReentrantBlockableEventLoop.m_6367_(ReentrantBlockableEventLoop.java:23) ~[server-1.20.1-20230612.114412-srg.jar%23689!/:?]
        at net.minecraft.server.MinecraftServer.m_6367_(MinecraftServer.java:770) ~[server-1.20.1-20230612.114412-srg.jar%23689!/:?]
        at net.minecraft.server.MinecraftServer.m_6367_(MinecraftServer.java:161) ~[server-1.20.1-20230612.114412-srg.jar%23689!/:?]
        at net.minecraft.util.thread.BlockableEventLoop.m_7245_(BlockableEventLoop.java:130) ~[server-1.20.1-20230612.114412-srg.jar%23689!/:?]
        at net.minecraft.server.MinecraftServer.m_129961_(MinecraftServer.java:753) ~[server-1.20.1-20230612.114412-srg.jar%23689!/:?]
        at net.minecraft.server.MinecraftServer.m_7245_(MinecraftServer.java:747) ~[server-1.20.1-20230612.114412-srg.jar%23689!/:?]
        at net.minecraft.util.thread.BlockableEventLoop.m_18699_(BlockableEventLoop.java:115) ~[server-1.20.1-20230612.114412-srg.jar%23689!/:?]
        at net.minecraft.server.MinecraftServer.m_130012_(MinecraftServer.java:732) ~[server-1.20.1-20230612.114412-srg.jar%23689!/:?]
        at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:665) ~[server-1.20.1-20230612.114412-srg.jar%23689!/:?]
        at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:251) ~[server-1.20.1-20230612.114412-srg.jar%23689!/:?]
        at java.lang.Thread.run(Unknown Source) ~[?:?]
@JustArion JustArion added the 1: Bug Problem with the usage of a mod. label Jan 10, 2025
@desht
Copy link
Contributor

desht commented Jan 13, 2025

What did you do to rename the team?

@desht desht added the state: Awaiting Reply 🗣️ A reply is awaited from a user. label Jan 13, 2025
@JustArion
Copy link
Author

/ftbteams server settings <old_team_name> ftbteams:display_name <new_team_name>

@desht
Copy link
Contributor

desht commented Jan 14, 2025

OK, thanks. I just tried that on a dev instance, and although I didn't get kicked, it also didn't work after doing the rename, at least until I stopped & restarted the instance.

What looks like is happening is that FTB Teams is (correctly) updating its internal name->teamdata cache after the rename is done but not syncing that update to clients, so the clientside command completion still offers the old team names. This continues until the server is restarted and the cache is rebuilt.

It's odd it caused you to get kicked with that exception; when I debugged it, that exception was thrown, but not logged, and I wasn't kicked. However, I'll see about getting this fixed in Teams.

@desht desht added FTB Teams and removed state: Awaiting Reply 🗣️ A reply is awaited from a user. labels Jan 14, 2025
@desht desht self-assigned this Jan 14, 2025
desht added a commit to FTBTeam/FTB-Teams that referenced this issue Jan 22, 2025
Needed to ensure command completion works and produces correct shortname

FTBTeam/FTB-Mods-Issues#1457
@desht desht added the state: Fixed in Dev 🛠️ An issue is fixed in-dev and pending for release. label Jan 23, 2025
@desht
Copy link
Contributor

desht commented Jan 24, 2025

Fixed in 2101.1.2 release

@desht desht closed this as completed Jan 24, 2025
desht added a commit to FTBTeam/FTB-Teams that referenced this issue Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1: Bug Problem with the usage of a mod. FTB Teams state: Fixed in Dev 🛠️ An issue is fixed in-dev and pending for release.
Projects
None yet
Development

No branches or pull requests

2 participants