0
0
mirror of https://github.com/Wurst-Imperium/Wurst7.git synced 2024-09-20 01:12:13 +02:00

Fix .rename not handling color codes correctly

Fixes #144
Fixes #189
This commit is contained in:
Alexander01998 2020-10-18 10:08:54 +02:00
parent f08eebf7fa
commit d14ba8ea07

View File

@ -37,13 +37,13 @@ public final class RenameCmd extends Command
for(int i = 1; i < args.length; i++)
message += " " + args[i];
message = message.replace("$", "<EFBFBD>").replace("<EFBFBD><EFBFBD>", "$");
message = message.replace("$", "\u00a7").replace("\u00a7\u00a7", "$");
ItemStack item = MC.player.inventory.getMainHandStack();
if(item == null)
throw new CmdError("There is no item in your hand.");
item.setCustomName(new LiteralText(message));
ChatUtils.message("Renamed item to \"" + message + "<EFBFBD>r\".");
ChatUtils.message("Renamed item to \"" + message + "\u00a7r\".");
}
}