FabioZumbi12 / UltimateChat

Ultimate and advanced Chat for Bukkit and Sponge
GNU General Public License v3.0
31 stars 33 forks source link

Fix extraneous space in chat messages when using empty prefix. #303

Closed eth-p closed 4 years ago

eth-p commented 4 years ago

Whenever the _UChat.prefix locale key is set to an empty string, chat messages are still prefixed with an extra space. This pull request fixes that by explicitly checking the prefix, and only adding a space if it's not empty.

Tested on Paper 1.15.2. I was unable to test it on Sponge, as their maven repo is currently down.

FabioZumbi12 commented 4 years ago

Cool!! But we can also remove the blank space, add the blank space on language files for new users, and let existing users to choose if leave without that space or add on your lang files?

As example from:

p.sendMessage(get(p, "_UChat.prefix") + " " + UCMessages.formatTags("", 
  UChatColor.translateAlternateColorCodes(key), p, "", "", UChat.get().getPlayerChannel(p)));
p.sendMessage(get(p, "_UChat.prefix") + UCMessages.formatTags("", 
  UChatColor.translateAlternateColorCodes(key), p, "", "", UChat.get().getPlayerChannel(p)));
eth-p commented 4 years ago

That could work too. I did it the way I did to avoid breaking any existing configs, but if you have a way to automatically change the prefix for old installations that work be a more optimal solution.