Added player name to summon() in LUA API
This commit is contained in:
parent
596634ce3b
commit
72dafe9665
1 changed files with 6 additions and 5 deletions
|
@ -733,20 +733,21 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced {
|
||||||
|
|
||||||
private Object[] summon(Object[] arguments) {
|
private Object[] summon(Object[] arguments) {
|
||||||
if (arguments.length != 1) {
|
if (arguments.length != 1) {
|
||||||
return new Object[] { false };
|
return new Object[] { false, "Expecting 1 argument: Integer attached player index" };
|
||||||
}
|
}
|
||||||
int playerIndex;
|
int playerIndex;
|
||||||
try {
|
try {
|
||||||
playerIndex = Commons.toInt(arguments[0]);
|
playerIndex = Commons.toInt(arguments[0]);
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
return new Object[] { false };
|
return new Object[] { false, "Integer expected for 1st argument" };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerIndex >= 0 && playerIndex < players.size()) {
|
if (playerIndex >= 0 && playerIndex < players.size()) {
|
||||||
setToSummon(players.get(playerIndex));
|
final String namePlayer = players.get(playerIndex);
|
||||||
return new Object[] { true };
|
setToSummon(namePlayer);
|
||||||
|
return new Object[] { true, namePlayer };
|
||||||
}
|
}
|
||||||
return new Object[] { false };
|
return new Object[] { false, "Index out of range" };
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object[] getEnergyRequired(Object[] arguments) {
|
private Object[] getEnergyRequired(Object[] arguments) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue