Player player = (Player) ?????

Discussion in 'Plugin Development' started by Lactem, Feb 28, 2013.

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

    Lactem

    Moderator please close this thread.
     
  2. Offline

    chasechocolate

    What event are you using? Usually it is event.getPlayer().
     
  3. Offline

    Lactem

    Well that's the thing. I don't know how I'm supposed to set it up. I know I have the option of doing something like this: publicvoid onProjectileLaunch(ProjectileLaunchEvent event) {, but what other options do I have?
     
  4. Offline

    chasechocolate

  5. Offline

    Lactem

    I see all of this, but I don't know how to set it up. Look at my code.
    Code:
    package chartx;
     
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.entity.ProjectileHitEvent;
    import org.bukkit.event.entity.ProjectileLaunchEvent;
    import org.bukkit.entity.Player;
    import org.bukkit.entity.Projectile;
    import org.bukkit.entity.Entity;
    public class noenderpearldamage  {
        [USER=90796525]EventHandler[/USER]
        public void setBounce(boolean doesBounce) {
        }
    }
    I have no idea what I'm doing. The problem is setting this up. If you look up a tutorial of how to make a plugin, it will give you the public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){ } to make a command, which is NOT what I'm trying to do. I'm trying to make players not take damage from throwing ender pearls. The problem is the basic setup. How do I make it so I can use player.getEntity().setBounce(true)????

    Thanks,
    Lactem
     
  6. Offline

    juampi_92

    you cant (or shouldnt) extend the player class.
    This means you cant do this: player.doSomethingNew()
    What you could do is: noEnderPearlDamage.setBounce( player.getName() , true )

    And noEnderPearDamage has an arraylist of every player that it is set to true.

    I dont know which tutorial did you see, but you should keep watching/reading more if you want to do a plugin...
    You seem to be missing the basics of the structure. There are plenty of youtube tutorials if bukkit's guide isn't enough

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

    Lactem

    Code:
    package chartx;
     
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.entity.ProjectileHitEvent;
    import org.bukkit.event.entity.ProjectileLaunchEvent;
    import org.bukkit.entity.Player;
    import org.bukkit.entity.Projectile;
    import org.bukkit.entity.Entity;
    public class noenderpearldamage  {
    noenderpearldamage.setBounce(player.getName(), true);
    }
    This doesn't work, so what do you think I'm missing? Do you want the error report, too?
     
  8. Offline

    Digi

    You seem to not understand classes and methods, you need to learn some basic Java first :p

    There you need to set up a class that implements Listener and add a method to it (with any name) that has EventHandler annotation on it and the event class as the first argument... this is probably just a bunch of weird stuff to you but if you want to make plugins you'll have to understand them...

    If you only need the end-product then post in the requests :p
     
  9. Offline

    Lactem

    Yeah, I know what that stuff is, but I haven't made any plugins before. Thanks for your help.
     
  10. Offline

    Digi

  11. Offline

    mastermustard

    you need more tutorials....
     
Thread Status:
Not open for further replies.

Share This Page