Skip to content

Commit

Permalink
Do not allow terribly stupid hex format by default without permission
Browse files Browse the repository at this point in the history
  • Loading branch information
Brikster committed Sep 21, 2024
1 parent be336c6 commit cd1e56c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ public final class PlayerDecorationsFormatter {
}
}

String messageToDeserialize = message;

if (!sender.hasPermission("chatty.decoration.hex")) {
componentSerializerBuilder.hexCharacter((char) 0);
messageToDeserialize = message.replaceAll("&[xX](&[a-fA-F0-9]){6}", "");
} else {
componentSerializerBuilder.hexColors();
}
Expand All @@ -88,7 +91,7 @@ public final class PlayerDecorationsFormatter {

return componentSerializerBuilder
.build()
.deserialize(message);
.deserialize(messageToDeserialize);
}

}

0 comments on commit cd1e56c

Please sign in to comment.