Development Assistance main class does not extend JavaPlugin

Discussion in 'Plugin Help/Development/Requests' started by rhunter, Apr 28, 2015.

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

    rhunter

    Code:
    package me.reece.gunsplugin;
    import org.bukkit.Effect;
    import org.bukkit.Material;
    import org.bukkit.entity.Entity;
    import org.bukkit.entity.Player;
    import org.bukkit.entity.Projectile;
    import org.bukkit.entity.Snowball;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.Action;
    import org.bukkit.event.entity.ProjectileHitEvent;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    public class Main extends JavaPlugin implements Listener {
    //////////////////////PISTOL////////////////////////
    @EventHandler
    public void onPlayerInteract(final PlayerInteractEvent e) {
    if(!(e.getAction() == Action.RIGHT_CLICK_AIR)) return;
    if(!(e.getItem().getType() == Material.BLAZE_ROD)) return;
    Snowball s = e.getPlayer().launchProjectile(Snowball.class);
    s.getWorld().playEffect(e.getPlayer().getLocation(), Effect.SMOKE, 10);
    }
    @EventHandler
    public void onProjectileHit(ProjectileHitEvent e) {
    Projectile p = e.getEntity();
    if(!(p instanceof Snowball)) {
    return;
    }
    Snowball s = (Snowball) p;
    s.getWorld().createExplosion(s.getLocation(), 5.0F);
    for(Entity en : s.getNearbyEntities(5, 30, 5)) {
    if(en instanceof Player) {
    Player pl = (Player) en;
    if(!(pl == e.getEntity().getShooter())) pl.setHealth(Math.max(0, pl.getHealth() - 2D));
    }
    }
    }
    }
    im really confused conole says "main class does not extend JavaPlugin". There are no errors in my plugin, but on the side there is the error sign. I use eclipse and im using craftbukkit-1.8-R0.1-SNAPSHOT-latest as my external source
     
  2. Offline

    bohafr

    Can you post your plugin.yml?
     
  3. Offline

    LetsTalkTnTHere

    You have to add an onenable method to register the events in i think.
     
  4. Offline

    teej107

    That has nothing to do with the OP's problem though.
    Did you provide the right class as the main in your plugin.yml?
    umm..... what?
     
    nverdier likes this.
  5. Online

    timtower Administrator Administrator Moderator

    Moved to Bukkit alternatives
     
  6. Offline

    rhunter

  7. Offline

    LetsTalkTnTHere

    @rhunter I had it ones because an external JAR was missing, so you probably removed it or moved the external jar to another location(if that's the case)
     
Thread Status:
Not open for further replies.

Share This Page