P3pp3rF1y / SophisticatedBackpacks

Sophisticated backpacks is yet another minecraft backpack mod this time with backpack you can place in world, color in different color combinations, upgrade with more inventory and enhance with many functional upgrades.
https://www.curseforge.com/minecraft/mc-mods/sophisticated-backpacks
GNU General Public License v3.0
103 stars 67 forks source link

`BackpackAcccessLogger` uses formatted player name instead of plain username #1046

Open andriihorpenko opened 2 months ago

andriihorpenko commented 2 months ago

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.

https://github.com/P3pp3rF1y/SophisticatedBackpacks/blob/cb27ae272ccb65684caa454f361a8f983ab57fee/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackAccessLogger.java#L24

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.