mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-04-16 07:43:20 +00:00
Add config option to disable certain error messages
This commit is contained in:
parent
a0b6cbb671
commit
efb0065ebd
@ -107,6 +107,7 @@ public class ComputerCraft
|
||||
public static String http_whitelist = "*";
|
||||
public static boolean disable_lua51_features = false;
|
||||
public static String default_computer_settings = "";
|
||||
public static boolean logPeripheralErrors = true;
|
||||
|
||||
public static boolean enableCommandBlock = false;
|
||||
public static boolean turtlesNeedFuel = true;
|
||||
@ -180,6 +181,7 @@ public class ComputerCraft
|
||||
public static Property http_whitelist;
|
||||
public static Property disable_lua51_features;
|
||||
public static Property default_computer_settings;
|
||||
public static Property logPeripheralErrors;
|
||||
|
||||
public static Property enableCommandBlock;
|
||||
public static Property turtlesNeedFuel;
|
||||
@ -253,6 +255,10 @@ public class ComputerCraft
|
||||
Config.default_computer_settings = Config.config.get( Configuration.CATEGORY_GENERAL, "default_computer_settings", default_computer_settings );
|
||||
Config.default_computer_settings.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" );
|
||||
|
||||
Config.logPeripheralErrors = Config.config.get( Configuration.CATEGORY_GENERAL, "logPeripheralErrors", logPeripheralErrors );
|
||||
Config.logPeripheralErrors.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." );
|
||||
|
||||
Config.enableCommandBlock = Config.config.get( Configuration.CATEGORY_GENERAL, "enableCommandBlock", enableCommandBlock );
|
||||
Config.enableCommandBlock.setComment( "Enable Command Block peripheral support" );
|
||||
|
||||
|
@ -140,7 +140,7 @@ public class ComputerThread
|
||||
// Step 3: abandon
|
||||
if( worker.isAlive() )
|
||||
{
|
||||
ComputerCraft.log.warn( "Failed to abort Computer " + computer.getID() + ". Dangling lua thread could cause errors." );
|
||||
// ComputerCraft.log.warn( "Failed to abort Computer " + computer.getID() + ". Dangling lua thread could cause errors." );
|
||||
worker.interrupt();
|
||||
}
|
||||
}
|
||||
|
@ -415,7 +415,10 @@ public class LuaJLuaMachine implements ILuaMachine
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
ComputerCraft.log.error( "Error running task", t);
|
||||
if( ComputerCraft.logPeripheralErrors )
|
||||
{
|
||||
ComputerCraft.log.error( "Error running task", t );
|
||||
}
|
||||
m_computer.queueEvent( "task_complete", new Object[] {
|
||||
taskID, false, "Java Exception Thrown: " + t.toString()
|
||||
} );
|
||||
@ -482,7 +485,10 @@ public class LuaJLuaMachine implements ILuaMachine
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
ComputerCraft.log.error( "Error calling " + methodName + " on " + apiObject, t );
|
||||
if( ComputerCraft.logPeripheralErrors )
|
||||
{
|
||||
ComputerCraft.log.error( "Error calling " + methodName + " on " + apiObject, t );
|
||||
}
|
||||
throw new LuaError( "Java Exception Thrown: " + t.toString(), 0 );
|
||||
}
|
||||
return LuaValue.varargsOf( toValues( results, 0 ) );
|
||||
|
@ -99,7 +99,10 @@ public class CommandAPI implements ILuaAPI
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
ComputerCraft.log.error( "Error running command.", t );
|
||||
if( ComputerCraft.logPeripheralErrors )
|
||||
{
|
||||
ComputerCraft.log.error( "Error running command.", t );
|
||||
}
|
||||
return new Object[]{ false, createOutput( "Java Exception Thrown: " + t.toString() ) };
|
||||
}
|
||||
}
|
||||
@ -210,7 +213,10 @@ public class CommandAPI implements ILuaAPI
|
||||
catch( Throwable t )
|
||||
{
|
||||
// Ignore buggy command
|
||||
ComputerCraft.log.error( "Error running command.", t );
|
||||
if( ComputerCraft.logPeripheralErrors )
|
||||
{
|
||||
ComputerCraft.log.error( "Error running command.", t );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public abstract class CCTurtleProxyCommon implements ICCTurtleProxy
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
ComputerCraft.log.error("Error checking stackability of items", e);
|
||||
ComputerCraft.log.error("Error getting computer upgrade item", e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -44,6 +44,7 @@ gui.computercraft:config.http_enable=Enable HTTP API
|
||||
gui.computercraft:config.http_whitelist=HTTP whitelist
|
||||
gui.computercraft:config.disable_lua51_features=Disable Lua 5.1 features
|
||||
gui.computercraft:config.default_computer_settings=Default Computer settings
|
||||
gui.computercraft:config.log_peripheral_errors=Log peripheral errors
|
||||
gui.computercraft:config.enable_command_block=Enable command block peripheral
|
||||
gui.computercraft:config.modem_range=Modem range (default)
|
||||
gui.computercraft:config.modem_high_altitude_range=Modem range (high-altitude)
|
||||
|
Loading…
x
Reference in New Issue
Block a user