specify position instead of player#153
specify position instead of player#153tgwaste wants to merge 1 commit intoNukkit-coders:masterfrom tgwaste:master
Conversation
| toPos = true; | ||
| } | ||
|
|
||
| if (args.length == 3 && toPos == false) { |
There was a problem hiding this comment.
Why toPos == false instead of !toPos ?
There was a problem hiding this comment.
just readability, but am happy to change it.
| if (playerThatSpawns != null) { | ||
| Position pos = playerThatSpawns.getPosition(); | ||
|
|
||
| if (toPos == true) { |
There was a problem hiding this comment.
just readability, but am happy to change it.
| if (toPos == true) { | ||
| // specifying a position instead of a player | ||
| String[] arg = args[2].split(","); | ||
| playerThatSpawns = (Player) sender; |
There was a problem hiding this comment.
This will give a ClassCastException if run from console
There was a problem hiding this comment.
Will look into this, still pretty new to java.
| String[] arg = args[2].split(","); | ||
| playerThatSpawns = (Player) sender; | ||
|
|
||
| Position newpos = new Position |
There was a problem hiding this comment.
Maybe we should catch the exception which comes if player gives invalid coordinates?
There was a problem hiding this comment.
Will look into this, at this point I do not know how to validate coordinates.
| if ((ent = Entity.createEntity(mob, pos)) != null) { | ||
| ent.spawnToAll(); | ||
| sender.sendMessage("Spawned " + mob + " to " + playerThatSpawns.getName()); | ||
| if (toPos == true) { |
There was a problem hiding this comment.
just readability, but am happy to change it.
Allow player to do (for example):
/mob spawn Zombie x,y,z