fix MESSAGE exploit !!!
This commit is contained in:
parent
82a0d8e31f
commit
3d511788a3
1 changed files with 13 additions and 8 deletions
|
@ -56,16 +56,21 @@ public class CustomChat {
|
||||||
// final String displayName = GsonComponentSerializer.gson().serialize(Component.join(JoinConfiguration.separator(Component.empty()), displayNameComponent.children().get(1)));
|
// final String displayName = GsonComponentSerializer.gson().serialize(Component.join(JoinConfiguration.separator(Component.empty()), displayNameComponent.children().get(1)));
|
||||||
|
|
||||||
// TODO: make this code not ohio code.,.,
|
// TODO: make this code not ohio code.,.,
|
||||||
final String sanitizedFormat = format
|
String sanitizedFormat = format
|
||||||
// .replace("\"PREFIX\"", prefix)
|
// .replace("\"PREFIX\"", prefix)
|
||||||
// .replace("\"DISPLAYNAME\"", displayName)
|
// .replace("\"DISPLAYNAME\"", displayName)
|
||||||
.replace("USERNAME", username)
|
.replace("USERNAME", username);
|
||||||
|
// these 4 lines are toooooo ohio code
|
||||||
// these 2 lines are toooooo ohio code
|
if (
|
||||||
.replace("{\"text\":\"MESSAGE\"}", messageWithColor)
|
sanitizedFormat.contains("{\"text\":\"MESSAGE\"}") ||
|
||||||
.replace("\"extra\":[\"MESSAGE\"],\"color\":", "\"extra\":[" + messageWithColor + "],\"color\":")
|
sanitizedFormat.contains("\"extra\":[\"MESSAGE\"],\"color\":")
|
||||||
|
) {
|
||||||
.replace("MESSAGE", sanitizedMessage.replaceAll("&.", "")); // TODO: make this not use regex
|
sanitizedFormat = sanitizedFormat
|
||||||
|
.replace("{\"text\":\"MESSAGE\"}", messageWithColor)
|
||||||
|
.replace("\"extra\":[\"MESSAGE\"],\"color\":", "\"extra\":[" + messageWithColor + "],\"color\":");
|
||||||
|
} else {
|
||||||
|
sanitizedFormat = sanitizedFormat.replace("MESSAGE", sanitizedMessage.replaceAll("&.", "")); // TODO: make this not use regex
|
||||||
|
}
|
||||||
|
|
||||||
CommandCore.INSTANCE.run("minecraft:tellraw @a " + sanitizedFormat);
|
CommandCore.INSTANCE.run("minecraft:tellraw @a " + sanitizedFormat);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
Loading…
Reference in a new issue