(1.3) TnT turns primed once you place it! (NOT immediate Explosion)

Discussion in 'Archived: Plugin Requests' started by zecheesy, Aug 2, 2012.

  1. Offline

    zecheesy

    Thanks for clicking this!
    I am seriously needing a plugin that turns TNT into primed TNT (it flashes white and stuff).
    The TNT will explode in like 5 seconds after you place it!

    WHY: People place TNT everywhere then place a lever.
    *server crashes*
    So instead of being boring and blocking tnt, I'll have tnt explode detonate (not explode) after you place it.

    No permisisons necessary
    No commands nescessary

    I need it as soon as possible! My server already crashed 4 times :(
    [Mech]
     
  2. Offline

    xEpicTaco

    Hmm, seems interesting and easy, I'll try it :p. It's my first public plugin, but I know how to do this :p
     
    zecheesy likes this.
  3. Offline

    zecheesy

    Yay! I hope you learn a lot from making this plugin!
     
  4. Offline

    Darq

    Well, I had already written this before I came back and saw that you had replied, Taco. >.> Iwastooslow, in that 3 minutes it took to write.

    Will tell you this one thing, and let you write it to learn: The entire plugin should take up a total of 25 lines, with proper formatting. Mine did. ;p
     
  5. Offline

    xEpicTaco

    21 lines ;) Anyway, I'm uploading it to my FTP server now :p I don't feel like messing with dev.bukkit ATM

    EDIT: 21 lines with proper formatting, ~ 30 with my preferred way
    ( MaiWay:
    public void derp(lolol var)
    {
    Blahblahblahblah...
    }
    )
    vs Proper Way:
    public void derp(lolol var){
    Blahblahblah....
    }

    Just to be clear, this is a 1.2.5 plugin, it won't work with 1.3, and none can until Bukkit updates :/. Anyway, here is the plugin: http://minespaceserver.org/trentpublic/PrimeTnt.jar

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 27, 2016
  6. Offline

    Darq

    Yes it will. Bukkit doesn't change all that much between Minecraft updates, such a simply plugin like this will work just fine in 1.3.
     
  7. Offline

    xEpicTaco

    Alright, thanks for the notice! TO ECLIPSE!

    BTW: I <3 your bReport plugin ^^
     
  8. Offline

    zecheesy

    oops i deleted my post
    I was in gamemode so tht happened
     
  9. Offline

    xEpicTaco

    Olol, I was wondering, I refreshed the page like WTFBBQ?!

    I knew I saw that post ^^
     
  10. Offline

    Vinceguy1

    proper way is terrible you format like me, and i like that.
     
  11. Offline

    zecheesy

    I thought you were sleeping ?
     
  12. Offline

    xEpicTaco

    Just found a bug >.<. The TNT block doesn't get removed from the inventory for some reason :/. Anyway, working on it now
     
  13. Offline

    Darq

    xEpicTaco Make sure you're not cancelling the event.
     
  14. Offline

    xEpicTaco

    Hmm, I'm using the
    blEvent.getBlock().setType(Material.AIR);
    method of removing the actual TnT block from the world, how would this add it back to a player's inv? Or is this bug just happening to me?

    Nah, like I said, I'm making the block turn to air :/ Weird...

    Well, I guess I just have to wait and see if the same thing's happening to the server admin. If not, then w/e. Probably just my server being weird :p

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 27, 2016
  15. Offline

    Darq

    Well I just tested, my sauce: http://pastie.org/4382435
    Same shit's happening. I blame bukkit. Though, to get the same effect of making it impossible to create ridiculous chain TnT explosions, this may be fixed by setting the block to air a few server ticks after placing it. Safer, too!
     
  16. Offline

    xEpicTaco

    That's unusual, is there some way to manually remove it from the player's inventory, too? And how would I make it wait a few ticks before removing a block? Perhaps the wait() method?

    Well, hopefully we will figure it out :/. Anyway, you guys feel free to talk to me over my communitys' TeamSpeak server:
    czarspeak.net (default port)
    I'm almost always on :p

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 27, 2016
  17. Offline

    Darq

    A scheduler to delay. Here, I saved you the trouble:
    http://pastie.org/4382466
    Place TNT, a quarter of a second goes by, the TNT it replaced with a spawned primed tnt, it goes boom, yippittydoo.

    Edit: I should also note, never ever ever ever ever put a thread to sleep, or call wait on it, when it's running on Minecraft's main thread (All of the code in your plugins typically are, unless you use Async tasks with the scheduler). Doing so will stop the /entire server/ for however long you paused the thread. Often leading to a crash.
     
  18. Offline

    xEpicTaco

    wow, thanks! I am updating now and uploading, hope to see you again on these forums :p
     
  19. Offline

    xEpicTaco

    Attached Files:

  20. Offline

    BR3TON

    You don't need a scheduler as you can set the fuse ticks of the TNT

    Code:
        @EventHandler
        public void OnBlockPlace(BlockPlaceEvent event) {
            Block block = event.getBlock();
            if (block.getType() == Material.TNT) {
                block.setType(Material.AIR);
                TNTPrimed tnt = event.getPlayer().getWorld()
                        .spawn(block.getLocation().add(0, 1, 0), TNTPrimed.class);
                ((TNTPrimed) tnt).setFuseTicks(40);
            }
     
        }
     
  21. Offline

    xEpicTaco

    That wasn't the problem :p
     
  22. Offline

    Agent Wesker

    If your server is crashing because too many TNT exploding at once, just get the nolagg plugin. It limits the rate of detonations, explosions and the amount of packets sent to the client which reduces lag and crash by a massive percent.
     
  23. Offline

    BR3TON

    That code I just gave you removes the tnt from the inventory if thats the problem you were referring to?
     
  24. Offline

    xEpicTaco

    Even so, we want it to be default tick timer and still remove from the inventory, but it's fine if we change when it PRIMES when It's placed.
     
  25. Offline

    WarmakerT

    You could also use NoChainReaction: dev.bukkit.org/server-mods/No-chain-reaction
     
  26. Offline

    BR3TON

    The snippet I sent you did have the default tick timer + removed it from the inventory.
     
  27. Offline

    n00bcannon

    Can you please make a plugin for me to make TnT explode in 1 tick after primed? Thanks!
     

Share This Page