How can I make persistent variables in WorldEdit CraftScripting?

Solution 1:

I suggest you don't even use world edit, Making a bukkit plugin from scratch is very easy and very fun.

Bukkit's API has very usful block-editing tools, this peice of code here will place a block of stone(b.setTypeId(1);) above every player's head whenever they move.

    public void onPlayerMove(PlayerMoveEvent evt) {

    Location loc = evt.getPlayer().getLocation();

    World w = loc.getWorld();

    loc.setY(loc.getY()-1);
    Block b = w.getBlockAt(loc);
    if(!b.isEmpty())
    {
    b.setTypeId(1);
    }}

And as for the anti-crashing, just make the plugin run on a separate thread from the main server, this way if your plugin "crashes" the server won't respond any diffrently until the plugin has finished calculating and will finish at quicker speed.