Sophisticated Backpacks

Sophisticated Backpacks

89M Downloads

`BackpackAcccessLogger` uses formatted player name instead of plain username

andriihorpenko opened this issue ยท 1 comments

commented

Describe the bug
BackpackAcccessLogger creates log entries using player's display name, which often includes prefix, suffix and other server-defined things. This makes using /sophisticatedbackpacks list <player> command essentially unusable in various cases.

Regarding prefixes: server owners often map symbols to .png textures. This is how custom image prefixes are done. Hence, when I need to access player's backpack via a /sophisticatedbackpacks list <player> command, I have to know that special symbol. The chat box becomes unusable due to how Minecraft interprets these symbols.

BackpackStorage.get().putAccessLog(new AccessLogRecord(BuiltInRegistries.ITEM.getKey(backpackItem), backpackUuid, player.getDisplayName().getString(), backpackName, clothColor, trimColor, Util.getEpochMillis(), columnsTaken));

To Reproduce
Steps to reproduce the behavior:

  1. Give a player some prefix or suffix using arbitrary characters. You can skip a custom symbol-texture mapping setup and just add a plain text prefix.
  2. Use /sophisticatedbackpacks list <player> on that player.

Expected behavior
Use Player#getName instead. This returns a pure player's name from the GameProfile.

Screenshots
User prefix
image

Command after pressing on the suggestion or using TAB:
image

Added quotes to force command accept space between a special symbol and a username:
image

Versions
All versions are affected as the code snippet attached above hasn't changed.

commented

I have fixed this in 1.21 dev just now so from there on the access logging will use just plain player name