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]
Hmm, seems interesting and easy, I'll try it . It's my first public plugin, but I know how to do this
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
21 lines Anyway, I'm uploading it to my FTP server now 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.
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.
Just found a bug >.<. The TNT block doesn't get removed from the inventory for some reason :/. Anyway, working on it now
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 EDIT by Moderator: merged posts, please use the edit button instead of double posting.
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!
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 EDIT by Moderator: merged posts, please use the edit button instead of double posting.
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.
http://minespaceserver.net/trentpublic/PrimeTnt/1.3/PrimeTnt.jar EDIT: Sorry, my FTP server is being a bitch...
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); } }
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.
That code I just gave you removes the tnt from the inventory if thats the problem you were referring to?
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.