Add javadoc and basic early checks to ChatUtils.areComponentsEqual()

This commit is contained in:
Alexander
2021-05-23 23:09:44 +01:00
parent 51e36be080
commit 96bee5c572

View File

@@ -285,7 +285,20 @@ public final class ChatUtils {
return component;
}
/**
* Determines whether two given components are equal to each other.
*
* @param former The left hand side component.
* @param latter The right hand side component.
* @return Returns whether the two given components are equal.
*/
public static boolean areComponentsEqual(final Component former, final Component latter) {
if (Objects.equals(former, latter)) {
return true;
}
if (former == null || latter == null) {
return false;
}
if (StringUtils.equals(
MiniMessage.get().serialize(former),
MiniMessage.get().serialize(latter))) {