1.7.2 bukkit messes up coding

Discussion in 'Plugin Development' started by Brett Basinger, Mar 29, 2014.

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

    Brett Basinger

    So A friend told me to use 1.5.2 bukkit as the project path instead of 1.7.2, I was curious why he told me to do that and now I realize. Some of my code is crossed out and it is sending errors. Plz help!



    PLEASE HELP!



    Code:java
    1. package me.brett.kits;
    2.  
    3.  
    4. import org.bukkit.Material;
    5. import org.bukkit.entity.Entity;
    6. import org.bukkit.entity.Player;
    7. import org.bukkit.entity.Projectile;
    8. import org.bukkit.entity.Snowball;
    9. import org.bukkit.event.EventHandler;
    10. import org.bukkit.event.Listener;
    11. import org.bukkit.event.block.Action;
    12. import org.bukkit.event.entity.ProjectileHitEvent;
    13. import org.bukkit.event.player.PlayerInteractEvent;
    14. import org.bukkit.potion.PotionEffect;
    15. import org.bukkit.potion.PotionEffectType;
    16.  
    17. public class WizardListener implements Listener{
    18. public WizardListener (Main instance) {
    19. }
    20. @EventHandler
    21. public void onPlayerInteract(PlayerInteractEvent e){
    22. if (!(e.getAction() == Action.RIGHT_CLICK_BLOCK)
    23. || !(e.getAction() == Action.RIGHT_CLICK_AIR))
    24. return;
    25. if (!(e.getItem().getType() == Material.BLAZE_ROD))
    26. return;
    27. e.getPlayer().launchProjectile(Snowball.class);
    28. }
    29. @EventHandler
    30. public void onProjectileHit(ProjectileHitEvent e){
    31. Projectile p = e.getEntity();
    32. if (!(p instanceof Snowball)) return;
    33. Snowball s = (Snowball) p;
    34. s.getWorld().createExplosion(s.getLocation(), 0F);
    35. for (Entity en : s.getNearbyEntities(5, 5, 5)){
    36. if (en instanceof Player){
    37. Player pl = (Player) en;
    38. if (!(pl == e.getEntity().getShooter())) pl.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 100, 0));
    39. }
    40. }}
    41. }
    42.  


    The getShooter bit is crossed out.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  2. Brett Basinger
    2 things:
    1. Why don't you tell us what errors you're getting so we can actually help you?
    2. Why do you have an empty constructor for your class? You don't need it.
     
  3. Offline

    Wolfey

    Brett Basinger They are deprecated methods, I believe. They're not actual errors, but in the later updates if those methods get removed, your plugin will beak.

    But why exactly are you using a 1.5 build?
     
  4. Offline

    Brett Basinger

    Wolfey So I can just keep the 1.7.2 java build path and not have any errors?
     
  5. Offline

    Wolfey

    Brett Basinger It's not an error, it's a warning that the method is deprecated, you can export it and the plugin will work just fine in the current version. If it bothers you that much, you can suppress the warning, and it will go away.

    Although if you want, you can replace it up a new build, since coding in a 1.5 build is useless.
     
  6. Offline

    Garris0n

  7. Garris0n
    Good catch. Didn't realize I was looking at the RB docs. I feel stupid ;)
     
Thread Status:
Not open for further replies.

Share This Page