Plugin Creation

Discussion in 'Plugin Development' started by owlnight321, Jul 8, 2014.

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

    owlnight321

    Hello, I have been trying to create a plugin for a while and I have tried with videos and other things but i cannot successfully create a plugin is there anyone that would be willing to help me create a simple plugin and/or help me learn the basics of create one?
     
  2. Offline

    Gater12

  3. Offline

    W&L-Craft

    izarooni likes this.
  4. Offline

    owlnight321

  5. Offline

    Gater12

    coasterman10 and TheSpherret like this.
  6. Offline

    evilmidget38

    TheBCBroz tutorials are probably the worst possible tutorials to follow.
     
  7. Offline

    xTigerRebornx

    Gater12 or even better, the wiki. It has the best tutorial <3
     
    xTrollxDudex likes this.
  8. Offline

    owlnight321

    Okay well i will try with these and i will see which one works for me.
     
  9. Offline

    ZodiacTheories

    coasterman10 and xTrollxDudex like this.
  10. Offline

    owlnight321

    So i did everything the way he said and i made sure of it but i got this any help




    help.PNG
     
  11. Offline

    owlnight321

    Sorry i am stupid here

    code 1.PNG code 1.PNG code 2.PNG
     
  12. Offline

    JasonDL13

    I highly recommend you learn Java before Bukkit. I did the mistake of doing that and it make it 100x harder. Trust me. But you haven't imported ChatColor. Mouse over it in eclipse to import it (from org.bukkit.ChatColor) just like you did with player and stuff. The player error is there because you can only access varibles after you assign them. But since you have the sender variable use that.
     
  13. Offline

    owlnight321

    Okay thank you and do you know of a good video or a way to learn java?
     
  14. Offline

    JasonDL13

    owlnight321 TheNewBoston really helps. Although if you only want to make plugins and not programs, which is also a pretty cool thing to do. Skip the JFrame tutorials. But it's good to learn a lot of useful methods like Random, because then you can implement that into your plugins.
     
  15. Offline

    owlnight321

    Okay thank you i will hopefully understand all of the stuff they say
     
  16. owlnight321 you need to import ChatColor and also you made Player player after you used player
     
  17. Offline

    owlnight321

    Can you explain how to fix it?
     
  18. owlnight321 yeah sure

    So import chatcolor like everything else do CTRL+SHIFT+O to import or hover and click.
    To fix player:
    I'm going to rewrite it for you and ill make comments so you can understand
    Code:java
    1. package com.bwfcwalshy.tutorial.commands;
    2.  
    3. import org.bukkit.ChatColor;
    4. import org.bukkit.command.Command;
    5. import org.bukkit.command.CommandExecutor;
    6. import org.bukkit.command.CommandSender;
    7. import org.bukkit.entity.Player;
    8.  
    9. public class Test implements CommandExecutor {//CommandExecutor is if its in another class
    10.  
    11. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
    12. if(cmd.getName().equalsIgnoreCase("test")){
    13. //If the command is /test do this
    14. if(sender instanceof Player){
    15. //If its a player do this
    16. sender.sendMessage(ChatColor.GOLD + "Player test");
    17. }
    18. if(!(sender instanceof Player)){
    19. //If its console do this
    20. sender.sendMessage(ChatColor.GOLD + "No your console!!!");
    21. }
    22. }
    23. return false;
    24. }
    25. }
    26.  


    This should work not tested tell me if there's a error just tahg me and ill try to fix it :)
     
  19. Offline

    owlnight321

    So the thing with this and the one i have is that mine has 35 lines your has 26 and i can't copy and paste because it doesn't copy the spaces
     
  20. Offline

    MCMastery

  21. Offline

    dsouzamatt

    Don't worry, bwfcwalshy has just removed some blank lines to make his version shorter, It does exactly the same thing.

    If, once you've copied it in the indentation is off, use ctrl+a to select everything then ctrl+i to fix the indentation.

    If you're looking for tutorials, I'd recommend these videos from Appljuze:
     
  22. Offline

    _Filip

    dsouzamatt
    Umm no, he also removed the onEnable and onDisable commands...
     
  23. Offline

    dsouzamatt

    Oh yeah, he did :p . Well in that case, owlnight321 you need to replace your onCommand method with the one from bwfcwalshy and add the import
    Code:java
    1. import org.bukkit.ChatColor;
     
  24. Offline

    W&L-Craft

    owlnight321

    Sorry i didn't really explain it good, i said that i learned to make a basic plugin from TheBCBroz. but i switched to other tutorials because some other tutorials are way better explained.

    Gater12
    I really like thenewboston's videos on java thanks for that tip!
     
  25. Offline

    tommyhoogstra

    Your plugin.yml is in your source folder, drag it onto the entire project, so its laid out like this:
    [​IMG]
     
  26. Offline

    GreySwordz

    Why is that?
     
  27. owlnight321 dsouzamatt TheSpherret I just quickly made it in a new class and i did put a comment over the CommandExecutor saying this is for if you want it in another class, anyhow hope i helped you just need to use the onCommand and put it in your Main class.
     
  28. Offline

    Deleted user

    GreySwordz
    They teach bad habits, such as using the deprecated Logger.getLogger("minecraft")

    As well as logging onEnable and onDisable and a bunch of other stuff.
     
Thread Status:
Not open for further replies.

Share This Page