Solved Summon in another world

Discussion in 'Spigot Plugin Development' started by titivermeesch, Jul 29, 2018.

  1. Hello,

    My plugin executes a summon command because it is easier for me to do that with what I want to do.
    The problem is that when I do that, it summons the entity in the world "world", is there any way to change that?

    Code (Java):
    Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "summon Fireball " + loc.getX() + " " + loc.getY() + " " + loc.getZ() + " {ExplosionPower:3,direction:[0.0,0.0,0.0]}");
  2. You probably need to do something along the lines of this:

    Code (Java):
    World world = Bukkit.getWorld("myworld");
    Fireball fireball = world.spawn(loc, Fireball.class);
  3. You can try to get the fireball entity and teleport it to the correct world, but it'll be much easier to spawn it with code instead of commands.
  4. I already tried that but then the problem is that I don't get to spawn it in a static way, so that it don't move since the setGravity() feature don't work on this

    EDIT : @KindlyFire That actualy works, I'll figure out how to change the power of this
    EDIT2 : Didn't work actualy xD
    #4 titivermeesch, Jul 29, 2018
    Last edited: Jul 29, 2018
  5. You can use the setYield() function to set the power.
  6. That don't change the fact that when it spawns it will fly away
  7. setVelocity() doesn't seem to have an effect on it. The following doesn't work:
    Code (Java):
    fireball.setVelocity(new Vector().zero());
    But setting the direction to a zero vector does work:
    Code (Java):
    fireball.setDirection(new Vector().zero());
    (I just tested this)
    • Useful Useful x 1
  8. That works, thanks.

    ~ Thread closed : Question answered