Messing around with player.setGamemode or whatever.

Discussion in 'Plugin Development' started by ZexyMichael, Sep 9, 2014.

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

    ZexyMichael

    Okay. I am a new developer and been making plugins for about a month. Normally during my free time I like to mess around with my Java project called "Testing" I just mess around with the player. and see if the plugin works. But remember that I am a new developer when it comes to plugins. A good friend of mine is teaching me but he is very busy. So if you guys don't know what I am talking about I'll display a few images so you guys know. Maybe you can show me what goes in the () or whatever? Sorry if I seem mean.


    My Java Project (A few people told me my code is horrible.)
    [​IMG]

    What I am talking about:
    [​IMG]
     
  2. Offline

    MOMOTHEREAL

    You should probably learn some basic Java beforehand... I can't even, sorry.
     
    WinX64 likes this.
  3. Offline

    ZexyMichael

    I understand.
     
  4. Offline

    Cerberus XII

    ZexyMichael,
    Here is a very fun piece of code to play around with,
    Code:java
    1. @EventHandler
    2. public void onProjectileHit(ProjectileHitEvent event) {
    3. if(event.getEntity() instanceof Arrow) {
    4. event.getEntity().getWorld().createExplosion(event.getEntity().getLocation(), 5.0F);
    5. }
    6. }

    Bearing in mind that i hope you know how to register listeners and such.
    This piece of code should create explosions when a arrow hits the ground.
     
  5. Offline

    ZexyMichael

    Me and a developer were talking about listeners and antiswear plugins. I don't know how to create listeners can you link me a video?
     
  6. Offline

    Cerberus XII

    ZexyMichael,
    Code:java
    1. package me.cerberus.bukkit;
    2.  
    3. import org.bukkit.Bukkit;
    4. import org.bukkit.entity.Arrow;
    5. import org.bukkit.event.EventHandler;
    6. import org.bukkit.event.Listener;
    7. import org.bukkit.event.entity.ProjectileHitEvent;
    8. import org.bukkit.plugin.java.JavaPlugin;
    9.  
    10. public class Main extends JavaPlugin implements Listener {
    11.  
    12. public void onEnable() {
    13. Bukkit.getServer().getPluginManager().registerEvents(this, this);
    14. }
    15.  
    16. @EventHandler
    17. public void onProjectileHit(ProjectileHitEvent event) {
    18. if(event.getEntity() instanceof Arrow) {
    19. event.getEntity().getWorld().createExplosion(event.getEntity().getLocation(), 5.0F);
    20. }
    21. }
    22.  
    23. }
    24.  

    That is about it for what you need to do xD
     
  7. Offline

    ZexyMichael

  8. Offline

    teej107

    To answer your question: The "()" or whatever is known as parameters. They go after method names and you may be able to pass information through to them. Some methods don't require anything to be passed through the parameters like your pdffile.getName() method. Other methods require information in order for it to work like your .equalsIgnoreCase() method.
     
  9. Offline

    ZexyMichael

    I mean such as player.setGamemode(Gamemode.SURVIVAL)
     
  10. Offline

    teej107

    What's the question with that?
     
  11. Offline

    ZexyMichael

    Like what can I put in with the () for like player.setGameMode(Gamemode.CREATIVE); or player.getItemInHand();
     
  12. Offline

    teej107

    player.setGameMode(GameMode.CREATIVE); Requires you to put a GameMode enum in the parameters. In your example you already have, GameMode.CREATIVE. player.getItemInHand() doesn't require you to put anything in the parameters.
     
  13. Offline

    Totom3

    ZexyMichael I don't really understand what you wanted but I have a few tips for you :
    1. Most Importantly : don't try to learn from How-to-Make-your-First-Bukkit-Plugin-Youtube videos. They'll try to "teach" you Java AND Bukkit at the same time. Result : people like you get completely lost & get their time wasted. If you want me to point you to good coding references, please tell me.
    2. Probably the best reference for learning how to use Bukkit API is simply their wiki.
    --------------------------------------------
    MOMOTHEREAL Wow, I don't believe it. The guy says he's new and kinda lost, and that he needs help with Java and Bukkit. Then you, as a perfect idiot, come & ditch him. GREAT JOB ! If you ever asked yourself why people were trying to code Bukkit plugins when they don't even know Java, then the answer is in your Youtube channel. Stupid people like you make videos where, instead of saying "For this tutorial you'll need to know Java", they try to teach Java AND Bukkit at the same time, which is a disaster for the newer coders, who now think they can code Bukkit plugins without learning Java! And it's not even their fault! It may even be yours! How dare you insult someone like that, if it's your fault they got in that situation ? Go away.
     
    teej107 likes this.
  14. Offline

    ZexyMichael

    Is there a website where I can find this?

    Thank you. I didn't want to say that because I don't want to seem like a bad guy.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  15. Offline

    teej107

    Monkey_Swag and Totom3 like this.
  16. Offline

    MOMOTHEREAL

    And where did I tell him to watch my videos? My videos are horrible, but I still appreciate constructive criticism, not this:
    And how is it MY fault if HE decides to watch my videos, or anybody's out there?
    Please quote me where I insulted anybody on this thread, and please, please explain how is it my fault (above point).
    Your main point is valid, but your arguments smell. They should
    instead of me, sir.
     
  17. Offline

    Totom3

    Take a look at this :
    Really ? Like what, you're like "Man I can't stand this, he's SUCH a noob!!"

    What do you think ? He's already checking Youtube videos & trying to learn. Those who didn't have the luck to get a good programming basis and ended up on Youtube think generally that the way of learning things IS by checking Youtube videos, where they are 'taught' how to Java & Bukkit at the same time. I have no idea where this standard came from, as if suddenly Java was so easy, you could do anything you wanted without even learning the basics.

    Now the reason why I got so mad at you, is because you are making this type of videos, and then simply insult the injury by telling a new developer to go learn Java.
     
  18. Offline

    MOMOTHEREAL

    Totom3
    I won't even comment on this... you are just assuming things like I think he is a "noob" and such.

    Continue to argue on whatever you want, you are just participating on getting this off-topic.
     
  19. Offline

    ZexyMichael

    dump? I mean bump
     
  20. Offline

    Totom3

Thread Status:
Not open for further replies.

Share This Page