mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 14:38:48 +00:00
Add NeedBraces checkstyle rule
Also fixed new checkstyle violations
This commit is contained in:
1 parent
ea29ee868c
commit
ebaecad617
6 files changed
+51
-12
No files matched your search
@@ -61,6 +61,9 @@
|
||||
<!-- https://checkstyle.org/config_imports.html#AvoidStarImport -->
|
||||
<module name="AvoidStarImport"/>
|
||||
|
||||
<!-- https://checkstyle.sourceforge.io/config_blocks.html#NeedBraces -->
|
||||
<module name="NeedBraces"/>
|
||||
|
||||
<!-- https://checkstyle.org/config_misc.html#AvoidEscapedUnicodeCharacters -->
|
||||
<module name="AvoidEscapedUnicodeCharacters">
|
||||
<property name="allowByTailComment" value="true"/>
|
||||
|
||||
@@ -143,11 +143,25 @@ public final class BasicChatChannel implements ChatChannel {
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object other) {
|
||||
if (!(other instanceof BasicChatChannel otherChannel)) return false;
|
||||
if (!(otherChannel.commandName().equals(this.commandName()))) return false;
|
||||
if (!(Objects.equals(otherChannel.quickPrefix(), this.quickPrefix()))) return false;
|
||||
if (!(Objects.equals(otherChannel.permission(), this.permission()))) return false;
|
||||
if (otherChannel.radius() != this.radius()) return false;
|
||||
if (!(other instanceof BasicChatChannel otherChannel)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(otherChannel.commandName().equals(this.commandName()))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(Objects.equals(otherChannel.quickPrefix(), this.quickPrefix()))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(Objects.equals(otherChannel.permission(), this.permission()))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (otherChannel.radius() != this.radius()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return otherChannel.key().equals(this.key());
|
||||
}
|
||||
@@ -156,4 +170,5 @@ public final class BasicChatChannel implements ChatChannel {
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.commandName(), this.quickPrefix(), this.permission(), this.radius(), this.key());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -292,11 +292,25 @@ public final class ConfigChatChannel implements ChatChannel {
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object other) {
|
||||
if (!(other instanceof BasicChatChannel otherChannel)) return false;
|
||||
if (!(otherChannel.commandName().equals(this.commandName()))) return false;
|
||||
if (!(Objects.equals(otherChannel.quickPrefix(), this.quickPrefix()))) return false;
|
||||
if (!(Objects.equals(otherChannel.permission(), this.permission()))) return false;
|
||||
if (otherChannel.radius() != this.radius()) return false;
|
||||
if (!(other instanceof BasicChatChannel otherChannel)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(otherChannel.commandName().equals(this.commandName()))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(Objects.equals(otherChannel.quickPrefix(), this.quickPrefix()))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(Objects.equals(otherChannel.permission(), this.permission()))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (otherChannel.radius() != this.radius()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return otherChannel.key().equals(this.key());
|
||||
}
|
||||
@@ -305,4 +319,5 @@ public final class ConfigChatChannel implements ChatChannel {
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.commandName(), this.quickPrefix(), this.permission(), this.radius(), this.key());
|
||||
}
|
||||
|
||||
}
|
||||
+3
-1
@@ -123,7 +123,9 @@ public class NicknameCommand extends CarbonCommand {
|
||||
@Nullable Component cached = null;
|
||||
};
|
||||
final Supplier<Component> lazyNickname = () -> {
|
||||
if (ref.cached != null) return ref.cached;
|
||||
if (ref.cached != null) {
|
||||
return ref.cached;
|
||||
}
|
||||
|
||||
ref.cached = ConfigChatChannel.parseMessageTags(sender, handler.flags().get("nickname"));
|
||||
return ref.cached;
|
||||
|
||||
@@ -353,7 +353,9 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing
|
||||
|
||||
@Override
|
||||
public boolean equals(final @Nullable Object other) {
|
||||
if (other == null || this.getClass() != other.getClass()) return false;
|
||||
if (other == null || this.getClass() != other.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.uuid.equals(((CarbonPlayerCommon) other).uuid);
|
||||
}
|
||||
|
||||
@@ -26,5 +26,7 @@ public final class DiscordRecipient implements Audience {
|
||||
public static final DiscordRecipient INSTANCE = new DiscordRecipient();
|
||||
|
||||
private DiscordRecipient() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user