Skip to content

fix: read lowercase entity "id" tag when loading disk clipboard - #3726

Open
intersecato wants to merge 1 commit into
IntellectualSites:mainfrom
intersecato:main
Open

intersecato wants to merge 1 commit into
IntellectualSites:mainfrom
intersecato:main

Conversation

@intersecato

@intersecato intersecato commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Players with a disk-saved clipboard containing entities get a StringIndexOutOfBoundsException on every join, because the stored entity NBT uses the vanilla lowercase id tag that FAWE doesn't read. This PR makes FAWE accept both Id and id and handle a missing id safely.

Fixes #2494

Description

Entity NBT stored in a disk clipboard can carry the vanilla lowercase id tag instead of FAWE's internal Id. BaseEntity(CompoundTag) only read Id and got an empty string. EntityTypes.convertEntityId then threw a StringIndexOutOfBoundsException on charAt(0), so entity loading for the clipboard was aborted every time the player joined:

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    at com.sk89q.worldedit.world.entity.EntityTypes.convertEntityId(EntityTypes.java:558)
    at com.sk89q.worldedit.world.entity.EntityTypes.parse(EntityTypes.java:567)
    at com.sk89q.worldedit.entity.BaseEntity.<init>(BaseEntity.java:126)
    at com.fastasyncworldedit.core.extent.clipboard.DiskOptimizedClipboard.loadNBTFromFileFooter(DiskOptimiz
     edClipboard.java:275)

Submitter Checklist

  • Make sure you are opening from a topic branch (/feature/fix/docs/ branch (right side)) and not your main branch.
  • Ensure that the pull request title represents the desired changelog entry.
  • New public fields and methods are annotated with @since TODO.
  • I read and followed the contribution guidelines.

@intersecato
intersecato requested a review from a team as a code owner November 12, 2026 01:23
Copilot AI balanced review requested due to automatic review settings November 12, 2026 01:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

return "illusioner";
default: {
if (Character.isUpperCase(id.charAt(0))) {
if (!id.isEmpty() && Character.isUpperCase(id.charAt(0))) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why can this be the case?

@intersecato intersecato Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Why can this be the case?

CompoundTag#getString returns "" for a missing key. That's what caused #2494: there was only id, so getString("Id") returned "" and charAt(0) threw. The id fallback covers that case, but a tag with neither key would still crash. Other callers of parse (e.g. MutableEntityChange) could hit it too. It's just a defensive check, so I can drop it if you prefer.

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.

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

4 participants