Name: Thor What I Want: Simple! Right-Click wooden axe on block to strike lightning on that block! When I Want It By: Shouldn't take a while at all. Why I Need This: I'd like if someone could post the source code here, I just can't seem to figure this out! I know it's so simple, but I'm new (and tired) and stupid. Any help's appreciated
if you do not want to use essentials to accomplish this, here's a very simple way to do it https://gist.github.com/codermason/8412061 if you want an actual compiled plugin, just ask
I knew that, I was just wondering how I could go about making the code. It must be simple. If someone could just type me up the Main class that'd be awesome Just trying to see what I'm doing wrong. Spoke too soon. Thanks! I'll see if this works EDIT by Moderator: merged posts, please use the edit button instead of double posting.
So would you like the just the source code to compile yourself, or would you like the compiled jar and the source code? I'm wondering because it sounds like you attempted to make this plugin, but didn't succeed? Edit: Nevermind, above it looks like you just wanted the functionality.
Ok, this works and all, but is the "lightning bolt" a whole different thing? (If you meant it to be there, it wasn't :/) but the skies flash and make de thunda noise
Make it: Code: public void onPlayerInteractEvent(PlayerInteractEvent event){ Player p = event.getPlayer(); int blockid = p.getItemInHand().getType().getId(); if(p.hasPermission("boomstick.use")){ if(blockid == 271){ Block targetblock = p.getTargetBlock(null, 50); Location location = targetblock.getLocation(); World world = location.getWorld(); world.strikeLightning(location); this will strike lightning at that specific targetblock
boomstick :3 But when I import Player, getId and getTargetBlock have yellow underlines and strikethroughs :/ It exports with warnings
Or just go over it and click on add suppress warnings "deprecation" or whatever. Something around those lines and those errors should be cleared up TrenTech then we would have to change some variables. but the suppress warnings should fix it.....for now :3 EDIT by Moderator: merged posts, please use the edit button instead of double posting.
change int blockid to Material blockMat and remove getId() change if statement to if(blockMat == Material.SOMETHING) change getTargetblock to getClickedBlock or something like that. im on my phone so I'm doing this by memory
1 - that wasn't helpful 2 - i wanted the source code which was given above... not about to decompile class files -_- Wait where would I add that? Sorry, keep in mind Skymurai=Noob I still get the flashing and the sound, it's working fine as far as only striking right-clicked blocks go, but no bolt :/ A note to people who want me to download one of the existing thor plugins: im not using this for my server, but merely to help me understand how this stuff works. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
I was asking for some help so I could understand the basics behind this -_- I got code, that's all I asked for