mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-11-17 15:24:52 +00:00
Expose max computer/global times as config options
These do have a direct impact on server performance, so are definitely worthwhile exposing.
This commit is contained in:
parent
5d05205d69
commit
245bf26480
@ -96,6 +96,7 @@ import java.net.URL;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipFile;
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
@ -134,9 +135,12 @@ public class ComputerCraft
|
|||||||
public static boolean disable_lua51_features = false;
|
public static boolean disable_lua51_features = false;
|
||||||
public static String default_computer_settings = "";
|
public static String default_computer_settings = "";
|
||||||
public static boolean debug_enable = true;
|
public static boolean debug_enable = true;
|
||||||
public static int computer_threads = 1;
|
|
||||||
public static boolean logPeripheralErrors = false;
|
public static boolean logPeripheralErrors = false;
|
||||||
|
|
||||||
|
public static int computer_threads = 1;
|
||||||
|
public static long maxMainGlobalTime = TimeUnit.MILLISECONDS.toNanos( 10 );
|
||||||
|
public static long maxMainComputerTime = TimeUnit.MILLISECONDS.toNanos( 5 );
|
||||||
|
|
||||||
public static boolean http_enable = true;
|
public static boolean http_enable = true;
|
||||||
public static boolean http_websocket_enable = true;
|
public static boolean http_websocket_enable = true;
|
||||||
public static AddressPredicate http_whitelist = new AddressPredicate( DEFAULT_HTTP_WHITELIST );
|
public static AddressPredicate http_whitelist = new AddressPredicate( DEFAULT_HTTP_WHITELIST );
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
|
|
||||||
package dan200.computercraft.core.computer;
|
package dan200.computercraft.core.computer;
|
||||||
|
|
||||||
|
import dan200.computercraft.ComputerCraft;
|
||||||
import dan200.computercraft.api.lua.ILuaTask;
|
import dan200.computercraft.api.lua.ILuaTask;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,29 +25,11 @@ import java.util.concurrent.atomic.AtomicLong;
|
|||||||
* {@link MainThread} starts cool, and runs as many tasks as it can in the current {@link #budget}ns. Any external tasks
|
* {@link MainThread} starts cool, and runs as many tasks as it can in the current {@link #budget}ns. Any external tasks
|
||||||
* (those run by tile entities, etc...) will also consume the budget
|
* (those run by tile entities, etc...) will also consume the budget
|
||||||
*
|
*
|
||||||
* Next tick, we put {@link #MAX_TICK_TIME} into our budget (and clamp it to that value to). If we're still over budget,
|
* Next tick, we put {@link ComputerCraft#maxMainGlobalTime} into our budget (and clamp it to that value to). If we're
|
||||||
* then we should not execute <em>any</em> work (either as part of {@link MainThread} or externally).
|
* still over budget, then we should not execute <em>any</em> work (either as part of {@link MainThread} or externally).
|
||||||
*/
|
*/
|
||||||
public class MainThread
|
public class MainThread
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* The maximum time that can be spent executing tasks in a single tick.
|
|
||||||
*
|
|
||||||
* 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 <em>average</em> time.
|
|
||||||
*
|
|
||||||
* @see #budget
|
|
||||||
*/
|
|
||||||
private static final long MAX_TICK_TIME = TimeUnit.MILLISECONDS.toNanos( 10 );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The ideal maximum time a computer can execute for in a tick.
|
|
||||||
*
|
|
||||||
* Note, we will quite possibly go over this limit, as there's no way to tell how long a task will take - this aims
|
|
||||||
* to be the upper bound of the <em>average</em> time.
|
|
||||||
*/
|
|
||||||
static final long MAX_COMPUTER_TIME = TimeUnit.MILLISECONDS.toNanos( 5 );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An internal counter for {@link ILuaTask} ids.
|
* An internal counter for {@link ILuaTask} ids.
|
||||||
*
|
*
|
||||||
@ -133,7 +115,7 @@ public class MainThread
|
|||||||
// Of course, we'll go over the MAX_TICK_TIME most of the time, but eventually that overrun will accumulate
|
// Of course, we'll go over the MAX_TICK_TIME most of the time, but eventually that overrun will accumulate
|
||||||
// and we'll skip a whole tick - bringing the average back down again.
|
// and we'll skip a whole tick - bringing the average back down again.
|
||||||
currentTick++;
|
currentTick++;
|
||||||
budget += Math.min( budget + MAX_TICK_TIME, MAX_TICK_TIME );
|
budget += Math.min( budget + ComputerCraft.maxMainGlobalTime, ComputerCraft.maxMainGlobalTime );
|
||||||
canExecute = budget > 0;
|
canExecute = budget > 0;
|
||||||
|
|
||||||
// Cool down any warm computers.
|
// Cool down any warm computers.
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
package dan200.computercraft.core.computer;
|
package dan200.computercraft.core.computer;
|
||||||
|
|
||||||
|
import dan200.computercraft.ComputerCraft;
|
||||||
import dan200.computercraft.api.peripheral.IWorkMonitor;
|
import dan200.computercraft.api.peripheral.IWorkMonitor;
|
||||||
import dan200.computercraft.core.tracking.Tracking;
|
import dan200.computercraft.core.tracking.Tracking;
|
||||||
import dan200.computercraft.shared.turtle.core.TurtleBrain;
|
import dan200.computercraft.shared.turtle.core.TurtleBrain;
|
||||||
@ -16,8 +17,6 @@ import java.util.ArrayDeque;
|
|||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static dan200.computercraft.core.computer.MainThread.MAX_COMPUTER_TIME;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keeps track of tasks that a {@link Computer} should run on the main thread and how long that has been spent executing
|
* Keeps track of tasks that a {@link Computer} should run on the main thread and how long that has been spent executing
|
||||||
* them.
|
* them.
|
||||||
@ -26,30 +25,30 @@ import static dan200.computercraft.core.computer.MainThread.MAX_COMPUTER_TIME;
|
|||||||
* those run elsewhere (such as during the turtle's tick - see {@link TurtleBrain#update()}). In order to handle this,
|
* those run elsewhere (such as during the turtle's tick - see {@link TurtleBrain#update()}). In order to handle this,
|
||||||
* the executor goes through three stages:
|
* the executor goes through three stages:
|
||||||
*
|
*
|
||||||
* When {@link State#COOL}, the computer is allocated {@link MainThread#MAX_COMPUTER_TIME}ns to execute any work this
|
* When {@link State#COOL}, the computer is allocated {@link ComputerCraft#maxMainComputerTime}ns to execute any work
|
||||||
* tick. At the beginning of the tick, we execute as many {@link MainThread} tasks as possible, until our timeframe or
|
* this tick. At the beginning of the tick, we execute as many {@link MainThread} tasks as possible, until our timeframe
|
||||||
* the global time frame has expired.
|
* or the global time frame has expired.
|
||||||
*
|
*
|
||||||
* Then, when other objects (such as {@link TileEntity}) are ticked, we update how much time we've used using
|
* Then, when other objects (such as {@link TileEntity}) are ticked, we update how much time we've used using
|
||||||
* {@link Computer#afterExecuteMainThread(long)}.
|
* {@link IWorkMonitor#trackWork(long, TimeUnit)}.
|
||||||
*
|
*
|
||||||
* Now, if anywhere during this period, we use more than our allocated time slice, the executor is marked as
|
* Now, if anywhere during this period, we use more than our allocated time slice, the executor is marked as
|
||||||
* {@link State#HOT}. This means it will no longer be able to execute {@link MainThread} tasks (though will still
|
* {@link State#HOT}. This means it will no longer be able to execute {@link MainThread} tasks (though will still
|
||||||
* execute tile entity tasks, in order to prevent the main thread from exhausting work every tick).
|
* execute tile entity tasks, in order to prevent the main thread from exhausting work every tick).
|
||||||
*
|
*
|
||||||
* At the beginning of the next tick, we increment the budget e by {@link MainThread#MAX_COMPUTER_TIME} and any
|
* At the beginning of the next tick, we increment the budget e by {@link ComputerCraft#maxMainComputerTime} and any
|
||||||
* {@link State#HOT} executors are marked as {@link State#COOLING}. They will remain cooling until their budget is
|
* {@link State#HOT} executors are marked as {@link State#COOLING}. They will remain cooling until their budget is
|
||||||
* fully replenished (is equal to {@link MainThread#MAX_COMPUTER_TIME}). Note, this is different to {@link MainThread},
|
* fully replenished (is equal to {@link ComputerCraft#maxMainComputerTime}). Note, this is different to
|
||||||
* which allows running when it has any budget left. When cooling, <em>no</em> tasks are executed - be they on the tile
|
* {@link MainThread}, which allows running when it has any budget left. When cooling, <em>no</em> tasks are executed -
|
||||||
* entity or main thread.
|
* be they on the tile entity or main thread.
|
||||||
*
|
*
|
||||||
* This mechanism means that, on average, computers will use at most {@link MainThread#MAX_COMPUTER_TIME}ns per second,
|
* This mechanism means that, on average, computers will use at most {@link ComputerCraft#maxMainComputerTime}ns per
|
||||||
* but one task source will not prevent others from executing.
|
* second, but one task source will not prevent others from executing.
|
||||||
*
|
*
|
||||||
* @see MainThread
|
* @see MainThread
|
||||||
* @see Computer#canExecuteMainThread()
|
* @see IWorkMonitor
|
||||||
|
* @see Computer#getMainThreadMonitor()
|
||||||
* @see Computer#queueMainThread(Runnable)
|
* @see Computer#queueMainThread(Runnable)
|
||||||
* @see Computer#afterExecuteMainThread(long)
|
|
||||||
*/
|
*/
|
||||||
final class MainThreadExecutor implements IWorkMonitor
|
final class MainThreadExecutor implements IWorkMonitor
|
||||||
{
|
{
|
||||||
@ -186,7 +185,7 @@ final class MainThreadExecutor implements IWorkMonitor
|
|||||||
if( currentTick != MainThread.currentTick() )
|
if( currentTick != MainThread.currentTick() )
|
||||||
{
|
{
|
||||||
currentTick = MainThread.currentTick();
|
currentTick = MainThread.currentTick();
|
||||||
budget = MAX_COMPUTER_TIME;
|
budget = ComputerCraft.maxMainComputerTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
budget -= time;
|
budget -= time;
|
||||||
@ -200,7 +199,7 @@ final class MainThreadExecutor implements IWorkMonitor
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move this executor forward one tick, replenishing the budget by {@link MainThread#MAX_COMPUTER_TIME}.
|
* Move this executor forward one tick, replenishing the budget by {@link ComputerCraft#maxMainComputerTime}.
|
||||||
*
|
*
|
||||||
* @return Whether this executor has cooled down, and so is safe to run again.
|
* @return Whether this executor has cooled down, and so is safe to run again.
|
||||||
*/
|
*/
|
||||||
@ -208,8 +207,8 @@ final class MainThreadExecutor implements IWorkMonitor
|
|||||||
{
|
{
|
||||||
state = State.COOLING;
|
state = State.COOLING;
|
||||||
currentTick = MainThread.currentTick();
|
currentTick = MainThread.currentTick();
|
||||||
budget += Math.min( budget + MAX_COMPUTER_TIME, MAX_COMPUTER_TIME );
|
budget += Math.min( budget + ComputerCraft.maxMainComputerTime, ComputerCraft.maxMainComputerTime );
|
||||||
if( budget < MAX_COMPUTER_TIME ) return false;
|
if( budget < ComputerCraft.maxMainComputerTime ) return false;
|
||||||
|
|
||||||
state = State.COOL;
|
state = State.COOL;
|
||||||
synchronized( queueLock )
|
synchronized( queueLock )
|
||||||
|
@ -23,6 +23,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static dan200.computercraft.ComputerCraft.DEFAULT_HTTP_BLACKLIST;
|
import static dan200.computercraft.ComputerCraft.DEFAULT_HTTP_BLACKLIST;
|
||||||
import static dan200.computercraft.ComputerCraft.DEFAULT_HTTP_WHITELIST;
|
import static dan200.computercraft.ComputerCraft.DEFAULT_HTTP_WHITELIST;
|
||||||
@ -32,6 +33,7 @@ public class Config
|
|||||||
private static final int MODEM_MAX_RANGE = 100000;
|
private static final int MODEM_MAX_RANGE = 100000;
|
||||||
|
|
||||||
private static final String CATEGORY_GENERAL = "general";
|
private static final String CATEGORY_GENERAL = "general";
|
||||||
|
private static final String CATEGORY_EXECUTION = "execution";
|
||||||
private static final String CATEGORY_HTTP = "http";
|
private static final String CATEGORY_HTTP = "http";
|
||||||
private static final String CATEGORY_PERIPHERAL = "peripheral";
|
private static final String CATEGORY_PERIPHERAL = "peripheral";
|
||||||
private static final String CATEGORY_TURTLE = "turtle";
|
private static final String CATEGORY_TURTLE = "turtle";
|
||||||
@ -44,9 +46,12 @@ public class Config
|
|||||||
private static Property disableLua51Features;
|
private static Property disableLua51Features;
|
||||||
private static Property defaultComputerSettings;
|
private static Property defaultComputerSettings;
|
||||||
private static Property debugEnabled;
|
private static Property debugEnabled;
|
||||||
private static Property computerThreads;
|
|
||||||
private static Property logComputerErrors;
|
private static Property logComputerErrors;
|
||||||
|
|
||||||
|
private static Property computerThreads;
|
||||||
|
private static Property maxMainGlobalTime;
|
||||||
|
private static Property maxMainComputerTime;
|
||||||
|
|
||||||
private static Property httpEnable;
|
private static Property httpEnable;
|
||||||
private static Property httpWebsocketEnable;
|
private static Property httpWebsocketEnable;
|
||||||
private static Property httpWhitelist;
|
private static Property httpWhitelist;
|
||||||
@ -97,21 +102,16 @@ public class Config
|
|||||||
maximumFilesOpen.setMinValue( 0 );
|
maximumFilesOpen.setMinValue( 0 );
|
||||||
|
|
||||||
disableLua51Features = config.get( CATEGORY_GENERAL, "disable_lua51_features", ComputerCraft.disable_lua51_features );
|
disableLua51Features = config.get( CATEGORY_GENERAL, "disable_lua51_features", ComputerCraft.disable_lua51_features );
|
||||||
disableLua51Features.setComment( "Set this to true to disable Lua 5.1 functions that will be removed in a future update. Useful for ensuring forward compatibility of your programs now." );
|
disableLua51Features.setComment( "Set this to true to disable Lua 5.1 functions that will be removed in a future " +
|
||||||
|
"update. Useful for ensuring forward compatibility of your programs now." );
|
||||||
|
|
||||||
defaultComputerSettings = config.get( CATEGORY_GENERAL, "default_computer_settings", ComputerCraft.default_computer_settings );
|
defaultComputerSettings = config.get( CATEGORY_GENERAL, "default_computer_settings", ComputerCraft.default_computer_settings );
|
||||||
defaultComputerSettings.setComment( "A comma seperated list of default system settings to set on new computers. Example: \"shell.autocomplete=false,lua.autocomplete=false,edit.autocomplete=false\" will disable all autocompletion" );
|
defaultComputerSettings.setComment( "A comma seperated list of default system settings to set on new computers. Example: " +
|
||||||
|
"\"shell.autocomplete=false,lua.autocomplete=false,edit.autocomplete=false\" will disable all autocompletion" );
|
||||||
|
|
||||||
debugEnabled = config.get( CATEGORY_GENERAL, "debug_enabled", ComputerCraft.debug_enable );
|
debugEnabled = config.get( CATEGORY_GENERAL, "debug_enabled", ComputerCraft.debug_enable );
|
||||||
debugEnabled.setComment( "Enable Lua's debug library. This is sandboxed to each computer, so is generally safe to be used by players." );
|
debugEnabled.setComment( "Enable Lua's debug library. This is sandboxed to each computer, so is generally safe to be used by players." );
|
||||||
|
|
||||||
computerThreads = config.get( CATEGORY_GENERAL, "computer_threads", ComputerCraft.computer_threads );
|
|
||||||
computerThreads
|
|
||||||
.setMinValue( 1 )
|
|
||||||
.setRequiresMcRestart( true )
|
|
||||||
.setComment( "Set the number of threads computers can run on. A higher number means more computers can run at once, but may induce lag.\n" +
|
|
||||||
"Please note that some mods may not work with a thread count higher than 1. Use with caution." );
|
|
||||||
|
|
||||||
logComputerErrors = config.get( CATEGORY_GENERAL, "log_computer_errors", ComputerCraft.logPeripheralErrors );
|
logComputerErrors = config.get( CATEGORY_GENERAL, "log_computer_errors", ComputerCraft.logPeripheralErrors );
|
||||||
logComputerErrors.setComment( "Log exceptions thrown by peripherals and other Lua objects.\n" +
|
logComputerErrors.setComment( "Log exceptions thrown by peripherals and other Lua objects.\n" +
|
||||||
"This makes it easier for mod authors to debug problems, but may result in log spam should people use buggy methods." );
|
"This makes it easier for mod authors to debug problems, but may result in log spam should people use buggy methods." );
|
||||||
@ -119,7 +119,42 @@ public class Config
|
|||||||
setOrder(
|
setOrder(
|
||||||
CATEGORY_GENERAL,
|
CATEGORY_GENERAL,
|
||||||
computerSpaceLimit, floppySpaceLimit, maximumFilesOpen,
|
computerSpaceLimit, floppySpaceLimit, maximumFilesOpen,
|
||||||
disableLua51Features, defaultComputerSettings, debugEnabled, computerThreads, logComputerErrors
|
disableLua51Features, defaultComputerSettings, debugEnabled, logComputerErrors
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
{ // Execution
|
||||||
|
renameProperty( CATEGORY_GENERAL, "computer_threads", CATEGORY_EXECUTION, "computer_threads" );
|
||||||
|
|
||||||
|
config.getCategory( CATEGORY_EXECUTION )
|
||||||
|
.setComment( "Controls execution behaviour of computers. This is largely intended for fine-tuning " +
|
||||||
|
"servers, and generally shouldn't need to be touched" );
|
||||||
|
|
||||||
|
computerThreads = config.get( CATEGORY_EXECUTION, "computer_threads", ComputerCraft.computer_threads );
|
||||||
|
computerThreads
|
||||||
|
.setMinValue( 1 )
|
||||||
|
.setRequiresMcRestart( true )
|
||||||
|
.setComment( "Set the number of threads computers can run on. A higher number means more computers can " +
|
||||||
|
"run at once, but may induce lag.\n" +
|
||||||
|
"Please note that some mods may not work with a thread count higher than 1. Use with caution." );
|
||||||
|
|
||||||
|
maxMainGlobalTime = config.get( CATEGORY_EXECUTION, "max_main_global_time", (int) TimeUnit.NANOSECONDS.toMillis( ComputerCraft.maxMainGlobalTime ) );
|
||||||
|
maxMainGlobalTime
|
||||||
|
.setMinValue( 1 )
|
||||||
|
.setComment( "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." );
|
||||||
|
|
||||||
|
maxMainComputerTime = config.get( CATEGORY_EXECUTION, "max_main_computer_time", (int) TimeUnit.NANOSECONDS.toMillis( ComputerCraft.maxMainComputerTime ) );
|
||||||
|
maxMainComputerTime
|
||||||
|
.setMinValue( 1 )
|
||||||
|
.setComment( "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." );
|
||||||
|
|
||||||
|
setOrder(
|
||||||
|
CATEGORY_EXECUTION,
|
||||||
|
computerThreads, maxMainGlobalTime, maxMainComputerTime
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,20 +164,28 @@ public class Config
|
|||||||
renameProperty( CATEGORY_GENERAL, "http_whitelist", CATEGORY_HTTP, "whitelist" );
|
renameProperty( CATEGORY_GENERAL, "http_whitelist", CATEGORY_HTTP, "whitelist" );
|
||||||
renameProperty( CATEGORY_GENERAL, "http_blacklist", CATEGORY_HTTP, "blacklist" );
|
renameProperty( CATEGORY_GENERAL, "http_blacklist", CATEGORY_HTTP, "blacklist" );
|
||||||
|
|
||||||
|
config.getCategory( CATEGORY_HTTP )
|
||||||
|
.setComment( "Controls the HTTP API" );
|
||||||
|
|
||||||
httpEnable = config.get( CATEGORY_HTTP, "enabled", ComputerCraft.http_enable );
|
httpEnable = config.get( CATEGORY_HTTP, "enabled", ComputerCraft.http_enable );
|
||||||
httpEnable.setComment( "Enable the \"http\" API on Computers (see \"http_whitelist\" and \"http_blacklist\" for more fine grained control than this)" );
|
httpEnable.setComment( "Enable the \"http\" API on Computers (see \"http_whitelist\" and \"http_blacklist\" for " +
|
||||||
|
"more fine grained control than this)" );
|
||||||
|
|
||||||
httpWebsocketEnable = config.get( CATEGORY_HTTP, "websocket_enabled", ComputerCraft.http_websocket_enable );
|
httpWebsocketEnable = config.get( CATEGORY_HTTP, "websocket_enabled", ComputerCraft.http_websocket_enable );
|
||||||
httpWebsocketEnable.setComment( "Enable use of http websockets. This requires the \"http_enable\" option to also be true." );
|
httpWebsocketEnable.setComment( "Enable use of http websockets. This requires the \"http_enable\" option to also be true." );
|
||||||
|
|
||||||
httpWhitelist = config.get( CATEGORY_HTTP, "whitelist", DEFAULT_HTTP_WHITELIST );
|
httpWhitelist = config.get( CATEGORY_HTTP, "whitelist", DEFAULT_HTTP_WHITELIST );
|
||||||
httpWhitelist.setComment( "A list of wildcards for domains or IP ranges that can be accessed through the \"http\" API on Computers.\n" +
|
httpWhitelist.setComment( "A list of wildcards for domains or IP ranges that can be accessed through the " +
|
||||||
"Set this to \"*\" to access to the entire internet. Example: \"*.pastebin.com\" will restrict access to just subdomains of pastebin.com.\n" +
|
"\"http\" API on Computers.\n" +
|
||||||
|
"Set this to \"*\" to access to the entire internet. Example: \"*.pastebin.com\" will restrict access to " +
|
||||||
|
"just subdomains of pastebin.com.\n" +
|
||||||
"You can use domain names (\"pastebin.com\"), wilcards (\"*.pastebin.com\") or CIDR notation (\"127.0.0.0/8\")." );
|
"You can use domain names (\"pastebin.com\"), wilcards (\"*.pastebin.com\") or CIDR notation (\"127.0.0.0/8\")." );
|
||||||
|
|
||||||
httpBlacklist = config.get( CATEGORY_HTTP, "blacklist", DEFAULT_HTTP_BLACKLIST );
|
httpBlacklist = config.get( CATEGORY_HTTP, "blacklist", DEFAULT_HTTP_BLACKLIST );
|
||||||
httpBlacklist.setComment( "A list of wildcards for domains or IP ranges that cannot be accessed through the \"http\" API on Computers.\n" +
|
httpBlacklist.setComment( "A list of wildcards for domains or IP ranges that cannot be accessed through the " +
|
||||||
"If this is empty then all whitelisted domains will be accessible. Example: \"*.github.com\" will block access to all subdomains of github.com.\n" +
|
"\"http\" API on Computers.\n" +
|
||||||
|
"If this is empty then all whitelisted domains will be accessible. Example: \"*.github.com\" will block " +
|
||||||
|
"access to all subdomains of github.com.\n" +
|
||||||
"You can use domain names (\"pastebin.com\"), wilcards (\"*.pastebin.com\") or CIDR notation (\"127.0.0.0/8\")." );
|
"You can use domain names (\"pastebin.com\"), wilcards (\"*.pastebin.com\") or CIDR notation (\"127.0.0.0/8\")." );
|
||||||
|
|
||||||
httpTimeout = config.get( CATEGORY_HTTP, "timeout", ComputerCraft.httpTimeout );
|
httpTimeout = config.get( CATEGORY_HTTP, "timeout", ComputerCraft.httpTimeout );
|
||||||
@ -150,15 +193,18 @@ public class Config
|
|||||||
httpTimeout.setMinValue( 0 );
|
httpTimeout.setMinValue( 0 );
|
||||||
|
|
||||||
httpMaxRequests = config.get( CATEGORY_HTTP, "max_requests", ComputerCraft.httpMaxRequests );
|
httpMaxRequests = config.get( CATEGORY_HTTP, "max_requests", ComputerCraft.httpMaxRequests );
|
||||||
httpMaxRequests.setComment( "The number of http requests a computer can make at one time. Additional requests will be queued, and sent when the running requests have finished. Set to 0 for unlimited." );
|
httpMaxRequests.setComment( "The number of http requests a computer can make at one time. Additional requests " +
|
||||||
|
"will be queued, and sent when the running requests have finished. Set to 0 for unlimited." );
|
||||||
httpMaxRequests.setMinValue( 0 );
|
httpMaxRequests.setMinValue( 0 );
|
||||||
|
|
||||||
httpMaxDownload = config.get( CATEGORY_HTTP, "max_download", (int) ComputerCraft.httpMaxDownload );
|
httpMaxDownload = config.get( CATEGORY_HTTP, "max_download", (int) ComputerCraft.httpMaxDownload );
|
||||||
httpMaxDownload.setComment( "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." );
|
httpMaxDownload.setComment( "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." );
|
||||||
httpMaxDownload.setMinValue( 0 );
|
httpMaxDownload.setMinValue( 0 );
|
||||||
|
|
||||||
httpMaxUpload = config.get( CATEGORY_HTTP, "max_upload", (int) ComputerCraft.httpMaxUpload );
|
httpMaxUpload = config.get( CATEGORY_HTTP, "max_upload", (int) ComputerCraft.httpMaxUpload );
|
||||||
httpMaxUpload.setComment( "The maximum size (in bytes) that a computer can upload in a single request. This includes headers and POST text." );
|
httpMaxUpload.setComment( "The maximum size (in bytes) that a computer can upload in a single request. This " +
|
||||||
|
"includes headers and POST text." );
|
||||||
httpMaxUpload.setMinValue( 0 );
|
httpMaxUpload.setMinValue( 0 );
|
||||||
|
|
||||||
httpMaxWebsockets = config.get( CATEGORY_HTTP, "max_websockets", ComputerCraft.httpMaxWebsockets );
|
httpMaxWebsockets = config.get( CATEGORY_HTTP, "max_websockets", ComputerCraft.httpMaxWebsockets );
|
||||||
@ -185,6 +231,9 @@ public class Config
|
|||||||
renameProperty( CATEGORY_GENERAL, "modem_highAltitudeRangeDuringStorm", CATEGORY_PERIPHERAL, "modem_high_altitude_range_during_storm" );
|
renameProperty( CATEGORY_GENERAL, "modem_highAltitudeRangeDuringStorm", CATEGORY_PERIPHERAL, "modem_high_altitude_range_during_storm" );
|
||||||
renameProperty( CATEGORY_GENERAL, "maxNotesPerTick", CATEGORY_PERIPHERAL, "max_notes_per_tick" );
|
renameProperty( CATEGORY_GENERAL, "maxNotesPerTick", CATEGORY_PERIPHERAL, "max_notes_per_tick" );
|
||||||
|
|
||||||
|
config.getCategory( CATEGORY_PERIPHERAL )
|
||||||
|
.setComment( "Various options relating to peripherals." );
|
||||||
|
|
||||||
commandBlockEnabled = config.get( CATEGORY_PERIPHERAL, "command_block_enabled", ComputerCraft.enableCommandBlock );
|
commandBlockEnabled = config.get( CATEGORY_PERIPHERAL, "command_block_enabled", ComputerCraft.enableCommandBlock );
|
||||||
commandBlockEnabled.setComment( "Enable Command Block peripheral support" );
|
commandBlockEnabled.setComment( "Enable Command Block peripheral support" );
|
||||||
|
|
||||||
@ -226,6 +275,9 @@ public class Config
|
|||||||
renameProperty( CATEGORY_GENERAL, "turtlesCanPush", CATEGORY_TURTLE, "can_push" );
|
renameProperty( CATEGORY_GENERAL, "turtlesCanPush", CATEGORY_TURTLE, "can_push" );
|
||||||
renameProperty( CATEGORY_GENERAL, "turtle_disabled_actions", CATEGORY_TURTLE, "disabled_actions" );
|
renameProperty( CATEGORY_GENERAL, "turtle_disabled_actions", CATEGORY_TURTLE, "disabled_actions" );
|
||||||
|
|
||||||
|
config.getCategory( CATEGORY_HTTP )
|
||||||
|
.setComment( "Various options relating to turtles." );
|
||||||
|
|
||||||
turtlesNeedFuel = config.get( CATEGORY_TURTLE, "need_fuel", ComputerCraft.turtlesNeedFuel );
|
turtlesNeedFuel = config.get( CATEGORY_TURTLE, "need_fuel", ComputerCraft.turtlesNeedFuel );
|
||||||
turtlesNeedFuel.setComment( "Set whether Turtles require fuel to move" );
|
turtlesNeedFuel.setComment( "Set whether Turtles require fuel to move" );
|
||||||
|
|
||||||
@ -238,10 +290,12 @@ public class Config
|
|||||||
advancedTurtleFuelLimit.setMinValue( 0 );
|
advancedTurtleFuelLimit.setMinValue( 0 );
|
||||||
|
|
||||||
turtlesObeyBlockProtection = config.get( CATEGORY_TURTLE, "obey_block_protection", ComputerCraft.turtlesObeyBlockProtection );
|
turtlesObeyBlockProtection = config.get( CATEGORY_TURTLE, "obey_block_protection", ComputerCraft.turtlesObeyBlockProtection );
|
||||||
turtlesObeyBlockProtection.setComment( "If set to true, Turtles will be unable to build, dig, or enter protected areas (such as near the server spawn point)" );
|
turtlesObeyBlockProtection.setComment( "If set to true, Turtles will be unable to build, dig, or enter protected " +
|
||||||
|
"areas (such as near the server spawn point)" );
|
||||||
|
|
||||||
turtlesCanPush = config.get( CATEGORY_TURTLE, "can_push", ComputerCraft.turtlesCanPush );
|
turtlesCanPush = config.get( CATEGORY_TURTLE, "can_push", ComputerCraft.turtlesCanPush );
|
||||||
turtlesCanPush.setComment( "If set to true, Turtles will push entities out of the way instead of stopping if there is space to do so" );
|
turtlesCanPush.setComment( "If set to true, Turtles will push entities out of the way instead of stopping if " +
|
||||||
|
"there is space to do so" );
|
||||||
|
|
||||||
turtleDisabledActions = config.get( CATEGORY_TURTLE, "disabled_actions", new String[0] );
|
turtleDisabledActions = config.get( CATEGORY_TURTLE, "disabled_actions", new String[0] );
|
||||||
turtleDisabledActions.setComment( "A list of turtle actions which are disabled." );
|
turtleDisabledActions.setComment( "A list of turtle actions which are disabled." );
|
||||||
@ -252,11 +306,12 @@ public class Config
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
setupLanguage( config.getCategory( CATEGORY_GENERAL ), "gui.computercraft:config" );
|
|
||||||
for( String child : config.getCategoryNames() )
|
for( String child : config.getCategoryNames() )
|
||||||
{
|
{
|
||||||
if( child.equals( CATEGORY_GENERAL ) ) continue;
|
setupLanguage(
|
||||||
setupLanguage( config.getCategory( child ), "gui.computercraft:config." + child );
|
config.getCategory( child ),
|
||||||
|
child.equals( CATEGORY_GENERAL ) ? "gui.computercraft:config" : "gui.computercraft:config." + child
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
sync();
|
sync();
|
||||||
@ -374,9 +429,13 @@ public class Config
|
|||||||
ComputerCraft.disable_lua51_features = disableLua51Features.getBoolean();
|
ComputerCraft.disable_lua51_features = disableLua51Features.getBoolean();
|
||||||
ComputerCraft.default_computer_settings = defaultComputerSettings.getString();
|
ComputerCraft.default_computer_settings = defaultComputerSettings.getString();
|
||||||
ComputerCraft.debug_enable = debugEnabled.getBoolean();
|
ComputerCraft.debug_enable = debugEnabled.getBoolean();
|
||||||
ComputerCraft.computer_threads = computerThreads.getInt();
|
|
||||||
ComputerCraft.logPeripheralErrors = logComputerErrors.getBoolean();
|
ComputerCraft.logPeripheralErrors = logComputerErrors.getBoolean();
|
||||||
|
|
||||||
|
// Execution
|
||||||
|
ComputerCraft.computer_threads = computerThreads.getInt();
|
||||||
|
ComputerCraft.maxMainGlobalTime = TimeUnit.MILLISECONDS.toNanos( Math.max( 1, maxMainGlobalTime.getLong() ) );
|
||||||
|
ComputerCraft.maxMainComputerTime = TimeUnit.MILLISECONDS.toNanos( Math.max( 1, maxMainComputerTime.getLong() ) );
|
||||||
|
|
||||||
// HTTP
|
// HTTP
|
||||||
ComputerCraft.http_enable = httpEnable.getBoolean();
|
ComputerCraft.http_enable = httpEnable.getBoolean();
|
||||||
ComputerCraft.http_websocket_enable = httpWebsocketEnable.getBoolean();
|
ComputerCraft.http_websocket_enable = httpWebsocketEnable.getBoolean();
|
||||||
|
@ -156,9 +156,10 @@ gui.computercraft:config.maximum_open_files=Maximalanzahl an gleichzeitig offene
|
|||||||
gui.computercraft:config.disable_lua51_features=Lua 5.1-Funktionen deaktivieren
|
gui.computercraft:config.disable_lua51_features=Lua 5.1-Funktionen deaktivieren
|
||||||
gui.computercraft:config.default_computer_settings=Computer-Standardeinstellungen
|
gui.computercraft:config.default_computer_settings=Computer-Standardeinstellungen
|
||||||
gui.computercraft:config.debug_enabled=Debug-Library aktivieren
|
gui.computercraft:config.debug_enabled=Debug-Library aktivieren
|
||||||
gui.computercraft:config.computer_threads=Computer Threads
|
|
||||||
gui.computercraft:config.log_computer_errors=Computerfehler loggen
|
gui.computercraft:config.log_computer_errors=Computerfehler loggen
|
||||||
|
|
||||||
|
gui.computercraft:config.execution.computer_threads=Computer Threads
|
||||||
|
|
||||||
gui.computercraft:config.http=HTTP
|
gui.computercraft:config.http=HTTP
|
||||||
gui.computercraft:config.http.enabled=HTTP-API aktivieren
|
gui.computercraft:config.http.enabled=HTTP-API aktivieren
|
||||||
gui.computercraft:config.http.websocket_enabled=Websockets aktivieren
|
gui.computercraft:config.http.websocket_enabled=Websockets aktivieren
|
||||||
|
@ -156,9 +156,13 @@ gui.computercraft:config.maximum_open_files=Maximum files open per computer
|
|||||||
gui.computercraft:config.disable_lua51_features=Disable Lua 5.1 features
|
gui.computercraft:config.disable_lua51_features=Disable Lua 5.1 features
|
||||||
gui.computercraft:config.default_computer_settings=Default Computer settings
|
gui.computercraft:config.default_computer_settings=Default Computer settings
|
||||||
gui.computercraft:config.debug_enabled=Enable debug library
|
gui.computercraft:config.debug_enabled=Enable debug library
|
||||||
gui.computercraft:config.computer_threads=Computer threads
|
|
||||||
gui.computercraft:config.log_computer_errors=Log computer errors
|
gui.computercraft:config.log_computer_errors=Log computer errors
|
||||||
|
|
||||||
|
gui.computercraft:config.execution=Execution
|
||||||
|
gui.computercraft:config.execution.computer_threads=Computer threads
|
||||||
|
gui.computercraft:config.execution.max_main_global_time=Server tick global time limit
|
||||||
|
gui.computercraft:config.execution.max_main_computer_time=Server tick computer time limit
|
||||||
|
|
||||||
gui.computercraft:config.http=HTTP
|
gui.computercraft:config.http=HTTP
|
||||||
gui.computercraft:config.http.enabled=Enable the HTTP API
|
gui.computercraft:config.http.enabled=Enable the HTTP API
|
||||||
gui.computercraft:config.http.websocket_enabled=Enable websockets
|
gui.computercraft:config.http.websocket_enabled=Enable websockets
|
||||||
|
@ -56,9 +56,10 @@ gui.computercraft:config.maximum_open_files=Massimo file aperti per computer
|
|||||||
gui.computercraft:config.disable_lua51_features=Disattiva features Lua 5.1
|
gui.computercraft:config.disable_lua51_features=Disattiva features Lua 5.1
|
||||||
gui.computercraft:config.default_computer_settings=Impostazioni Computer predefinite
|
gui.computercraft:config.default_computer_settings=Impostazioni Computer predefinite
|
||||||
gui.computercraft:config.debug_enabled=Attiva libreria di debug
|
gui.computercraft:config.debug_enabled=Attiva libreria di debug
|
||||||
gui.computercraft:config.computer_threads=Threads computer
|
|
||||||
gui.computercraft:config.log_computer_errors=Salva errori computer
|
gui.computercraft:config.log_computer_errors=Salva errori computer
|
||||||
|
|
||||||
|
gui.computercraft:config.execution.computer_threads=Threads computer
|
||||||
|
|
||||||
gui.computercraft:config.http=HTTP
|
gui.computercraft:config.http=HTTP
|
||||||
gui.computercraft:config.http.enabled=Attiva l'API HTTP
|
gui.computercraft:config.http.enabled=Attiva l'API HTTP
|
||||||
gui.computercraft:config.http.websocket_enabled=Attiva websocket
|
gui.computercraft:config.http.websocket_enabled=Attiva websocket
|
||||||
|
@ -56,9 +56,10 @@ gui.computercraft:config.maximum_open_files=Número máximo de arquivos em um co
|
|||||||
gui.computercraft:config.disable_lua51_features=Desabilitar funcionalidade da Lua 5.1
|
gui.computercraft:config.disable_lua51_features=Desabilitar funcionalidade da Lua 5.1
|
||||||
gui.computercraft:config.default_computer_settings=Configurações padrão para Computadores
|
gui.computercraft:config.default_computer_settings=Configurações padrão para Computadores
|
||||||
gui.computercraft:config.debug_enabled=Habilitar biblioteca de debug
|
gui.computercraft:config.debug_enabled=Habilitar biblioteca de debug
|
||||||
gui.computercraft:config.computer_threads=Threads por computador
|
|
||||||
gui.computercraft:config.log_computer_errors=Registrar erros de computadores
|
gui.computercraft:config.log_computer_errors=Registrar erros de computadores
|
||||||
|
|
||||||
|
gui.computercraft:config.execution.computer_threads=Threads por computador
|
||||||
|
|
||||||
gui.computercraft:config.http=HTTP
|
gui.computercraft:config.http=HTTP
|
||||||
gui.computercraft:config.http.enabled=Habilitar a biblioteca de HTTP
|
gui.computercraft:config.http.enabled=Habilitar a biblioteca de HTTP
|
||||||
gui.computercraft:config.http.websocket_enabled=Habilitar websockets
|
gui.computercraft:config.http.websocket_enabled=Habilitar websockets
|
||||||
|
@ -56,9 +56,10 @@ gui.computercraft:config.maximum_open_files=Max antal filer öppna per dator
|
|||||||
gui.computercraft:config.disable_lua51_features=Avaktivera Lua 5.1 funktioner
|
gui.computercraft:config.disable_lua51_features=Avaktivera Lua 5.1 funktioner
|
||||||
gui.computercraft:config.default_computer_settings=Standard Datorinställningar
|
gui.computercraft:config.default_computer_settings=Standard Datorinställningar
|
||||||
gui.computercraft:config.debug_enabled=Aktivera debug bibliotek
|
gui.computercraft:config.debug_enabled=Aktivera debug bibliotek
|
||||||
gui.computercraft:config.computer_threads=Dator trådar
|
|
||||||
gui.computercraft:config.log_computer_errors=Logga datorfel
|
gui.computercraft:config.log_computer_errors=Logga datorfel
|
||||||
|
|
||||||
|
gui.computercraft:config.execution.computer_threads=Dator trådar
|
||||||
|
|
||||||
gui.computercraft:config.http=HTTP
|
gui.computercraft:config.http=HTTP
|
||||||
gui.computercraft:config.http.enabled=Aktivera HTTP API
|
gui.computercraft:config.http.enabled=Aktivera HTTP API
|
||||||
gui.computercraft:config.http.websocket_enabled=Aktivera websockets
|
gui.computercraft:config.http.websocket_enabled=Aktivera websockets
|
||||||
|
Loading…
Reference in New Issue
Block a user