-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
specify position instead of player #153
base: master
Are you sure you want to change the base?
Conversation
toPos = true; | ||
} | ||
|
||
if (args.length == 3 && toPos == false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why toPos == false
instead of !toPos
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just readability, but am happy to change it.
@@ -138,10 +143,30 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String | |||
if (playerThatSpawns != null) { | |||
Position pos = playerThatSpawns.getPosition(); | |||
|
|||
if (toPos == true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just if (toPos) {
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will give a ClassCastException if run from console
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should catch the exception which comes if player gives invalid coordinates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will look into this, at this point I do not know how to validate coordinates.
Entity ent; | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just if (toPos) {
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just readability, but am happy to change it.
Allow player to do (for example):
/mob spawn Zombie x,y,z