From a1740ea2ac17017fbb74ae6bcaaa5e7809c31aed Mon Sep 17 00:00:00 2001 From: LotuxPunk Date: Sat, 13 Jun 2020 00:34:38 +0200 Subject: [PATCH] compatibility for the last TM version --- .../handles/blocks/tiles/TardisInterfaceTile.java | 9 ++++++--- .../handles/misc/TardisInterfacePeripheral.java | 4 +--- 2 files changed, 7 insertions(+), 6 deletions(-) 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; } }