small medium large xlarge

10 Jul 2014, 08:54
Adam Hyldkrog (2 posts)

Hi. is my code.

I can’t get it to work. No erros in console, but the commands don’t work, after I added the squid part.

10 Jul 2014, 14:28
Andrew Hunt (222 posts)

Yeah that won’t work. Read along with me:

If the command label is “sky”, do all this stuff:

  1. Check the caller is a player
  2. Loop through nearby entities
  3. For each entity, teleport them and see if the command label is “squidbomb”

But you’re only executing this block of code if the command label is “sky”, so the test for “squidbomb” will never be true here. It can’t be “squidbomb” if it’s equal to “sky.”

You need to move the test for “squidbomb” out of the

if (commandLabel.equalsIgnoreCase("sky")) {

block. That way you can test if the command label is “sky”, “squidbomb”, or anything else.