From 72dafe9665b7f4a225a3dec013e284310d98747b Mon Sep 17 00:00:00 2001 From: LemADEC Date: Thu, 18 May 2017 02:52:11 +0200 Subject: [PATCH] Added player name to summon() in LUA API --- .../block/movement/TileEntityShipController.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipController.java b/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipController.java index 7c85d103..3b092cd8 100644 --- a/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipController.java +++ b/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipController.java @@ -733,20 +733,21 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced { private Object[] summon(Object[] arguments) { if (arguments.length != 1) { - return new Object[] { false }; + return new Object[] { false, "Expecting 1 argument: Integer attached player index" }; } int playerIndex; try { playerIndex = Commons.toInt(arguments[0]); } catch (Exception exception) { - return new Object[] { false }; + return new Object[] { false, "Integer expected for 1st argument" }; } if (playerIndex >= 0 && playerIndex < players.size()) { - setToSummon(players.get(playerIndex)); - return new Object[] { true }; + final String namePlayer = players.get(playerIndex); + setToSummon(namePlayer); + return new Object[] { true, namePlayer }; } - return new Object[] { false }; + return new Object[] { false, "Index out of range" }; } private Object[] getEnergyRequired(Object[] arguments) {