Solved Multiple Commands Under Public Boolean OnCommand Dont know how to

Discussion in 'Plugin Help/Development/Requests' started by john12345brown, Jan 20, 2016.

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

    john12345brown

    I have fixed the issue using this tutorial it is quite a good tutorial.

    Thank you all for the help.
     
    Last edited: Jan 20, 2016
  2. Offline

    pie_flavor

    @john12345brown First of all, you don't need to do String.format or any of that. Using getLogger() gets a logger specific to your plugin. Also, if you put depend: [Vault] in your plugin.yml, your plugin won't get enabled in the first place without Vault installed. This is actually the best practice since Vault may get loaded after your plugin otherwise, which is bad.
    Second, the answer: args is the array of arguments that are passed along with the command. So you would check if args.length is 1, and then check if args[0] is "off". If this is the case, the sender has executed /hulk off. If not, they have done /hulk or they have formatted the command wrong.
     
  3. Offline

    john12345brown

    @pie_flavor I have updated the post please review it again and readvise i have changed to doing command /hulkoff instead of /hulk off because i really don't know how to do args[0] or what ever that is yet im just basing stuff together here that should work it is not the best practice i know but i only have self taught knowledge and researching on the internet no real teaching at all sadly.
     
  4. Offline

    pie_flavor

    @john12345brown When someone shows you a new programming concept, the best thing to do is to try to learn it, rather than say 'it's too hard'. In this case, args is an array - think of it like a list of things. Square brackets are used to say which one in the list you want - in this case. args[0] means the first thing in args. Each array also has a variable called length, which says how many elements are in the array.

    Not knowing core language features like arrays comes from learning Java at the same time as Bukkit, rather than before. And an easy trap to fall into is to watch BcBroz. Their tutorials are very dated, and they teach bad programming practices. I would recommend that you finish your Java learning, and then use official tutorials (like the one on the wiki). @teej107 You always have some choice words about BcBroz, you can probably put it better than I can.
     
  5. Offline

    john12345brown

    @pie_flavor i know BcBroz has bad programming practices but atm i don't really care about that because all i'm focused on is getting this plugin to work and i got it to work now i know that sounds stupid but in my point of view i'm determined to finish this plugin no matter what methods i use and i did finish it and its pretty neat and i think the server owner is gonna love it it is basically just for a donator rank called Hulk since the mc server is Dc universe based / Super hero based but no marvel characters they decided not to have any and so yeah it just a command that The donator rank gets and they get Strength 3 Jump 3 and Speed 6 for 10 minutes and it has a 20 minute cooldown after executing the command which makes it more like a 10 minute cooldown because you are still using the Hulk potion effects for 10 minutes of the cooldown time so yeah i know i should learn more of a traditional way but this way worked but it might not work next time and i am aware of that and also i've been running on sleep exhaustion for a while now maybe for more then half the time i have been coding this plugin but still I FINSIHED IT :D so happy and but thanks for your advice and i hope you have a nice day / night.
     
  6. Offline

    oceantheskatr

    Good job on finishing your plugin, it is important to keep trying and not give up. I didn't read this whole thread, but I skimmed a bit and saw that BcBroz was mentioned, and as pie_flavor said, BcBroz is bad to learn from. If you want to learn from a YouTuber that provides good tutorials and doesn't teach bad practices, take a look at Pogostick29Dev, I've learned all my Bukkit coding basics from him :)

    https://www.youtube.com/user/PogoStick29Dev
     
Thread Status:
Not open for further replies.

Share This Page