Torch removal

Discussion in 'Archived: Plugin Requests' started by Master, Apr 15, 2011.

  1. Offline

    Master

    Is there a plugin that lets you remove all placed torches on the map?

    Is there any way to make it so that when someone logs off from a server all torches they placed are removed?
     
  2. Offline

    MrChick

    I don't think there is such a plugin yet. Would be pretty heavy though since you'd have to go through every block and check if it's a torch.
    Still possible though.

    The latter would be easier to do.
     
  3. Offline

    Unset

    If you want to do this 1 time, you can use the worldeditor MCEdit (not a bukkit-plugin). Select all block, replace torch with air, wait some minutes.
     
  4. Offline

    Plague

    WorldEdit or VoxelSniper (or maybe other from the voxel family) but maybe it doesn't do it for the whole map but oly chunks around you, check it out

    but I use MCEdit for this too.
     
  5. Offline

    GamerX

    I'll try to take a look at this, I hope some1 wants to join the project?
     
  6. Offline

    Master

    Well, Im not too worried about existing torches but I want a way to keep people from torching the whole world so monsters no longer spawn. That kind of defeats the purpose IMHO.
     
  7. Offline

    MrChick

    that would be quite easy to do
     
  8. Offline

    Joey Clover

    Actually, this is a good use for the filesystem. Make files for each user in a /usr/ directory or something. Inside that file, do the following:
    Code:
    340:420:12
    430:543:2
    120:324:22
    -130:-164:-12
    and then 'Split' the files colons, so if you called the strings Locations[], it would look like this:

    Locations [0] = "340", Locations[1] = "420", Locations[2] = "12"...

    Code:
    Pseudo Code:
    
    if(player places torch){
    
        if(player + ".torchlocations" does not exist){
            try and make a new one...
    
        }
        props.load(player + ".torchlocations");
        props.editProperty("amount_of_torches", ++);
        props.put("Torch"+props.getProperty("amount_of_torches"), x + ":" + z + ":"  + y );
    
    }
    
    
    if(player logs off) {
    
        props.load(player + ".torchlocations"); //The files = playername.torchlocations
    
       for(var i = 0; i < props.getProperty("amount_of_torches"); i++){
    
            String Locations[] = props.getProperty("Torch" + i).split(":");
            Xpos = parseInt(Locations[0]);
            Ypos = parseInt(Locations[2]);
            Zpos = parseInt(Locations[1]);
            RemoveBlockAt(Xpos,Ypos,Zpos);
    
     }
    
    
    }
    I EXPECT THERE TO BE ERRORS IN THIS. I WROTE IT WITH NO REFERENCES.
     
  9. Offline

    Canownueasy

    Why are you holding torches in file... when you can use a map?
     
  10. Offline

    Joey Clover

    Because looping through the whole map to check what are torches is a big task.
     
  11. Offline

    Canownueasy

    Looping through all tiles would be stupid, however why not just store the placed blocks into a map and then iterate through those.....
     
  12. Offline

    Master

    Just make sure you check that the torch being deleted exists first. For instance if a player places a torch and another remove it that could cause a problem.
     
  13. Offline

    Lolmewn

    Delete your whole map (hehe :p) -- will result in some loss of world (actually all of it), but you won't have torches :p
     
  14. Offline

    Master

    Anyone have any luck with this yet?
     
  15. Offline

    MrChick

    I guess I'll take a try at it later this day since nobody seems to have done it yet.
     
  16. Offline

    Master

    Anyone have any luck?
     
  17. Offline

    valdark

    How about ExpiringTorches ... I believe that is the plugin name. You can set it to remove torches when their time runs out.
     
  18. Offline

    Master

    The problem with expiring torches is that it if the server gets reloaded any placed torches become permanent. They also only count down while in a chunk that is currently loaded. The plugin is a start but it does not work 90% of the time. I ran it for 2 weeks with a 4hr time limit and only one in a hundred torches went out.

    It would just be easier to tie all torches placed to a db of users and when that user logs out or in it clears that database and removes all torches from the world placed by that player.
     

Share This Page