Getting Started

Discussion in 'Bukkit Discussion' started by TheGamesHawk2001, Aug 24, 2014.

Thread Status:
Not open for further replies.
  1. Hello all, I have recently (About 4 months ago) been starting to get into coding Java and the bukkit API if that's what you call it :/ a few months back I downloaded eclipse and started to watch some tutorials and going to this very advanced coder for help, He helped me every time and somedays we would spend 5+ hours talking about the same subject haha, He told me before I could learn Bukkit API thingy I would have to learn normal Java. So I took this on board and went on a hunt for a Java For Beginners article thing with various tutorials which where fun because I actually though I was achieving something for once in life, i'm joking but it was a good feeling knowing I was learning and getting started with coding, Because I've always wanted to be my own dev :D coding my own plugins whenever I wanted, It would be so easy.

    So the whole objective of this is that maybe someone nice could help me achieve my goal, of getting to know the bukkit API // Know up to the point of which I can learn bukkit easier, If someone would be kind enough to help me do this, I would greatly appreciate it, Thanks for your time
     
  2. Just look at the JavaDocs and see what there is to do with the Bukkit API
    And this isn't a plugin request.
     
    VG.Developments likes this.
  3. Offline

    JaguarJo

    Moving this thread to Bukkit Discussion since it doesn't belong in Plugin Requests.
     
  4. Offline

    jthort

    TheGamesHawk2001 Take a look at some of the tutorials if browsing the API is not your thing, their are a good amount of tutorials that will help you.

    If you have any specific questions feel free to create a post under plugin development. Although having a personal teacher is great, it's not always going to insure you are learning the correct methods.
     
  5. Offline

    au2001

    TheGamesHawk2001
    You should definitly go check these guys out on youtube: TheBCBroz and pogostick29, awesome youtubers.
    That's how I learnt (and I still learn ;))!
    If you can't find things you need feel free to contact me (by pm) or others (by posting a thread in the plugin developement part)
    I will be glad to help you and timtower will be too ;)
     
  6. au2001
    I looked at TheBCBroz and he just does tutorials on SPECIFIC plugins, I didn't think this would help but idk haha, Also which Video's of his did you follow? Where did you get started, what was your first code Hello World?
     
  7. Offline

    DrPyroCupcake

    You should buy the book BigJava. It helped me a lot.
     
  8. Offline

    au2001

    TheGamesHawk2001 TheBCBroz also did basic bukkit tutorials :
    I followed them in the order 1 -> 10 then I stopped and started to make plugins on my own.
    On YouTube, with TheBCBroz and pogistick29.
    I made a Hello World code (you type /hello and it says "Hello World!" like /ping).
    Then I made a plugin with my brother: a GravityGun (note: worst plugin ever to start coding)

    Hope it'll help you start :D
     
  9. au2001
    Dude, I love pogostick, he's like the best "tut'er" He's tought me loads about bukkit, and coding it, I have made like 3/4 plugins just need to sort out the return false and return true because when I type 1 command (My class has 3) it seems to go through all the methods, if you could help me because I have no clue what to do haha.

    Here's my code:
    Code:java
    1. package me.nathan.RadiantPrank;
    2.  
    3. import org.bukkit.Bukkit;
    4. import org.bukkit.ChatColor;
    5. import org.bukkit.command.Command;
    6. import org.bukkit.command.CommandSender;
    7. import org.bukkit.entity.Player;
    8. import org.bukkit.plugin.java.JavaPlugin;
    9.  
    10. public class Main extends JavaPlugin {
    11.  
    12. public void onEnable() {
    13. Bukkit.getServer().getLogger().info("RadiantPrank" + this.getDescription().getVersion() + " Enabled!");
    14.  
    15. }
    16.  
    17. public void onDisable() {
    18. Bukkit.getServer().getLogger().info("RadiantPrank Disabled!");
    19. }
    20.  
    21. public boolean onCommand(CommandSender sender, Command cmd, String commandLable, String [] args) {
    22. if (cmd.getName().equalsIgnoreCase("fakeop")) {
    23. if (args.length == 0) {
    24. sender.sendMessage(ChatColor.RED + "Please specify a player!");
    25. return true;
    26. }
    27. if(!sender.hasPermission("radiant.fakeop"))
    28. return true;
    29. sender.sendMessage(ChatColor.RED + "You are not permitted to do this!");
    30. Player target = Bukkit.getServer().getPlayer(args[0]);
    31. if (target == null) {
    32. sender.sendMessage(ChatColor.RED + "Could not find player " + args[0] + ".");
    33. return true;
    34.  
    35. }
    36. target.sendMessage(ChatColor.YELLOW + "You are now op!");
    37. sender.sendMessage(ChatColor.GREEN + "Success! Wait For Their Response :D");
    38. }
    39. // DEOP STARTS HERE
    40. if(!sender.hasPermission("radiant.fakedeop"))
    41. return true;
    42. sender.sendMessage(ChatColor.RED + "You are not permitted to do this!");
    43. Player target = Bukkit.getServer().getPlayer(args[0]);
    44. if (target == null) {
    45. sender.sendMessage(ChatColor.RED + "Could not find player " + args[0] + ".");
    46. return true;
    47.  
    48. }
    49. target.sendMessage(ChatColor.YELLOW + "You are no longer opped!");
    50. sender.sendMessage(ChatColor.GREEN + "Success! They're gunna be angry :/"); {
    51. // DEOP ENDS HERE
    52. }
    53. if(!sender.hasPermission("radiant.fakejoin"))
    54. return true;
    55. sender.sendMessage(ChatColor.RED + "You are not permitted to do this!");
    56. if (cmd.getName().equalsIgnoreCase("fakejoin")) {
    57. if (args.length == 0)
    58. sender.sendMessage(ChatColor.RED + "Please Specify a Name!");
    59. Bukkit.getServer().broadcastMessage(ChatColor.YELLOW + args[0] + " joined the game.");
    60. }
    61. return true;
    62. }
    63.  
    64. }
    65.  
     
  10. Offline

    au2001

    TheGamesHawk2001 You should just make it normally with elseifs :
    Code:java
    1. public boolean onCommand(CommandSender sender, Command cmd, String commandLable, String [] args) {
    2. if (commandLable.equalsIgnoreCase("fakeop")) {
    3. if (args.length == 0) {
    4. sender.sendMessage(ChatColor.RED + "Please specify a player!");
    5. } else if (sender.hasPermission("radiant.fakeop")) {
    6. Player target = Bukkit.getServer().getPlayer(args[0]);
    7. if (target != null) {
    8. target.sendMessage(ChatColor.YELLOW + "You are now op!");
    9. sender.sendMessage(ChatColor.GREEN + "Success! Wait For Their Response :D");
    10. } else {
    11. sender.sendMessage(ChatColor.RED + "Could not find player " + args[0] + ".");
    12. }
    13. } else {
    14. sender.sendMessage(ChatColor.RED + "You are not permitted to do this!");
    15. }
    16. } else if (commandLable.equalsIgnoreCase("fakedeop")) {
    17. if (sender.hasPermission("radiant.fakedeop")) {
    18. Player target = Bukkit.getServer().getPlayer(args[0]);
    19. if (target != null) {
    20. target.sendMessage(ChatColor.YELLOW + "You are no longer opped!");
    21. sender.sendMessage(ChatColor.GREEN + "Success! They're gunna be angry :/");
    22. } else {
    23. sender.sendMessage(ChatColor.RED + "Could not find player " + args[0] + ".");
    24. }
    25. } else {
    26. sender.sendMessage(ChatColor.RED + "You are not permitted to do this!");
    27. }
    28. } else if (commandLable.equalsIgnoreCase("fakejoin")) {
    29. if (sender.hasPermission("radiant.fakejoin")) {
    30. if (args.length == 0) {
    31. sender.sendMessage(ChatColor.RED + "Please Specify a Name!");
    32. } else {
    33. Bukkit.getServer().broadcastMessage(ChatColor.YELLOW + args[0] + " joined the game.");
    34. }
    35. } else {
    36. sender.sendMessage(ChatColor.RED + "You are not permitted to do this!");
    37. }
    38. }
    39. return false;
    40. }
     
  11. Offline

    Necrodoom

    TheGamesHawk2001 You never defined 3 commands, you only have one command. Also, you do not need to print messages on enable and disable, follow the bukkit plugin tutorial, not one of these broken plugin 'tutorials'.
     
Thread Status:
Not open for further replies.

Share This Page