Fixed LUA property methods setting default values when passed nil
This commit is contained in:
parent
0f6c5da42d
commit
589064d03f
20 changed files with 46 additions and 46 deletions
|
@ -280,7 +280,7 @@ public abstract class TileEntityAbstractInterfaced extends TileEntityAbstractBas
|
||||||
|
|
||||||
protected UUID computer_getUUID(final UUID uuidDefault, final Object[] arguments) {
|
protected UUID computer_getUUID(final UUID uuidDefault, final Object[] arguments) {
|
||||||
try {
|
try {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
if (arguments[0] instanceof UUID) {
|
if (arguments[0] instanceof UUID) {
|
||||||
return (UUID) arguments[0];
|
return (UUID) arguments[0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ public class TileEntityChunkLoader extends TileEntityAbstractChunkLoading {
|
||||||
|
|
||||||
// Common OC/CC methods
|
// Common OC/CC methods
|
||||||
public Object[] enable(Object[] arguments) {
|
public Object[] enable(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
isEnabled = Commons.toBool(arguments[0]);
|
isEnabled = Commons.toBool(arguments[0]);
|
||||||
}
|
}
|
||||||
return new Object[] { isEnabled };
|
return new Object[] { isEnabled };
|
||||||
|
@ -189,7 +189,7 @@ public class TileEntityChunkLoader extends TileEntityAbstractChunkLoading {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object[] radius(Object[] arguments) {
|
public Object[] radius(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
final int radius = Commons.toInt(arguments[0]);
|
final int radius = Commons.toInt(arguments[0]);
|
||||||
setBounds(radius, radius, radius, radius);
|
setBounds(radius, radius, radius, radius);
|
||||||
}
|
}
|
||||||
|
|
|
@ -637,7 +637,7 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre
|
||||||
return new Integer[] { xCoord, yCoord, zCoord };
|
return new Integer[] { xCoord, yCoord, zCoord };
|
||||||
|
|
||||||
case "beamFrequency":
|
case "beamFrequency":
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
setBeamFrequency(Commons.toInt(arguments[0]));
|
setBeamFrequency(Commons.toInt(arguments[0]));
|
||||||
}
|
}
|
||||||
return new Integer[] { beamFrequency };
|
return new Integer[] { beamFrequency };
|
||||||
|
|
|
@ -158,7 +158,7 @@ public class TileEntityAcceleratorControlPoint extends TileEntityAbstractInterfa
|
||||||
|
|
||||||
// Common OC/CC methods
|
// Common OC/CC methods
|
||||||
public Object[] enable(Object[] arguments) {
|
public Object[] enable(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
boolean enable;
|
boolean enable;
|
||||||
try {
|
try {
|
||||||
enable = Commons.toBool(arguments[0]);
|
enable = Commons.toBool(arguments[0]);
|
||||||
|
@ -190,7 +190,7 @@ public class TileEntityAcceleratorControlPoint extends TileEntityAbstractInterfa
|
||||||
return enable(arguments);
|
return enable(arguments);
|
||||||
|
|
||||||
case "controlChannel":
|
case "controlChannel":
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
setControlChannel(Commons.toInt(arguments[0]));
|
setControlChannel(Commons.toInt(arguments[0]));
|
||||||
}
|
}
|
||||||
return new Integer[] { controlChannel };
|
return new Integer[] { controlChannel };
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class TileEntityAirGenerator extends TileEntityAbstractEnergy {
|
||||||
|
|
||||||
// Common OC/CC methods
|
// Common OC/CC methods
|
||||||
public Object[] enable(Object[] arguments) {
|
public Object[] enable(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
isEnabled = Commons.toBool(arguments[0]);
|
isEnabled = Commons.toBool(arguments[0]);
|
||||||
}
|
}
|
||||||
return new Object[] { isEnabled };
|
return new Object[] { isEnabled };
|
||||||
|
|
|
@ -153,7 +153,7 @@ public class TileEntityAirGeneratorTiered extends TileEntityAbstractEnergy {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object[] enable(Object[] arguments) {
|
public Object[] enable(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
isEnabled = Commons.toBool(arguments[0]);
|
isEnabled = Commons.toBool(arguments[0]);
|
||||||
}
|
}
|
||||||
return new Object[] { isEnabled };
|
return new Object[] { isEnabled };
|
||||||
|
|
|
@ -659,7 +659,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner {
|
||||||
|
|
||||||
private Object[] radius(Object[] arguments) {
|
private Object[] radius(Object[] arguments) {
|
||||||
try {
|
try {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
radiusX = Commons.clamp(1, WarpDriveConfig.TREE_FARM_totalMaxRadius, Commons.toInt(arguments[0]));
|
radiusX = Commons.clamp(1, WarpDriveConfig.TREE_FARM_totalMaxRadius, Commons.toInt(arguments[0]));
|
||||||
radiusZ = radiusX;
|
radiusZ = radiusX;
|
||||||
markDirty();
|
markDirty();
|
||||||
|
@ -676,7 +676,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object[] breakLeaves(Object[] arguments) {
|
private Object[] breakLeaves(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
try {
|
try {
|
||||||
breakLeaves = Commons.toBool(arguments[0]);
|
breakLeaves = Commons.toBool(arguments[0]);
|
||||||
markDirty();
|
markDirty();
|
||||||
|
@ -688,7 +688,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object[] silktouch(Object[] arguments) {
|
private Object[] silktouch(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
try {
|
try {
|
||||||
enableSilktouch = Commons.toBool(arguments[0]);
|
enableSilktouch = Commons.toBool(arguments[0]);
|
||||||
markDirty();
|
markDirty();
|
||||||
|
@ -700,7 +700,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object[] tapTrees(Object[] arguments) {
|
private Object[] tapTrees(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
try {
|
try {
|
||||||
tapTrees = Commons.toBool(arguments[0]);
|
tapTrees = Commons.toBool(arguments[0]);
|
||||||
markDirty();
|
markDirty();
|
||||||
|
|
|
@ -447,7 +447,7 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object[] onlyOres(Object[] arguments) {
|
private Object[] onlyOres(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
try {
|
try {
|
||||||
mineAllBlocks = ! Commons.toBool(arguments[0]);
|
mineAllBlocks = ! Commons.toBool(arguments[0]);
|
||||||
markDirty();
|
markDirty();
|
||||||
|
@ -462,7 +462,7 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object[] offset(Object[] arguments) {
|
private Object[] offset(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
try {
|
try {
|
||||||
layerOffset = Math.min(256, Math.abs(Commons.toInt(arguments[0])));
|
layerOffset = Math.min(256, Math.abs(Commons.toInt(arguments[0])));
|
||||||
markDirty();
|
markDirty();
|
||||||
|
@ -477,7 +477,7 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object[] silktouch(Object[] arguments) {
|
private Object[] silktouch(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
try {
|
try {
|
||||||
enableSilktouch = Commons.toBool(arguments[0]);
|
enableSilktouch = Commons.toBool(arguments[0]);
|
||||||
markDirty();
|
markDirty();
|
||||||
|
|
|
@ -148,7 +148,7 @@ public class TileEntityCamera extends TileEntityAbstractInterfaced implements IV
|
||||||
final String methodName = getMethodName(method);
|
final String methodName = getMethodName(method);
|
||||||
|
|
||||||
if (methodName.equals("videoChannel")) {
|
if (methodName.equals("videoChannel")) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
setVideoChannel(Commons.toInt(arguments[0]));
|
setVideoChannel(Commons.toInt(arguments[0]));
|
||||||
}
|
}
|
||||||
return new Integer[] { videoChannel };
|
return new Integer[] { videoChannel };
|
||||||
|
|
|
@ -471,7 +471,7 @@ public class TileEntityCloakingCore extends TileEntityAbstractEnergy {
|
||||||
|
|
||||||
// Common OC/CC methods
|
// Common OC/CC methods
|
||||||
public Object[] tier(Object[] arguments) {
|
public Object[] tier(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
int tier_new;
|
int tier_new;
|
||||||
try {
|
try {
|
||||||
tier_new = Commons.toInt(arguments[0]);
|
tier_new = Commons.toInt(arguments[0]);
|
||||||
|
@ -493,7 +493,7 @@ public class TileEntityCloakingCore extends TileEntityAbstractEnergy {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object[] enable(Object[] arguments) {
|
public Object[] enable(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
isEnabled = Commons.toBool(arguments[0]);
|
isEnabled = Commons.toBool(arguments[0]);
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class TileEntityMonitor extends TileEntityAbstractInterfaced implements I
|
||||||
final String methodName = getMethodName(method);
|
final String methodName = getMethodName(method);
|
||||||
|
|
||||||
if (methodName.equals("videoChannel")) {
|
if (methodName.equals("videoChannel")) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
setVideoChannel(Commons.toInt(arguments[0]));
|
setVideoChannel(Commons.toInt(arguments[0]));
|
||||||
}
|
}
|
||||||
return new Integer[] { videoChannel };
|
return new Integer[] { videoChannel };
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class TileEntityRadar extends TileEntityAbstractEnergy {
|
||||||
|
|
||||||
private Object[] getEnergyRequired(Object[] arguments) {
|
private Object[] getEnergyRequired(Object[] arguments) {
|
||||||
try {
|
try {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
return new Object[] { calculateEnergyRequired(Commons.toInt(arguments[0])) };
|
return new Object[] { calculateEnergyRequired(Commons.toInt(arguments[0])) };
|
||||||
}
|
}
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
|
@ -143,7 +143,7 @@ public class TileEntityRadar extends TileEntityAbstractEnergy {
|
||||||
|
|
||||||
private Object[] getScanDuration(Object[] arguments) {
|
private Object[] getScanDuration(Object[] arguments) {
|
||||||
try {
|
try {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
return new Object[] { 0.050D * calculateScanDuration(Commons.toInt(arguments[0])) };
|
return new Object[] { 0.050D * calculateScanDuration(Commons.toInt(arguments[0])) };
|
||||||
}
|
}
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
|
|
|
@ -380,7 +380,7 @@ public class TileEntityEnanReactorCore extends TileEntityAbstractEnergy implemen
|
||||||
// Common OC/CC methods
|
// Common OC/CC methods
|
||||||
@Override
|
@Override
|
||||||
public Object[] enable(Object[] arguments) {
|
public Object[] enable(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
boolean enableRequest;
|
boolean enableRequest;
|
||||||
try {
|
try {
|
||||||
enableRequest = Commons.toBool(arguments[0]);
|
enableRequest = Commons.toBool(arguments[0]);
|
||||||
|
@ -419,7 +419,7 @@ public class TileEntityEnanReactorCore extends TileEntityAbstractEnergy implemen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] instabilityTarget(Object[] arguments) {
|
public Object[] instabilityTarget(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
double instabilityTargetRequested;
|
double instabilityTargetRequested;
|
||||||
try {
|
try {
|
||||||
instabilityTargetRequested = Commons.toDouble(arguments[0]);
|
instabilityTargetRequested = Commons.toDouble(arguments[0]);
|
||||||
|
@ -437,7 +437,7 @@ public class TileEntityEnanReactorCore extends TileEntityAbstractEnergy implemen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] release(Object[] arguments) {
|
public Object[] release(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
boolean releaseRequested;
|
boolean releaseRequested;
|
||||||
try {
|
try {
|
||||||
releaseRequested = Commons.toBool(arguments[0]);
|
releaseRequested = Commons.toBool(arguments[0]);
|
||||||
|
@ -457,7 +457,7 @@ public class TileEntityEnanReactorCore extends TileEntityAbstractEnergy implemen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] releaseRate(Object[] arguments) {
|
public Object[] releaseRate(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
int releaseRateRequested;
|
int releaseRateRequested;
|
||||||
try {
|
try {
|
||||||
releaseRateRequested = Commons.toInt(arguments[0]);
|
releaseRateRequested = Commons.toInt(arguments[0]);
|
||||||
|
@ -505,7 +505,7 @@ public class TileEntityEnanReactorCore extends TileEntityAbstractEnergy implemen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] stabilizerEnergy(Object[] arguments) {
|
public Object[] stabilizerEnergy(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
int stabilizerEnergyRequested;
|
int stabilizerEnergyRequested;
|
||||||
try {
|
try {
|
||||||
stabilizerEnergyRequested = Commons.toInt(arguments[0]);
|
stabilizerEnergyRequested = Commons.toInt(arguments[0]);
|
||||||
|
|
|
@ -155,7 +155,7 @@ public class TileEntityAbstractForceField extends TileEntityAbstractEnergy imple
|
||||||
|
|
||||||
// Common OC/CC methods
|
// Common OC/CC methods
|
||||||
public Object[] enable(Object[] arguments) {
|
public Object[] enable(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
boolean enable;
|
boolean enable;
|
||||||
try {
|
try {
|
||||||
enable = Commons.toBool(arguments[0]);
|
enable = Commons.toBool(arguments[0]);
|
||||||
|
@ -182,7 +182,7 @@ public class TileEntityAbstractForceField extends TileEntityAbstractEnergy imple
|
||||||
return enable(arguments);
|
return enable(arguments);
|
||||||
|
|
||||||
case "beamFrequency":
|
case "beamFrequency":
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
setBeamFrequency(Commons.toInt(arguments[0]));
|
setBeamFrequency(Commons.toInt(arguments[0]));
|
||||||
}
|
}
|
||||||
return new Integer[] { beamFrequency };
|
return new Integer[] { beamFrequency };
|
||||||
|
|
|
@ -1093,7 +1093,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField
|
||||||
|
|
||||||
switch (methodName) {
|
switch (methodName) {
|
||||||
case "min":
|
case "min":
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
setMin(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[0]), Commons.toFloat(arguments[0]));
|
setMin(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[0]), Commons.toFloat(arguments[0]));
|
||||||
} else if (arguments.length == 2) {
|
} else if (arguments.length == 2) {
|
||||||
setMin(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[1]), Commons.toFloat(arguments[0]));
|
setMin(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[1]), Commons.toFloat(arguments[0]));
|
||||||
|
@ -1103,7 +1103,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField
|
||||||
return new Double[] { v3Min.x, v3Min.y, v3Min.z };
|
return new Double[] { v3Min.x, v3Min.y, v3Min.z };
|
||||||
|
|
||||||
case "max":
|
case "max":
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
setMax(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[0]), Commons.toFloat(arguments[0]));
|
setMax(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[0]), Commons.toFloat(arguments[0]));
|
||||||
} else if (arguments.length == 2) {
|
} else if (arguments.length == 2) {
|
||||||
setMax(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[1]), Commons.toFloat(arguments[0]));
|
setMax(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[1]), Commons.toFloat(arguments[0]));
|
||||||
|
@ -1113,7 +1113,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField
|
||||||
return new Double[] { v3Max.x, v3Max.y, v3Max.z };
|
return new Double[] { v3Max.x, v3Max.y, v3Max.z };
|
||||||
|
|
||||||
case "rotation":
|
case "rotation":
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
setRotation(Commons.toFloat(arguments[0]), rotationPitch, rotationRoll);
|
setRotation(Commons.toFloat(arguments[0]), rotationPitch, rotationRoll);
|
||||||
} else if (arguments.length == 2) {
|
} else if (arguments.length == 2) {
|
||||||
setRotation(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[1]), rotationRoll);
|
setRotation(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[1]), rotationRoll);
|
||||||
|
@ -1126,7 +1126,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField
|
||||||
return state();
|
return state();
|
||||||
|
|
||||||
case "translation":
|
case "translation":
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
setTranslation(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[0]), Commons.toFloat(arguments[0]));
|
setTranslation(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[0]), Commons.toFloat(arguments[0]));
|
||||||
} else if (arguments.length == 2) {
|
} else if (arguments.length == 2) {
|
||||||
setTranslation(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[1]), Commons.toFloat(arguments[0]));
|
setTranslation(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[1]), Commons.toFloat(arguments[0]));
|
||||||
|
|
|
@ -216,7 +216,7 @@ public class TileEntityLift extends TileEntityAbstractEnergy implements ILift {
|
||||||
// Common OC/CC methods
|
// Common OC/CC methods
|
||||||
@Override
|
@Override
|
||||||
public Object[] enable(Object[] arguments) {
|
public Object[] enable(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
isEnabled = Commons.toBool(arguments[0]);
|
isEnabled = Commons.toBool(arguments[0]);
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -450,7 +450,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced imple
|
||||||
if (tileEntityShipCore == null) {
|
if (tileEntityShipCore == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
final String shipNamePrevious = tileEntityShipCore.shipName;
|
final String shipNamePrevious = tileEntityShipCore.shipName;
|
||||||
tileEntityShipCore.shipName = Commons.sanitizeFileName((String) arguments[0]);
|
tileEntityShipCore.shipName = Commons.sanitizeFileName((String) arguments[0]);
|
||||||
if ( tileEntityShipCore.shipName == null
|
if ( tileEntityShipCore.shipName == null
|
||||||
|
@ -534,7 +534,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced imple
|
||||||
@Override
|
@Override
|
||||||
public Object[] command(Object[] arguments) {
|
public Object[] command(Object[] arguments) {
|
||||||
try {
|
try {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
setCommand(arguments[0].toString());
|
setCommand(arguments[0].toString());
|
||||||
}
|
}
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
|
@ -546,7 +546,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced imple
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] enable(Object[] arguments) {
|
public Object[] enable(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
isEnabled = Commons.toBool(arguments[0]);
|
isEnabled = Commons.toBool(arguments[0]);
|
||||||
if (WarpDriveConfig.LOGGING_LUA) {
|
if (WarpDriveConfig.LOGGING_LUA) {
|
||||||
WarpDrive.logger.info(this + " enable(" + isEnabled + ")");
|
WarpDrive.logger.info(this + " enable(" + isEnabled + ")");
|
||||||
|
@ -595,7 +595,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced imple
|
||||||
@Override
|
@Override
|
||||||
public Object[] rotationSteps(Object[] arguments) {
|
public Object[] rotationSteps(Object[] arguments) {
|
||||||
try {
|
try {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
setRotationSteps((byte) Commons.toInt(arguments[0]));
|
setRotationSteps((byte) Commons.toInt(arguments[0]));
|
||||||
}
|
}
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
|
@ -607,7 +607,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced imple
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] targetName(Object[] arguments) {
|
public Object[] targetName(Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
this.nameTarget = (String) arguments[0];
|
this.nameTarget = (String) arguments[0];
|
||||||
}
|
}
|
||||||
return new Object[] { nameTarget };
|
return new Object[] { nameTarget };
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class TileEntityTransporterBeacon extends TileEntityAbstractEnergy implem
|
||||||
// Common OC/CC methods
|
// Common OC/CC methods
|
||||||
@Override
|
@Override
|
||||||
public Boolean[] enable(final Object[] arguments) {
|
public Boolean[] enable(final Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
isEnabled = Commons.toBool(arguments[0]);
|
isEnabled = Commons.toBool(arguments[0]);
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1470,7 +1470,7 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergy implemen
|
||||||
// Common OC/CC methods
|
// Common OC/CC methods
|
||||||
@Override
|
@Override
|
||||||
public String[] transporterName(final Object[] arguments) {
|
public String[] transporterName(final Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
final String transporterNameNew = arguments[0].toString();
|
final String transporterNameNew = arguments[0].toString();
|
||||||
if (!transporterName.equals(transporterNameNew)) {
|
if (!transporterName.equals(transporterNameNew)) {
|
||||||
transporterName = transporterNameNew;
|
transporterName = transporterNameNew;
|
||||||
|
@ -1482,7 +1482,7 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergy implemen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean[] enable(final Object[] arguments) {
|
public Boolean[] enable(final Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
isEnabled = Commons.toBool(arguments[0]);
|
isEnabled = Commons.toBool(arguments[0]);
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
|
@ -1514,7 +1514,7 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergy implemen
|
||||||
tickUpdateParameters = 0;
|
tickUpdateParameters = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (arguments.length == 1) {
|
} else if (arguments.length == 1 && arguments[0] != null) {
|
||||||
// is it a UUID?
|
// is it a UUID?
|
||||||
final UUID uuidNew = computer_getUUID(null, arguments);
|
final UUID uuidNew = computer_getUUID(null, arguments);
|
||||||
if (uuidNew != null) {
|
if (uuidNew != null) {
|
||||||
|
@ -1547,7 +1547,7 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergy implemen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean[] lock(final Object[] arguments) {
|
public Boolean[] lock(final Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
isLockRequested = Commons.toBool(arguments[0]);
|
isLockRequested = Commons.toBool(arguments[0]);
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
|
@ -1579,7 +1579,7 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergy implemen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean[] energize(final Object[] arguments) {
|
public Boolean[] energize(final Object[] arguments) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
isEnergizeRequested = Commons.toBool(arguments[0]);
|
isEnergizeRequested = Commons.toBool(arguments[0]);
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
|
@ -1658,7 +1658,7 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergy implemen
|
||||||
|
|
||||||
switch (methodName) {
|
switch (methodName) {
|
||||||
case "beamFrequency":
|
case "beamFrequency":
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
setBeamFrequency(Commons.toInt(arguments[0]));
|
setBeamFrequency(Commons.toInt(arguments[0]));
|
||||||
}
|
}
|
||||||
return new Integer[] { beamFrequency };
|
return new Integer[] { beamFrequency };
|
||||||
|
|
|
@ -138,7 +138,7 @@ public class TileEntityLaserCamera extends TileEntityLaser implements IVideoChan
|
||||||
final String methodName = getMethodName(method);
|
final String methodName = getMethodName(method);
|
||||||
|
|
||||||
if (methodName.equals("videoChannel")) {
|
if (methodName.equals("videoChannel")) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1 && arguments[0] != null) {
|
||||||
setVideoChannel(Commons.toInt(arguments[0]));
|
setVideoChannel(Commons.toInt(arguments[0]));
|
||||||
}
|
}
|
||||||
return new Integer[] { videoChannel };
|
return new Integer[] { videoChannel };
|
||||||
|
|
Loading…
Reference in a new issue