plugin help

Discussion in 'Bukkit Help' started by saul100, Sep 11, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    saul100

    I am trying to create a plugin, and I create a source folder, then I need to name it where I host my plugins, but where would that be?

    jacek said his is bukkit.org.jacekk.co.uk
    how can i find mine?

    trying to create a test plugin
     
  2. Offline

    NeoSilky

    Well when you make a plugin, you make a JavaProject, then create a package, then create your class' :)
     
  3. Offline

    saul100

  4. Offline

    NeoSilky

    @saul100 ohh, i see what you mean, it doesn't matter what your package name is, generally is is me.saul100.<pluginname>, you're not means to use bukkit. unless you're something to do with actualy bukkit.

    co.uk.<author>.<pluginname> is for people who own the domain name :)
     
  5. Offline

    Supersam654

    In the future, plugin development help goes under the plugin development forum :p. You will get a lot more help a lot faster that way.
     
    NeoSilky likes this.
  6. Offline

    saul100

    @NeoSilky
    Thanks for clearing that up

    @Supersam654 thanks for that, will remember that one.

    NExt up. I need to click source and go to new->file but it's not there, help.

    p.s I'm on a mac.

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

    NeoSilky

    right click on the main java project file, rightclick, new, file and then type in plugin.yml :)

    everytihng okay? :)

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

    saul100

    yep, i did what you said then dragged it into source file (src)
     
  9. Offline

    NeoSilky

  10. Offline

    saul100

    One other thing. If I create a plugin now, and 1.8 and recommended builds out within days, what happens? Can I just download new bukkit and copy+paste all the coding?
     
  11. Offline

    NeoSilky

    @saul100 basically, all you have to do if switch the external jars, try and fix any problems (there shouldnt be) compile it, test it, and then its fine :)
     
  12. Offline

    saul100

    @NeoSilky
    so no need to recode it? YESSS
    thanks man
     
  13. Offline

    NeoSilky

    @saul100 nope, not unless it drastically changes :p
     
  14. Offline

    saul100

    OK. lets say Im typing
    PHP:
    player.sendMessage(ChatColour.
    The colours don't appear after the . so It dosnt turn blue and work
     
  15. Offline

    NeoSilky

    unfortunately, bukkit is programmed in american, so you spell colour by 'Color'

    so it should be

    Code:
    player.sendMessage(ChatColor.BLUE + ETC......
    
     
  16. Offline

    saul100

    WOW, thanks for that.
    Man, english is killing me :p
     
  17. Offline

    NeoSilky

    its fine, i got stuck at first :p
     
  18. Offline

    saul100

    next. I want it to announce a message that someone placed TNT. how is that possible?
     
  19. Offline

    NeoSilky

    damn, i'd be able to give you the code if i was on my laptop.
    Before i tell you how, DO NOT RELEASE, PEOPLE WILL TROLL!

    Anyway.... You make a player listener that has a onBlockPlace event inside it, and then you say
    Block block = event.getBlock();
    Player player = event.getPlayer();
    Then you do if(block.getType == Material.TNT) {
    player.sendMessage("You have placed TNT")
    }

    I believe it is something like that, dead simple :)
     
  20. Offline

    Supersam654

    I would like to point out that this code will send a message to the player that placed the TNT. If you want the entire server to know, you will need something along the lines of Bukkit.getServer().broadcastMessage("You have placed TNT").

    I am not looking at Eclipse right now, so don't quote me on the exact syntax :p
     
  21. Offline

    NeoSilky


    Oh sorry! Did he wanna broadcast it? :S you might wanna get the players name and add that to the broadcast otherwise you won't know who it is :')
     
  22. Offline

    Supersam654

    that is completely true :D. I recommend (player.getName() + " has placed TNT");
     
  23. Offline

    NeoSilky

    OR Player name = player.getDisplayName();

    And then

    (name + " has placed TNT, ahhhhh!");


    ;)
     
  24. Offline

    saul100

    where does that go? the TNTNotifier.java? shall i post the log?

    whats the actual code for it? AND SHOULD I just post it after the;
    plugin.logMessage(player.getName() + "Placed a TNT Block, Naughty! at " + block.getX() + "," + block.getY() + "," + block.getZ() + "." );

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

    NeoSilky

    @saul100 yes, it does, in a block listener :) :)

    @saul100 it would be up to you, doesn't really matter :)

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

    saul100

    Whats the code though?

    p.s - onlinePlayer.sendMessage(ChatColor.RED + msg); (why isn't .red BLUE colour? )
     
  27. Offline

    NeoSilky

    im not on my laptop, so i can't say this is word for word, but,

    Code:
    public void onBlockPlace (BlockPlaceEvent event) {
    Player player = event.getPlayer();
    Block block = event.getBlock();
    
    if(block.getType == Material.TNT) {
    Bukkit.getServer().broadcastMessage(player.getDisplayName() + " has just placed TNT!!");
    }
    }
    
    That should be right, :)

    and i dont get your last comment bit?

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

    saul100

    Bukkit.getServer().broadcastMessage(player.getDisplayName() + " has just placed TNT!!"); }
    can i just post that line to my eclipse?
     
  29. Offline

    NeoSilky

    yes :)

    if it doesn't work, PM me and i will go on teamviewer when im free tonight :)

    @saul100 will be home soon, can help you then :)

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

    saul100

    @NeoSilky
    Why is my (msg) red lined (error) ?
    both:
    onlinePlayer.sendMessage(ChatColor.RED + msg);

    and

    plugin.logMessage(msg);
     
  31. Offline

    NeoSilky

    @saul100 do you have the message set as a String in the config or where ever you have set it? As i said, home soon :)
     
Thread Status:
Not open for further replies.

Share This Page