diff --git a/src/client/java/xyz/thewhitedog9487/client/mixin/KeyBindsListKeyEntryMixin.java b/src/client/java/xyz/thewhitedog9487/client/mixin/KeyBindsListKeyEntryMixin.java index fea7918..09395b1 100644 --- a/src/client/java/xyz/thewhitedog9487/client/mixin/KeyBindsListKeyEntryMixin.java +++ b/src/client/java/xyz/thewhitedog9487/client/mixin/KeyBindsListKeyEntryMixin.java @@ -3,13 +3,9 @@ package xyz.thewhitedog9487.client.mixin; import xyz.thewhitedog9487.client.MiscellaneousKt; import xyz.thewhitedog9487.client.SettingsKt; import xyz.thewhitedog9487.client.WhoProvideThisKeybindModClient; -import xyz.thewhitedog9487.client.ModInfo; import net.minecraft.client.KeyMapping; import net.minecraft.client.gui.components.Button; -import net.minecraft.client.gui.components.Tooltip; import net.minecraft.client.gui.screens.options.controls.KeyBindsList; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; diff --git a/src/client/java/xyz/thewhitedog9487/client/mixin/KeyMappingMixin.java b/src/client/java/xyz/thewhitedog9487/client/mixin/KeyMappingMixin.java index a0e6631..5979ac9 100644 --- a/src/client/java/xyz/thewhitedog9487/client/mixin/KeyMappingMixin.java +++ b/src/client/java/xyz/thewhitedog9487/client/mixin/KeyMappingMixin.java @@ -10,26 +10,17 @@ import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.include.com.google.common.io.Files; import xyz.thewhitedog9487.client.MiscellaneousKt; import xyz.thewhitedog9487.client.ModInfo; -import xyz.thewhitedog9487.client.WhoProvideThisKeybindModClient; -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Paths; import java.util.Arrays; import java.util.Optional; -import java.util.function.Function; @Mixin(KeyMapping.class) public class KeyMappingMixin { @Inject(method = "(Ljava/lang/String;Lcom/mojang/blaze3d/platform/InputConstants$Type;ILnet/minecraft/client/KeyMapping$Category;I)V", at = @At("TAIL")) - void DiscoverStackTrace(String name, InputConstants.Type type, int value, KeyMapping.Category category, int order, CallbackInfo ci) throws IOException, ClassNotFoundException { + void DiscoverStackTrace(String name, InputConstants.Type type, int value, KeyMapping.Category category, int order, CallbackInfo ci) { var StackTraceCLassNames = Arrays.stream(Thread.currentThread().getStackTrace()) .map(StackTraceElement::getClassName) .toList(); diff --git a/src/client/kotlin/xyz/thewhitedog9487/client/Settings.kt b/src/client/kotlin/xyz/thewhitedog9487/client/Settings.kt index 6187b38..6278f05 100644 --- a/src/client/kotlin/xyz/thewhitedog9487/client/Settings.kt +++ b/src/client/kotlin/xyz/thewhitedog9487/client/Settings.kt @@ -7,7 +7,6 @@ import net.fabricmc.loader.api.FabricLoader import java.nio.file.FileSystems import java.nio.file.Path import java.nio.file.StandardWatchEventKinds -import java.nio.file.StandardWatchEventKinds.* const val CurrentConfigurationVersionCode: Long = 0 class Settings { @@ -80,7 +79,7 @@ class Settings { var SettingsHandler: ConfigClassHandler? = null -val ConfigFilePath = FabricLoader +val ConfigFilePath: Path = FabricLoader .getInstance() .configDir .resolve(WhoProvideThisKeybindModClient.FriendlyModID + ".json5") @@ -96,7 +95,7 @@ fun RegisterConfigFileReloadWatcher() { val ConfigDirectory = ConfigFilePath.parent try { val WatchService = FileSystems.getDefault().newWatchService() - ConfigDirectory.register(WatchService, ENTRY_CREATE, ENTRY_MODIFY, ENTRY_DELETE) + ConfigDirectory.register(WatchService, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_DELETE) while (!Thread.currentThread().isInterrupted) { val WatchKey = WatchService.take() var ShouldReload = false @@ -114,7 +113,7 @@ fun RegisterConfigFileReloadWatcher() { WhoProvideThisKeybindModClient.ClientLogger.info("检测到配置文件变更,已重新加载设置。") } if (!WatchKey.reset()) { break } } - } catch (e: InterruptedException) { + } catch (_: InterruptedException) { Thread.currentThread().interrupt() } catch (e: IOException) { throw RuntimeException(e) } } } diff --git a/src/client/kotlin/xyz/thewhitedog9487/client/WhoProvideThisKeybindModClient.kt b/src/client/kotlin/xyz/thewhitedog9487/client/WhoProvideThisKeybindModClient.kt index ea9d090..b41ae1d 100644 --- a/src/client/kotlin/xyz/thewhitedog9487/client/WhoProvideThisKeybindModClient.kt +++ b/src/client/kotlin/xyz/thewhitedog9487/client/WhoProvideThisKeybindModClient.kt @@ -1,13 +1,14 @@ package xyz.thewhitedog9487.client import net.fabricmc.api.ClientModInitializer +import org.slf4j.Logger import org.slf4j.LoggerFactory import xyz.thewhitedog9487.client.Event.RegisterClientLifecycleEvents object WhoProvideThisKeybindModClient : ClientModInitializer { const val ModID: String = "whoprovidethiskeybind" const val FriendlyModID = "WhoProvideThisKeybind" - val ClientLogger = LoggerFactory.getLogger(FriendlyModID) + val ClientLogger: Logger = LoggerFactory.getLogger(FriendlyModID) override fun onInitializeClient() { RegisterClientLifecycleEvents() } } \ No newline at end of file