Solved Please Help My Code Keeps Telling Me To End My Statement

Discussion in 'Spigot Help' started by DaPolarBoss926_, Jun 4, 2017.

Thread Status:
Not open for further replies.
  1. Hello guys, I never made a plugin in a while, so this might be a noob question, but my plugin keeps saying to end my statement, I will underline where the error is and what Eclipse says it is.

    package me.shard.slow;
    import org.bukkit.entity.Player;
    import org.bukkit.entity.Snowball;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.entity.EntityDamageByEntityEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.potion.PotionEffect;
    import org.bukkit.potion.PotionEffectType;
    public class IceShard extends JavaPlugin{

    @SuppressWarnings("deprecation")
    @EventHandler
    public void onEntityDamage(EntityDamageByEntityEvent e) {
    if (e.getEntity() instanceof Player && e.getDamager() instanceof Snowball) {
    Player player = (Player) e.getEntity();
    Snowball snowball = (Snowball) e.getDamager();

    if (!(snowball.getShooter() instanceof Player)) return;
    player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 10, 5));
    player.damage(2);
    }

    }
    }



    (The error is: Syntax error, insert "}" to complete Statement) I tried it, but then it puts the same error in a different line. What's going on?
     
  2. The code seems correct. Maybe this is a bug with Eclipse. Did you try to restart Eclipse?
     
  3. I did, I had to start it up again, I come back there is the same error.
     
  4. Try to remove the line and check if the error is still there.
     
  5. I removed the line, it has the same error on the previous line.
     
  6. I put your code into Eclipse and I don't get any errors. Maybe just ignore it?
     
    • Agree Agree x 1
  7. Try to compile the code. The error might go away...
     
  8. Maybe your eclipse is outdated.
     
  9. It shouldn't be, I just reinstalled it a few days ago.
     
  10. Oh, Okay well I'm testing the plugin I will tell you guys if the plugin doesn't work.
     
  11. The plugin doesn't work, so this must effect the whole code, there is not even an error message in the console :mad:
     
  12. If it compiles fine, just ignore it
     
  13. When the snowball hits the player nothing happens.
     
  14. Could it have to do with the fact that snowballs no longer damage entities? (Sorry if this is dumb, I have never used EntityDamageByEntityEvent)
     
  15. Did you register your listener?

    No
     
  16. Does it say that the plugin was enabled when the server is starting? Make sure that there is a } for every { in your class.
     
  17. THANK YOU SO MUCH!! THREAD CLOSED!! Thanks to everyone who helped.
     
    • Like Like x 1
Thread Status:
Not open for further replies.