Solved "Plugin does not extend JavaPlugin"

Discussion in 'Plugin Help/Development/Requests' started by racoonsru1e, Jan 2, 2015.

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

    racoonsru1e

    My plugin "ArmorAbilities" will not start when I start my server. I am using spigot.

    Console Error:
    [​IMG]

    My Main Class:
    Code:
    package me.racoonsru1e.ArmorAbilities;
    
    import java.util.ArrayList;
    import java.util.List;
    import java.util.logging.Logger;
    
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.Sound;
    import org.bukkit.entity.Entity;
    import org.bukkit.entity.LivingEntity;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.Action;
    import org.bukkit.event.entity.EntityDamageByEntityEvent;
    import org.bukkit.event.inventory.InventoryCloseEvent;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.PlayerInventory;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.potion.PotionEffect;
    import org.bukkit.potion.PotionEffectType;
    
    public class Main extends JavaPlugin implements Listener{
        List<String> Firebow = new ArrayList<String>();
        List<String> Venombow = new ArrayList<String>();
        List<String> Slowbow = new ArrayList<String>();
        List<String> nolog = new ArrayList<String>();
    
    
        public final Logger logger = Logger.getLogger("Minecraft");
        public int tid = 0;
        public static int running = 0;
        public static long interval = 10;
        public void onEnable(){
                getServer().getPluginManager().registerEvents(this, this);
                PluginDescriptionFile pdfFile = this.getDescription();
                this.logger.info(pdfFile.getName() + " version " + pdfFile.getVersion() + " Abilities Has Been Enabled!");
            }
    
            public void OnDisable(){
                PluginDescriptionFile pdfFile = this.getDescription();
                this.logger.info(pdfFile.getName() + " version " + pdfFile.getVersion() + " Abilities Has Been Disabled!");
            }
    
            private boolean hasArmorType(ItemStack item, Material type)
            {
                return (item == null ? false : item.getType() == type);
            }
            @EventHandler
            public void eventInventoryClose(final InventoryCloseEvent event){
                final Player player = (Player) event.getPlayer();
                final PlayerInventory inventory = event.getPlayer().getInventory();
                if(hasArmorType(inventory.getHelmet(), Material.LEATHER_HELMET)
                && hasArmorType(inventory.getChestplate(), Material.LEATHER_CHESTPLATE)
                && hasArmorType(inventory.getLeggings(), Material.LEATHER_LEGGINGS)
                && hasArmorType(inventory.getBoots(), Material.LEATHER_BOOTS)){
                    player.sendMessage(ChatColor.GREEN + "Armor Set: " + ChatColor.BLUE + "Assassin");
                    player.sendMessage(ChatColor.DARK_PURPLE + "Passive: " + ChatColor.LIGHT_PURPLE + "Speed II");
                    player.sendMessage(ChatColor.DARK_PURPLE + "Passive: " + ChatColor.LIGHT_PURPLE + "Poison Dagger");
                    player.sendMessage(ChatColor.BLUE + "Active:" + ChatColor.RED + " Leap");
                    player.getWorld().playSound(player.getLocation(), Sound.LEVEL_UP, 1.0F, 17.0F);
                    tid = Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
                        public void run(){
                            ((Player)event.getPlayer()).addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 40, 0));
                        }
                    }
                    , 0, 20);
                }
           
                if(hasArmorType(inventory.getHelmet(), Material.IRON_HELMET)
                && hasArmorType(inventory.getChestplate(), Material.IRON_CHESTPLATE)
                && hasArmorType(inventory.getLeggings(), Material.IRON_LEGGINGS)
                && hasArmorType(inventory.getBoots(), Material.IRON_BOOTS)){
                    Bukkit.getScheduler().cancelTask(this.tid);
                    ((Player)event.getPlayer()).removePotionEffect(PotionEffectType.SPEED);
                    player.sendMessage(ChatColor.GREEN + "Armor Set: " + ChatColor.GRAY + "Warrior");
                    player.sendMessage(ChatColor.BLUE + "Active: " + ChatColor.LIGHT_PURPLE + "Resist");
                    player.sendMessage(ChatColor.BLUE + "Active: " + ChatColor.LIGHT_PURPLE + "Charge");
                    player.getWorld().playSound(player.getLocation(), Sound.LEVEL_UP, 1.0F, 17.0F);
                                }
                if(hasArmorType(inventory.getHelmet(), Material.DIAMOND_HELMET)
                        && hasArmorType(inventory.getChestplate(), Material.DIAMOND_CHESTPLATE)
                        && hasArmorType(inventory.getLeggings(), Material.DIAMOND_LEGGINGS)
                        && hasArmorType(inventory.getBoots(), Material.DIAMOND_BOOTS)){
                            Bukkit.getScheduler().cancelTask(this.tid);
                            ((Player)event.getPlayer()).removePotionEffect(PotionEffectType.SPEED);
                            player.sendMessage(ChatColor.GREEN + "Armor Set: " + ChatColor.GRAY + "Champion");
                            player.sendMessage(ChatColor.DARK_PURPLE + "Passive: " + ChatColor.LIGHT_PURPLE + "Heavy Armor (Slowness I, Resistance I)");
                            player.sendMessage(ChatColor.DARK_PURPLE + "Passive: " + ChatColor.LIGHT_PURPLE + "Restricted Blows (Weakness I)");
                            player.sendMessage(ChatColor.BLUE + "Active: " + ChatColor.LIGHT_PURPLE + "Gravitational Anomaly");
                            player.getWorld().playSound(player.getLocation(), Sound.LEVEL_UP, 1.0F, 17.0F);
                                        }
                if(hasArmorType(inventory.getHelmet(), Material.GOLD_HELMET)
                        && hasArmorType(inventory.getChestplate(), Material.GOLD_CHESTPLATE)
                        && hasArmorType(inventory.getLeggings(), Material.GOLD_LEGGINGS)
                        && hasArmorType(inventory.getBoots(), Material.GOLD_BOOTS)){
                            Bukkit.getScheduler().cancelTask(this.tid);
                            ((Player)event.getPlayer()).removePotionEffect(PotionEffectType.SPEED);
                            player.sendMessage(ChatColor.GREEN + "Armor Set: " + ChatColor.GOLD + "Warlock");
                            player.sendMessage(ChatColor.DARK_PURPLE + "Passive: " + ChatColor.LIGHT_PURPLE + "Aura of Corruption");
                            player.getWorld().playSound(player.getLocation(), Sound.LEVEL_UP, 1.0F, 17.0F);
                            for (Entity e : player.getNearbyEntities(10, 10, 10)){
                                if(e instanceof Player){
                                    ((Player) e).addPotionEffect(new PotionEffect(PotionEffectType.POISON, 5, 1));
                                    ((Player) e).sendMessage(ChatColor.GREEN + "You feel your heart corrupting...");
                                        }
                if(hasArmorType(inventory.getHelmet(), Material.CHAINMAIL_HELMET)
                        && hasArmorType(inventory.getChestplate(), Material.CHAINMAIL_CHESTPLATE)
                        && hasArmorType(inventory.getLeggings(), Material.CHAINMAIL_LEGGINGS)
                        && hasArmorType(inventory.getBoots(), Material.CHAINMAIL_BOOTS)){
                            Bukkit.getScheduler().cancelTask(this.tid);
                            ((Player)event.getPlayer()).removePotionEffect(PotionEffectType.SPEED);
                            player.sendMessage(ChatColor.GREEN + "Armor Set: " + ChatColor.AQUA + "Archer");
                            player.sendMessage(ChatColor.BLUE + "Active: " + ChatColor.LIGHT_PURPLE + "Bowtypes");
                            player.getWorld().playSound(player.getLocation(), Sound.LEVEL_UP, 1.0F, 17.0F);
                            Firebow.add(player.getName());
                                        }
                if(inventory.getHelmet() == null
                        || inventory.getChestplate() == null
                        || inventory.getLeggings() == null
                        || inventory.getBoots() == null){
                                Bukkit.getScheduler().cancelTask(this.tid);
                                ((Player)event.getPlayer()).removePotionEffect(PotionEffectType.SPEED);
                                ((Player)event.getPlayer()).sendMessage("Armor Set: None");
                            }
                        }
                    }
                }
            private ArrayList<String> leap = new ArrayList<String>();
            @EventHandler
            public void onPlayerInteract(final PlayerInteractEvent event){
               if(leap.contains(event.getPlayer().getName())) { event.setCancelled(true); return;}
               final Player player = event.getPlayer();
               if(player.getInventory().getBoots().getType() == Material.LEATHER_BOOTS){
                     if(player.getInventory().getLeggings().getType() == Material.LEATHER_LEGGINGS){
                         if(player.getInventory().getChestplate().getType() == Material.LEATHER_CHESTPLATE){
                             if(player.getInventory().getHelmet().getType() == Material.LEATHER_HELMET){
                                 if(player.getItemInHand().getType() == Material.IRON_AXE){
                   if (event.getAction() == Action. RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK ){
                  player.sendMessage(ChatColor.BLUE + "You used" + ChatColor.GREEN + " Leap!" );
                  player.setVelocity(player.getLocation().getDirection().multiply(1.5));
                  player.getWorld().playSound(player.getLocation(), Sound.FIZZ, 1.0F, 17.0F);
                  leap.add(player.getName());
                  player.sendMessage(ChatColor.RED + "You must wait 6 seconds until you may use " + ChatColor.GREEN + "Leap " + ChatColor.RED + "again.");
                 getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
                      public void run(){
                      player.sendMessage(ChatColor.GREEN + "You may now use Leap!");
                      leap.remove(event.getPlayer().getName());
                                          }
                                      }, 120);
                                  }
                             }
                         }   
                     }
                   }
            }
            }
           private ArrayList<String> charge = new ArrayList<String>();
           @EventHandler
           public void onPlayerInteract1(final PlayerInteractEvent event){
               if(charge.contains(event.getPlayer().getName())) { event.setCancelled(true); return;}
               final Player player = event.getPlayer();
               if(player.getInventory().getBoots().getType() == Material.IRON_BOOTS){
                   if(player.getInventory().getLeggings().getType() == Material.IRON_LEGGINGS){
                    if(player.getInventory().getChestplate().getType() == Material.IRON_CHESTPLATE){
                     if(player.getInventory().getHelmet().getType() == Material.IRON_HELMET){
                         if(player.getItemInHand().getType() == Material.IRON_AXE){
                         if (event.getAction() == Action. RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK ){
                        player.sendMessage(ChatColor.BLUE + "You used: " + ChatColor.GREEN + "Charge!");
                        player.getWorld().playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1.0F, 17.0F);
                        player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 6*20, 1));
                        charge.add(player.getName());
                        player.sendMessage(ChatColor.RED + "You must wait 12 seconds until you may use " + ChatColor.GREEN + "Charge " + ChatColor.RED + "again.");
                        getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
                            public void run(){
                               player.sendMessage(ChatColor.GREEN + "You may now use Charge!");
                                 charge.remove(event.getPlayer().getName());
                                                }
                                        }, 240);
                                      }
                                 }
                            }
                        }
                    }
                   }
           }
           private ArrayList<String> slam = new ArrayList<String>();
           @EventHandler
           public void onPlayerinteract2(final PlayerInteractEvent event){
               if(slam.contains(event.getPlayer().getName())) {event.setCancelled(true); return;}
               final Player player = event.getPlayer();
               if(player.getInventory().getBoots().getType() == Material.DIAMOND_BOOTS){
                   if(player.getInventory().getLeggings().getType() == Material.DIAMOND_LEGGINGS){
                       if(player.getInventory().getChestplate().getType() == Material.DIAMOND_CHESTPLATE){
                           if(player.getInventory().getHelmet().getType() == Material.DIAMOND_HELMET){
                               if(player.getItemInHand().getType() == Material.DIAMOND_AXE){
                                   if(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK){
                                       player.sendMessage(ChatColor.BLUE + "You used: " + ChatColor.GREEN + "Slam!");
                                       player.getWorld().playSound(player.getLocation(), Sound.IRONGOLEM_DEATH, 1.0F, 17.0F);
                                       slam.add(player.getName());
                                   }
                               }
                           }
                       }
                   }
               }
           }
           private ArrayList<String> resist = new ArrayList<String>();
           @EventHandler
           public void onEntityDamageSnail(EntityDamageByEntityEvent event) {
             if(resist.contains(event.getEntity().getEntityId())) { event.setCancelled(true); return;}
             final Player player = (Player) event.getEntity();
             final Player pd = (Player)event.getDamager();
             if(((event.getDamager() instanceof Player)) && ((event.getEntity() instanceof Player))) {
                 if(pd.getInventory().getBoots().getType() == Material.LEATHER_BOOTS){
                     if(pd.getInventory().getLeggings().getType() == Material.LEATHER_LEGGINGS){
                         if(pd.getInventory().getChestplate().getType() == Material.LEATHER_CHESTPLATE){
                             if(pd.getInventory().getHelmet().getType() == Material.LEATHER_HELMET){
                               if(pd.getItemInHand().getType() == Material.MELON_STEM){
                               PotionEffect p1 = new PotionEffect(PotionEffectType.POISON, 60, 1);
                               PotionEffect p2 = new PotionEffect(PotionEffectType.SLOW, 60, 1);
                               p1.apply((LivingEntity)event.getEntity());
                               p2.apply((LivingEntity)event.getEntity());
                                       }   
                                 }            
                             }
                         }                
                     }         
                 }
             if(player.getInventory().getBoots().getType() == Material.IRON_BOOTS){
                 if(player.getInventory().getLeggings().getType() == Material.IRON_LEGGINGS){
                  if(player.getInventory().getChestplate().getType() == Material.IRON_CHESTPLATE){
                   if(player.getInventory().getHelmet().getType() == Material.IRON_HELMET){
                    if(player.isBlocking()){
                      player.sendMessage(ChatColor.BLUE + "You used: " + ChatColor.GREEN + "Resist!");
                      player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 2*20, 126));
                      player.getWorld().playSound(player.getLocation(), Sound.BLAZE_HIT, 1.0F, 17.0F);
                      resist.add(player.getName());
                      player.sendMessage(ChatColor.RED + "You must wait 10 seconds until you may use " + ChatColor.GREEN + "Resist " + ChatColor.RED + "again.");
                      getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
                          public void run(){
                             player.sendMessage(ChatColor.GREEN + "You may now use Resist!");
                              resist.remove(player);
                                          }
                                      }, 200);
                                }
                           }
                          }
                     }
                 }
        
           }
    }
         
    I hope someone can help.

    Thanks.
     
    Last edited: Jan 3, 2015
  2. Offline

    Tecno_Wizard

    @racoonsru1e, we do not support spigot on this forum, and I have no idea what your problem is.
     
  3. @Tecno_Wizard Spigot is supported in the Bukkit Alternates section. We just do not support offline mode.
     
  4. Offline

    Tecno_Wizard

    @bwfcwalshy, really? Wow, so many people have lashed out at me for anyone with anything spigot, but staying on topic, what ide are you using @racoonsru1e?
     
  5. @Tecno_Wizard We didn't use to but once Curse came in this section was made.

    The code looks fine apart from all the bad practices.
     
  6. Offline

    Tecno_Wizard

    @bwfcwalshy, that would explain it. I wasn't really fond of that rule.
    My thought was that it might be compiling incorrectly.
     
  7. Offline

    racoonsru1e

    I am using eclipse.

    Sorry for the bad practices... I am not an experienced programmer.

    A small exclamation mark does appear on the project folder in eclipse. I have searched the code for errors but nothing appears.
     
  8. @racoonsru1e That means your jar isn't in or another jar that you can't access is.
     
  9. Offline

    Tecno_Wizard

    @racoonsru1e, let me simplify that.
    Basically, either you have the wrong version of java specified, or the bukkit jar is not linked.
     
  10. Offline

    racoonsru1e

    How do I know what the right version of Java is?

    Is it possible to still download the latest version of CraftBukkit instead of Spigot, because of the law suite and all?

    EDIT: On the Spigot website, there was a link to download the latest "CraftBukkit" jar file. I downloaded it and added it as an external source in Eclipse. I exported the plugin with the new jar and it worked perfectly. Problem solved thank you!

    @bwfcwalshy
     
    Last edited: Jan 3, 2015
Thread Status:
Not open for further replies.

Share This Page