diff --git a/src/main/java/com/vandendaelen/handles/blocks/tiles/TardisInterfaceTile.java b/src/main/java/com/vandendaelen/handles/blocks/tiles/TardisInterfaceTile.java index 5a3fcd6..90bb219 100644 --- a/src/main/java/com/vandendaelen/handles/blocks/tiles/TardisInterfaceTile.java +++ b/src/main/java/com/vandendaelen/handles/blocks/tiles/TardisInterfaceTile.java @@ -124,14 +124,17 @@ public Object[] getDimension() throws NotATardisException { public Object[] setDoors(String status) throws NotATardisException { ConsoleTile tardis = getTardis(); this.getWorld().getServer().enqueue(new TickDelayedTask(1, ()->{ - tardis.getDoor().setOpenState(EnumDoorState.valueOf(status)); - tardis.getDoor().openOther(); + tardis.getDoor().ifPresent(doorEntity -> { + doorEntity.setOpenState(EnumDoorState.valueOf(status)); + doorEntity.openOther(); + }); + })); return null; } public Object[] getDoors() throws NotATardisException { - return new String[]{getTardis().getDoor().getOpenState().name()}; + return new String[]{getTardis().getDoor().orElseThrow(NullPointerException::new).getOpenState().name()}; } public Object[] setFacing(String status) throws NotATardisException { diff --git a/src/main/java/com/vandendaelen/handles/misc/TardisInterfacePeripheral.java b/src/main/java/com/vandendaelen/handles/misc/TardisInterfacePeripheral.java index 57ec9a8..50e94d2 100644 --- a/src/main/java/com/vandendaelen/handles/misc/TardisInterfacePeripheral.java +++ b/src/main/java/com/vandendaelen/handles/misc/TardisInterfacePeripheral.java @@ -1,8 +1,6 @@ package com.vandendaelen.handles.misc; import com.vandendaelen.handles.blocks.tiles.TardisInterfaceTile; -import com.vandendaelen.handles.exceptions.NoSubsystemException; -import com.vandendaelen.handles.exceptions.NotATardisException; import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.lua.LuaException; import dan200.computercraft.api.peripheral.IComputerAccess; @@ -90,7 +88,7 @@ public Object[] callMethod(@Nonnull IComputerAccess iComputerAccess, @Nonnull IL } return null; } - catch (NotATardisException | NoSubsystemException e) { + catch (Exception e) { return null; } }