Deleting blocks using WorldEdit/WorldGuard?

Discussion in 'Plugin Development' started by Black Ice, Jul 10, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Black Ice

    Hi. I run a minigame server that requires blocks in certain WG regions to be deleted/restored after certain events. I have been doing this by hand using the ingame WE/WG commands, but I want to automate it. So, I've been developing a custom plugin to run it for me.

    I've looked all over and can't find a good example of how to delete and restore blocks using WorldEdit/WorldGuard without using the ingame commands. I know about the perform() method, but I was wondering if there is a way to edit the world without needing an instance of a player.

    Thanks in advance.
     
  2. Offline

    Njol

    You can use the console to execute the commands if WE/WG permits it:
    Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "<your command>");
     
  3. Offline

    Black Ice

    I've tried to do it with the console, the commands need to be sent by a player. All I want to do is select and delete/restore a WorldGuard region, I'm not really sure why it requires a player :\
     
  4. To get his world most likely...

    I'm unsure if it's possible but you could create a temporary player, set his location in that world, set him as op, run the command and then remove the fake player...
     
  5. Offline

    Vynlar

    Sounds like an overly complex way to pull it off. Though, I have no better ideas.
     
  6. That would be the "safe" way, you could also grab a random player from that world, make him op, run the command and un-op him... he won't be able to use any OP commands himself because the change happens almost instantly, but the command might print him some messages and might confuse him...
     
  7. Offline

    chaseoes

    How do you make a fake player?
     
  8. Offline

    Deathmarine

    world.spawn(location, Player.class);
    Havent tried it... curious about it though....
     
Thread Status:
Not open for further replies.

Share This Page