From 589064d03f0928642bc9b1d1f9a9b383dad2eb1c Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 26 Apr 2018 22:29:36 +0200 Subject: [PATCH] Fixed LUA property methods setting default values when passed nil --- .../block/TileEntityAbstractInterfaced.java | 2 +- .../cr0s/warpdrive/block/TileEntityChunkLoader.java | 4 ++-- .../java/cr0s/warpdrive/block/TileEntityLaser.java | 2 +- .../atomic/TileEntityAcceleratorControlPoint.java | 4 ++-- .../block/breathing/TileEntityAirGenerator.java | 2 +- .../breathing/TileEntityAirGeneratorTiered.java | 2 +- .../block/collection/TileEntityLaserTreeFarm.java | 8 ++++---- .../block/collection/TileEntityMiningLaser.java | 6 +++--- .../warpdrive/block/detection/TileEntityCamera.java | 2 +- .../block/detection/TileEntityCloakingCore.java | 4 ++-- .../warpdrive/block/detection/TileEntityMonitor.java | 2 +- .../warpdrive/block/detection/TileEntityRadar.java | 4 ++-- .../block/energy/TileEntityEnanReactorCore.java | 10 +++++----- .../forcefield/TileEntityAbstractForceField.java | 4 ++-- .../forcefield/TileEntityForceFieldProjector.java | 8 ++++---- .../warpdrive/block/movement/TileEntityLift.java | 2 +- .../block/movement/TileEntityShipController.java | 10 +++++----- .../block/movement/TileEntityTransporterBeacon.java | 2 +- .../block/movement/TileEntityTransporterCore.java | 12 ++++++------ .../block/weapon/TileEntityLaserCamera.java | 2 +- 20 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/main/java/cr0s/warpdrive/block/TileEntityAbstractInterfaced.java b/src/main/java/cr0s/warpdrive/block/TileEntityAbstractInterfaced.java index 5150a380..34f0f66e 100644 --- a/src/main/java/cr0s/warpdrive/block/TileEntityAbstractInterfaced.java +++ b/src/main/java/cr0s/warpdrive/block/TileEntityAbstractInterfaced.java @@ -280,7 +280,7 @@ public abstract class TileEntityAbstractInterfaced extends TileEntityAbstractBas protected UUID computer_getUUID(final UUID uuidDefault, final Object[] arguments) { try { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { if (arguments[0] instanceof UUID) { return (UUID) arguments[0]; } diff --git a/src/main/java/cr0s/warpdrive/block/TileEntityChunkLoader.java b/src/main/java/cr0s/warpdrive/block/TileEntityChunkLoader.java index e585e9ed..8f7370f3 100644 --- a/src/main/java/cr0s/warpdrive/block/TileEntityChunkLoader.java +++ b/src/main/java/cr0s/warpdrive/block/TileEntityChunkLoader.java @@ -175,7 +175,7 @@ public class TileEntityChunkLoader extends TileEntityAbstractChunkLoading { // Common OC/CC methods public Object[] enable(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { isEnabled = Commons.toBool(arguments[0]); } return new Object[] { isEnabled }; @@ -189,7 +189,7 @@ public class TileEntityChunkLoader extends TileEntityAbstractChunkLoading { } public Object[] radius(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { final int radius = Commons.toInt(arguments[0]); setBounds(radius, radius, radius, radius); } diff --git a/src/main/java/cr0s/warpdrive/block/TileEntityLaser.java b/src/main/java/cr0s/warpdrive/block/TileEntityLaser.java index f278bc5a..76abda65 100644 --- a/src/main/java/cr0s/warpdrive/block/TileEntityLaser.java +++ b/src/main/java/cr0s/warpdrive/block/TileEntityLaser.java @@ -637,7 +637,7 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre return new Integer[] { xCoord, yCoord, zCoord }; case "beamFrequency": - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { setBeamFrequency(Commons.toInt(arguments[0])); } return new Integer[] { beamFrequency }; diff --git a/src/main/java/cr0s/warpdrive/block/atomic/TileEntityAcceleratorControlPoint.java b/src/main/java/cr0s/warpdrive/block/atomic/TileEntityAcceleratorControlPoint.java index 326f6722..e3a72fc4 100644 --- a/src/main/java/cr0s/warpdrive/block/atomic/TileEntityAcceleratorControlPoint.java +++ b/src/main/java/cr0s/warpdrive/block/atomic/TileEntityAcceleratorControlPoint.java @@ -158,7 +158,7 @@ public class TileEntityAcceleratorControlPoint extends TileEntityAbstractInterfa // Common OC/CC methods public Object[] enable(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { boolean enable; try { enable = Commons.toBool(arguments[0]); @@ -190,7 +190,7 @@ public class TileEntityAcceleratorControlPoint extends TileEntityAbstractInterfa return enable(arguments); case "controlChannel": - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { setControlChannel(Commons.toInt(arguments[0])); } return new Integer[] { controlChannel }; diff --git a/src/main/java/cr0s/warpdrive/block/breathing/TileEntityAirGenerator.java b/src/main/java/cr0s/warpdrive/block/breathing/TileEntityAirGenerator.java index 2e2bbff7..f74e78da 100644 --- a/src/main/java/cr0s/warpdrive/block/breathing/TileEntityAirGenerator.java +++ b/src/main/java/cr0s/warpdrive/block/breathing/TileEntityAirGenerator.java @@ -132,7 +132,7 @@ public class TileEntityAirGenerator extends TileEntityAbstractEnergy { // Common OC/CC methods public Object[] enable(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { isEnabled = Commons.toBool(arguments[0]); } return new Object[] { isEnabled }; diff --git a/src/main/java/cr0s/warpdrive/block/breathing/TileEntityAirGeneratorTiered.java b/src/main/java/cr0s/warpdrive/block/breathing/TileEntityAirGeneratorTiered.java index d31694e6..3d4923fb 100644 --- a/src/main/java/cr0s/warpdrive/block/breathing/TileEntityAirGeneratorTiered.java +++ b/src/main/java/cr0s/warpdrive/block/breathing/TileEntityAirGeneratorTiered.java @@ -153,7 +153,7 @@ public class TileEntityAirGeneratorTiered extends TileEntityAbstractEnergy { } public Object[] enable(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { isEnabled = Commons.toBool(arguments[0]); } return new Object[] { isEnabled }; diff --git a/src/main/java/cr0s/warpdrive/block/collection/TileEntityLaserTreeFarm.java b/src/main/java/cr0s/warpdrive/block/collection/TileEntityLaserTreeFarm.java index 8931977a..bdd2a2ad 100644 --- a/src/main/java/cr0s/warpdrive/block/collection/TileEntityLaserTreeFarm.java +++ b/src/main/java/cr0s/warpdrive/block/collection/TileEntityLaserTreeFarm.java @@ -659,7 +659,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner { private Object[] radius(Object[] arguments) { try { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { radiusX = Commons.clamp(1, WarpDriveConfig.TREE_FARM_totalMaxRadius, Commons.toInt(arguments[0])); radiusZ = radiusX; markDirty(); @@ -676,7 +676,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner { } private Object[] breakLeaves(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { try { breakLeaves = Commons.toBool(arguments[0]); markDirty(); @@ -688,7 +688,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner { } private Object[] silktouch(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { try { enableSilktouch = Commons.toBool(arguments[0]); markDirty(); @@ -700,7 +700,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner { } private Object[] tapTrees(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { try { tapTrees = Commons.toBool(arguments[0]); markDirty(); diff --git a/src/main/java/cr0s/warpdrive/block/collection/TileEntityMiningLaser.java b/src/main/java/cr0s/warpdrive/block/collection/TileEntityMiningLaser.java index ef33b710..bc375e5a 100644 --- a/src/main/java/cr0s/warpdrive/block/collection/TileEntityMiningLaser.java +++ b/src/main/java/cr0s/warpdrive/block/collection/TileEntityMiningLaser.java @@ -447,7 +447,7 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner { } private Object[] onlyOres(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { try { mineAllBlocks = ! Commons.toBool(arguments[0]); markDirty(); @@ -462,7 +462,7 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner { } private Object[] offset(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { try { layerOffset = Math.min(256, Math.abs(Commons.toInt(arguments[0]))); markDirty(); @@ -477,7 +477,7 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner { } private Object[] silktouch(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { try { enableSilktouch = Commons.toBool(arguments[0]); markDirty(); diff --git a/src/main/java/cr0s/warpdrive/block/detection/TileEntityCamera.java b/src/main/java/cr0s/warpdrive/block/detection/TileEntityCamera.java index 4c96cdc9..3e1a2dd7 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/TileEntityCamera.java +++ b/src/main/java/cr0s/warpdrive/block/detection/TileEntityCamera.java @@ -148,7 +148,7 @@ public class TileEntityCamera extends TileEntityAbstractInterfaced implements IV final String methodName = getMethodName(method); if (methodName.equals("videoChannel")) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { setVideoChannel(Commons.toInt(arguments[0])); } return new Integer[] { videoChannel }; diff --git a/src/main/java/cr0s/warpdrive/block/detection/TileEntityCloakingCore.java b/src/main/java/cr0s/warpdrive/block/detection/TileEntityCloakingCore.java index ee1a22c7..e9ee2151 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/TileEntityCloakingCore.java +++ b/src/main/java/cr0s/warpdrive/block/detection/TileEntityCloakingCore.java @@ -471,7 +471,7 @@ public class TileEntityCloakingCore extends TileEntityAbstractEnergy { // Common OC/CC methods public Object[] tier(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { int tier_new; try { tier_new = Commons.toInt(arguments[0]); @@ -493,7 +493,7 @@ public class TileEntityCloakingCore extends TileEntityAbstractEnergy { } public Object[] enable(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { isEnabled = Commons.toBool(arguments[0]); markDirty(); } diff --git a/src/main/java/cr0s/warpdrive/block/detection/TileEntityMonitor.java b/src/main/java/cr0s/warpdrive/block/detection/TileEntityMonitor.java index 5a738c34..7cc67278 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/TileEntityMonitor.java +++ b/src/main/java/cr0s/warpdrive/block/detection/TileEntityMonitor.java @@ -108,7 +108,7 @@ public class TileEntityMonitor extends TileEntityAbstractInterfaced implements I final String methodName = getMethodName(method); if (methodName.equals("videoChannel")) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { setVideoChannel(Commons.toInt(arguments[0])); } return new Integer[] { videoChannel }; diff --git a/src/main/java/cr0s/warpdrive/block/detection/TileEntityRadar.java b/src/main/java/cr0s/warpdrive/block/detection/TileEntityRadar.java index 3eb9c945..f9f43a51 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/TileEntityRadar.java +++ b/src/main/java/cr0s/warpdrive/block/detection/TileEntityRadar.java @@ -132,7 +132,7 @@ public class TileEntityRadar extends TileEntityAbstractEnergy { private Object[] getEnergyRequired(Object[] arguments) { try { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { return new Object[] { calculateEnergyRequired(Commons.toInt(arguments[0])) }; } } catch (Exception exception) { @@ -143,7 +143,7 @@ public class TileEntityRadar extends TileEntityAbstractEnergy { private Object[] getScanDuration(Object[] arguments) { try { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { return new Object[] { 0.050D * calculateScanDuration(Commons.toInt(arguments[0])) }; } } catch (Exception exception) { diff --git a/src/main/java/cr0s/warpdrive/block/energy/TileEntityEnanReactorCore.java b/src/main/java/cr0s/warpdrive/block/energy/TileEntityEnanReactorCore.java index 6adaed54..6b5c00cb 100644 --- a/src/main/java/cr0s/warpdrive/block/energy/TileEntityEnanReactorCore.java +++ b/src/main/java/cr0s/warpdrive/block/energy/TileEntityEnanReactorCore.java @@ -380,7 +380,7 @@ public class TileEntityEnanReactorCore extends TileEntityAbstractEnergy implemen // Common OC/CC methods @Override public Object[] enable(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { boolean enableRequest; try { enableRequest = Commons.toBool(arguments[0]); @@ -419,7 +419,7 @@ public class TileEntityEnanReactorCore extends TileEntityAbstractEnergy implemen @Override public Object[] instabilityTarget(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { double instabilityTargetRequested; try { instabilityTargetRequested = Commons.toDouble(arguments[0]); @@ -437,7 +437,7 @@ public class TileEntityEnanReactorCore extends TileEntityAbstractEnergy implemen @Override public Object[] release(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { boolean releaseRequested; try { releaseRequested = Commons.toBool(arguments[0]); @@ -457,7 +457,7 @@ public class TileEntityEnanReactorCore extends TileEntityAbstractEnergy implemen @Override public Object[] releaseRate(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { int releaseRateRequested; try { releaseRateRequested = Commons.toInt(arguments[0]); @@ -505,7 +505,7 @@ public class TileEntityEnanReactorCore extends TileEntityAbstractEnergy implemen @Override public Object[] stabilizerEnergy(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { int stabilizerEnergyRequested; try { stabilizerEnergyRequested = Commons.toInt(arguments[0]); diff --git a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityAbstractForceField.java b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityAbstractForceField.java index 0b757565..84265c8f 100644 --- a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityAbstractForceField.java +++ b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityAbstractForceField.java @@ -155,7 +155,7 @@ public class TileEntityAbstractForceField extends TileEntityAbstractEnergy imple // Common OC/CC methods public Object[] enable(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { boolean enable; try { enable = Commons.toBool(arguments[0]); @@ -182,7 +182,7 @@ public class TileEntityAbstractForceField extends TileEntityAbstractEnergy imple return enable(arguments); case "beamFrequency": - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { setBeamFrequency(Commons.toInt(arguments[0])); } return new Integer[] { beamFrequency }; diff --git a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceFieldProjector.java b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceFieldProjector.java index a7549d26..640872c9 100644 --- a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceFieldProjector.java +++ b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceFieldProjector.java @@ -1093,7 +1093,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField switch (methodName) { 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])); } else if (arguments.length == 2) { 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 }; 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])); } else if (arguments.length == 2) { 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 }; case "rotation": - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { setRotation(Commons.toFloat(arguments[0]), rotationPitch, rotationRoll); } else if (arguments.length == 2) { setRotation(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[1]), rotationRoll); @@ -1126,7 +1126,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField return state(); 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])); } else if (arguments.length == 2) { setTranslation(Commons.toFloat(arguments[0]), Commons.toFloat(arguments[1]), Commons.toFloat(arguments[0])); diff --git a/src/main/java/cr0s/warpdrive/block/movement/TileEntityLift.java b/src/main/java/cr0s/warpdrive/block/movement/TileEntityLift.java index 9938f3f2..b9263899 100644 --- a/src/main/java/cr0s/warpdrive/block/movement/TileEntityLift.java +++ b/src/main/java/cr0s/warpdrive/block/movement/TileEntityLift.java @@ -216,7 +216,7 @@ public class TileEntityLift extends TileEntityAbstractEnergy implements ILift { // Common OC/CC methods @Override public Object[] enable(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { isEnabled = Commons.toBool(arguments[0]); markDirty(); } diff --git a/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipController.java b/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipController.java index d417e485..598c7b66 100644 --- a/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipController.java +++ b/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipController.java @@ -450,7 +450,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced imple if (tileEntityShipCore == null) { return null; } - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { final String shipNamePrevious = tileEntityShipCore.shipName; tileEntityShipCore.shipName = Commons.sanitizeFileName((String) arguments[0]); if ( tileEntityShipCore.shipName == null @@ -534,7 +534,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced imple @Override public Object[] command(Object[] arguments) { try { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { setCommand(arguments[0].toString()); } } catch (Exception exception) { @@ -546,7 +546,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced imple @Override public Object[] enable(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { isEnabled = Commons.toBool(arguments[0]); if (WarpDriveConfig.LOGGING_LUA) { WarpDrive.logger.info(this + " enable(" + isEnabled + ")"); @@ -595,7 +595,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced imple @Override public Object[] rotationSteps(Object[] arguments) { try { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { setRotationSteps((byte) Commons.toInt(arguments[0])); } } catch (Exception exception) { @@ -607,7 +607,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced imple @Override public Object[] targetName(Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { this.nameTarget = (String) arguments[0]; } return new Object[] { nameTarget }; diff --git a/src/main/java/cr0s/warpdrive/block/movement/TileEntityTransporterBeacon.java b/src/main/java/cr0s/warpdrive/block/movement/TileEntityTransporterBeacon.java index bc40233d..9db320e5 100644 --- a/src/main/java/cr0s/warpdrive/block/movement/TileEntityTransporterBeacon.java +++ b/src/main/java/cr0s/warpdrive/block/movement/TileEntityTransporterBeacon.java @@ -126,7 +126,7 @@ public class TileEntityTransporterBeacon extends TileEntityAbstractEnergy implem // Common OC/CC methods @Override public Boolean[] enable(final Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { isEnabled = Commons.toBool(arguments[0]); markDirty(); } diff --git a/src/main/java/cr0s/warpdrive/block/movement/TileEntityTransporterCore.java b/src/main/java/cr0s/warpdrive/block/movement/TileEntityTransporterCore.java index 9ee6bd9f..6a1f8786 100644 --- a/src/main/java/cr0s/warpdrive/block/movement/TileEntityTransporterCore.java +++ b/src/main/java/cr0s/warpdrive/block/movement/TileEntityTransporterCore.java @@ -1470,7 +1470,7 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergy implemen // Common OC/CC methods @Override public String[] transporterName(final Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { final String transporterNameNew = arguments[0].toString(); if (!transporterName.equals(transporterNameNew)) { transporterName = transporterNameNew; @@ -1482,7 +1482,7 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergy implemen @Override public Boolean[] enable(final Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { isEnabled = Commons.toBool(arguments[0]); markDirty(); } @@ -1514,7 +1514,7 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergy implemen tickUpdateParameters = 0; } } - } else if (arguments.length == 1) { + } else if (arguments.length == 1 && arguments[0] != null) { // is it a UUID? final UUID uuidNew = computer_getUUID(null, arguments); if (uuidNew != null) { @@ -1547,7 +1547,7 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergy implemen @Override public Boolean[] lock(final Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { isLockRequested = Commons.toBool(arguments[0]); markDirty(); } @@ -1579,7 +1579,7 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergy implemen @Override public Boolean[] energize(final Object[] arguments) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { isEnergizeRequested = Commons.toBool(arguments[0]); markDirty(); } @@ -1658,7 +1658,7 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergy implemen switch (methodName) { case "beamFrequency": - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { setBeamFrequency(Commons.toInt(arguments[0])); } return new Integer[] { beamFrequency }; diff --git a/src/main/java/cr0s/warpdrive/block/weapon/TileEntityLaserCamera.java b/src/main/java/cr0s/warpdrive/block/weapon/TileEntityLaserCamera.java index 0cf2c52a..c536d922 100644 --- a/src/main/java/cr0s/warpdrive/block/weapon/TileEntityLaserCamera.java +++ b/src/main/java/cr0s/warpdrive/block/weapon/TileEntityLaserCamera.java @@ -138,7 +138,7 @@ public class TileEntityLaserCamera extends TileEntityLaser implements IVideoChan final String methodName = getMethodName(method); if (methodName.equals("videoChannel")) { - if (arguments.length == 1) { + if (arguments.length == 1 && arguments[0] != null) { setVideoChannel(Commons.toInt(arguments[0])); } return new Integer[] { videoChannel };