Console running "summon" command in world other than "world"

Discussion in 'Spigot Plugin Development' started by ryanhecht, Jul 11, 2015.

  1. So by default, if you run "summon <entity> <x> <y> <z> <data>" in console, the console will summon an entity in the world called "world" (no matter what the "level-name" is set to in server.properties). How would I go about adding a world name parameter to allow the Console to summon entities in any world? Would I have to create a fake CommandSender (maybe a dummy player?) whose current world is the world in question, or can I do it using getServer().getConsoleSender() somehow?
     
  2. Update: tried creating a dummy player to run the command in the proper world, the command didn't seem to run at all...it's probably my fault though, looking into it.
     
  3. You can just use World#spawn(), no?
     
  4. I had a recent experience with this, but on a different command (/setblock). What I did was recreate the entire command again in a plugin, this time adding in the world argument. Works like a charm for me.
     
  5. Well, not really...basically what I'm doing is using the Task Scheduler to Schedule a bunch of commands to be performed later...I would probably use World.spawn() if I were to recreate the command with a world argument, like
    had suggested, but in a perfect world I'd get around doing that.