Cleanup and checkstyle

This commit is contained in:
Draycia committed 2022-07-16 20:46:42 -07:00
1 parent 2ffb9caade
commit bb61dc4aec
9 files changed
+43 -15

No files matched your search

+2 -1
View File
@@ -39,7 +39,7 @@ fun ShadowJar.standardRelocations() {
relocateDependency("ninja.egg82.messenger")
relocateDependency("org.antlr")
relocateDependency("com.github.luben")
relocateDependency("io.netty")
//relocateDependency("io.netty")
}
fun ShadowJar.relocateCloud() {
@@ -61,6 +61,7 @@ fun ShadowJar.configureShadowJar() {
exclude(dependency("org.checkerframework:checker-qual"))
exclude(dependency("com.google.errorprone:error_prone_annotations"))
exclude(dependency("com.google.j2objc:j2objc-annotations"))
exclude(dependency("io.netty:netty-all"))
}
}
@@ -60,7 +60,6 @@ import net.draycia.carbon.common.messaging.packets.ChatMessagePacket;
import net.kyori.adventure.audience.MessageType;
import net.kyori.adventure.identity.Identity;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.permission.PermissionChecker;
import net.kyori.adventure.text.Component;
import net.kyori.registry.DefaultedRegistryGetter;
import ninja.egg82.messenger.services.PacketService;
@@ -21,16 +21,12 @@ package net.draycia.carbon.fabric;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.collect.MapMaker;
import com.google.common.collect.Ordering;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.TypeLiteral;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@@ -38,11 +38,9 @@ import net.draycia.carbon.common.command.Commander;
import net.draycia.carbon.common.command.argument.PlayerSuggestions;
import net.draycia.carbon.common.util.CloudUtils;
import net.draycia.carbon.fabric.command.FabricCommander;
import net.draycia.carbon.fabric.command.FabricPlayerCommander;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.Component;
import net.kyori.moonshine.message.IMessageRenderer;
import net.minecraft.server.level.ServerPlayer;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.framework.qual.DefaultQualifier;
@@ -25,7 +25,6 @@ import cloud.commandframework.minecraft.extras.MinecraftExtrasMetaKeys;
import com.google.inject.Inject;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
import net.draycia.carbon.common.command.CarbonCommand;
import net.draycia.carbon.common.command.CommandSettings;
import net.draycia.carbon.common.command.Commander;
@@ -1,3 +1,22 @@
/*
* CarbonChat
*
* Copyright (c) 2021 Josua Parks (Vicarious)
* Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package net.draycia.carbon.fabric.listeners;
import com.google.inject.Inject;
@@ -21,7 +40,7 @@ public class FabricChatPreviewListener implements ChatDecorator {
}
@Override
public CompletableFuture<Component> decorate(@Nullable ServerPlayer serverPlayer, Component component) {
public CompletableFuture<Component> decorate(final @Nullable ServerPlayer serverPlayer, final Component component) {
String content = component.getString();
for (final Map.Entry<String, String> placeholder : this.configFactory.primaryConfig().chatPlaceholders().entrySet()) {
@@ -22,7 +22,6 @@ package net.draycia.carbon.fabric.listeners;
import com.google.inject.Inject;
import java.util.List;
import net.draycia.carbon.common.config.ConfigFactory;
import net.draycia.carbon.common.config.PrimaryConfig;
import net.fabricmc.fabric.api.networking.v1.PacketSender;
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
import net.minecraft.network.protocol.game.ClientboundCustomChatCompletionsPacket;
@@ -43,7 +42,7 @@ public class FabricPlayerJoinListener implements ServerPlayConnectionEvents.Join
}
@Override
public void onPlayReady(final ServerGamePacketListenerImpl handler, PacketSender sender, final MinecraftServer server) {
public void onPlayReady(final ServerGamePacketListenerImpl handler, final PacketSender sender, final MinecraftServer server) {
final @Nullable List<String> suggestions = this.configFactory.primaryConfig().customChatSuggestions();
if (suggestions == null || suggestions.isEmpty()) {
@@ -1,3 +1,22 @@
/*
* CarbonChat
*
* Copyright (c) 2021 Josua Parks (Vicarious)
* Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package net.draycia.carbon.fabric.mixin;
import java.util.UUID;
@@ -13,7 +32,7 @@ import org.spongepowered.asm.mixin.injection.ModifyVariable;
abstract class ChatListenerMixin {
@ModifyVariable(at = @At("HEAD"), index = 1, method = "send(Lnet/minecraft/network/protocol/Packet;Lio/netty/util/concurrent/GenericFutureListener;)V", argsOnly = true)
private Packet<?> sendPacket(Packet<?> packet) {
private Packet<?> sendPacket(final Packet<?> packet) {
if (packet instanceof ClientboundPlayerChatPacket chatPacket) {
final UUID uuid = UUID.nameUUIDFromBytes(chatPacket.message().headerSignature().bytes());
CarbonChatFabric.addMessageSignature(uuid, chatPacket.message().headerSignature());
@@ -21,9 +21,7 @@ package net.draycia.carbon.fabric.mixin;
import net.draycia.carbon.fabric.callback.PlayerStatusMessageEvents;
import net.kyori.adventure.platform.fabric.FabricServerAudiences;
import net.minecraft.network.chat.ChatType;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.players.PlayerList;