From 9cdbcb4332db6c887821b7bda6230e7189f9e294 Mon Sep 17 00:00:00 2001 From: SquidDev Date: Tue, 9 Apr 2019 16:31:00 +0100 Subject: [PATCH] Use int instead of long for configs Forge's config system will read the default values as integers, meaning it fails to validate against the config spec. Ideally this'd be fixed in forge, but this is a suitable work around. --- .../java/dan200/computercraft/shared/Config.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/dan200/computercraft/shared/Config.java b/src/main/java/dan200/computercraft/shared/Config.java index 5d3b60f6c..0a24dc502 100644 --- a/src/main/java/dan200/computercraft/shared/Config.java +++ b/src/main/java/dan200/computercraft/shared/Config.java @@ -44,8 +44,8 @@ public final class Config private static ConfigValue logComputerErrors; private static ConfigValue computerThreads; - private static ConfigValue maxMainGlobalTime; - private static ConfigValue maxMainComputerTime; + private static ConfigValue maxMainGlobalTime; + private static ConfigValue maxMainComputerTime; private static ConfigValue httpEnabled; private static ConfigValue httpWebsocketEnabled; @@ -54,8 +54,8 @@ public final class Config private static ConfigValue httpTimeout; private static ConfigValue httpMaxRequests; - private static ConfigValue httpMaxDownload; - private static ConfigValue httpMaxUpload; + private static ConfigValue httpMaxDownload; + private static ConfigValue httpMaxUpload; private static ConfigValue httpMaxWebsockets; private static ConfigValue httpMaxWebsocketMessage; @@ -134,13 +134,13 @@ private Config() {} .comment( "The maximum time that can be spent executing tasks in a single tick, in milliseconds.\n" + "Note, we will quite possibly go over this limit, as there's no way to tell how long a will take " + "- this aims to be the upper bound of the average time." ) - .defineInRange( "max_main_global_time", TimeUnit.NANOSECONDS.toMillis( ComputerCraft.maxMainGlobalTime ), 1, Long.MAX_VALUE ); + .defineInRange( "max_main_global_time", (int) TimeUnit.NANOSECONDS.toMillis( ComputerCraft.maxMainGlobalTime ), 1, Integer.MAX_VALUE ); maxMainComputerTime = builder .comment( "The ideal maximum time a computer can execute for in a tick, in milliseconds.\n" + "Note, we will quite possibly go over this limit, as there's no way to tell how long a will take " + "- this aims to be the upper bound of the average time." ) - .defineInRange( "max_main_computer_time", TimeUnit.NANOSECONDS.toMillis( ComputerCraft.maxMainComputerTime ), 1, Long.MAX_VALUE ); + .defineInRange( "max_main_computer_time", (int) TimeUnit.NANOSECONDS.toMillis( ComputerCraft.maxMainComputerTime ), 1, Integer.MAX_VALUE ); builder.pop(); } @@ -180,11 +180,11 @@ private Config() {} httpMaxDownload = builder .comment( "The maximum size (in bytes) that a computer can download in a single request. Note that responses may receive more data than allowed, but this data will not be returned to the client." ) - .defineInRange( "max_download", ComputerCraft.httpMaxDownload, 0, Long.MAX_VALUE ); + .defineInRange( "max_download", (int) ComputerCraft.httpMaxDownload, 0, Integer.MAX_VALUE ); httpMaxUpload = builder .comment( "The maximum size (in bytes) that a computer can upload in a single request. This includes headers and POST text." ) - .defineInRange( "max_upload", ComputerCraft.httpMaxUpload, 0, Long.MAX_VALUE ); + .defineInRange( "max_upload", (int) ComputerCraft.httpMaxUpload, 0, Integer.MAX_VALUE ); httpMaxWebsockets = builder .comment( "The number of websockets a computer can have open at one time. Set to 0 for unlimited." )