Thor

Discussion in 'Archived: Plugin Requests' started by Skymurai, Jan 13, 2014.

  1. Offline

    Skymurai

    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 :)
     
  2. Offline

    Gopaintman

    I'm pretty sure you can bind the /smite command to a wooden axe with essentials.
     
    GravedigginSearchBar likes this.
  3. Offline

    codermason

  4. Offline

    Skymurai

    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.
     
    Last edited by a moderator: Jun 6, 2016
  5. Offline

    NathanG_

    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. :)
     
  6. As Gopaintman said, bind the /smite command to the tool :)

    Problem solved :)
     
  7. Offline

    LemonLimes4ever

    Hello Skymurai! its me LemonLimeLife
     
    Skymurai likes this.
  8. Offline

    Skymurai

    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 ;)
     
  9. Offline

    MoeMix

    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
     
    Skymurai likes this.
  10. Offline

    Skymurai

    boomstick :3
    But when I import Player, getId and getTargetBlock have yellow underlines and strikethroughs :/ It exports with warnings
     
  11. Offline

    Garris0n

    There are plenty of plugins that do this.
     
  12. Offline

    TrenTech

    Use Material identifier instead of id to get rid of the warnings.
     
  13. Offline

    MoeMix

    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.
     
    Last edited by a moderator: Jun 6, 2016
  14. Offline

    TrenTech

    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
     
  15. Offline

    MoeMix

    wouldn't targetblockstay the same?
     
  16. Offline

    TrenTech

    its deprecated if i remember correctly
     
  17. Offline

    Alle2010

  18. Offline

    Skymurai


    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.
     
    Last edited by a moderator: Jun 6, 2016
  19. Offline

    timtower Administrator Administrator Moderator

    This is the plugin requests section... You usually only get jars here
     
  20. Offline

    Skymurai


    I was asking for some help so I could understand the basics behind this -_-
    I got code, that's all I asked for
     

Share This Page