Help please! A lot of light bulb symbols on my eclipse SOMETHING is wrong about my imports (healing)

Discussion in 'Plugin Development' started by zecheesy, Jul 18, 2012.

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

    zecheesy

    Here is my code (it is supposed to heal you)
    Code:
    package madeby.icheesy;
     
    import java.util.logging.Logger;
     
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.Plugin;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class main extends JavaPlugin {
        public final Logger log = Logger.getLogger("Minecraft");
       
        @Override
        public void onEnable() {
            PluginDescriptionFile pdfFile = this.getDescription();
            this.log.info(pdfFile.getName() + " v" + pdfFile.getVersion() + ": Has been enabled!");
        }
       
        @Override
        public void onDisable() {
            PluginDescriptionFile pdfFile = this.getDescription();
            this.log.info(pdfFile.getName() + " v" + pdfFile.getVersion() + ": Has been disabled!");
        }
       
        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
            Player player = (Player) sender;
            if(commandLabel.equalsIgnoreCase("heal")) {
            if(args.length == 0) {
                player.sendMessage(ChatColor.GREEN + "You have been healed!");
                player.setHealth(20);
                player.setFoodLevel(20);
                player.setFireTicks(0);
            }else if(args.length == 1) {
                if(player.getServer().getPlayer(args[0]) != null) {
                Player targetPlayer = player.getServer().getPlayer(args[0]);
                targetPlayer.sendMessage(ChatColor.GREEN + "You have been healed by " + ChatColor.GRAY + player.getName());
                player.sendMessage(ChatColor.GREEN + "You have healed" + ChatColor.GRAY + targetPlayer.getName());
                targetPlayer.setHealth(20);
                player.setFoodLevel(20);
                player.setFireTicks(0);
                }else{
                    player.sendMessage(ChatColor.RED + "Player not online");
            }
            }
            }
            return false;
        }
    }
    //if(args[0].equalsIgnoreCase("hello")) {
    //player.sendMessage(ChatColor.RED + "Hello! You need halp?");
    //}
    //if you type /help hello this happens
    and here is a picture of all the lightbulbs and stuff
    http://i.snag.gy/tFrd0.jpg
    ^^^^^^^^^^^^^^


    Can you please reply to this thread and give my info on what should be corrected and why.
    Thanks!
     
  2. Offline

    Sagacious_Zed Bukkit Docs

  3. Offline

    chaseoes

    That moment when you realize they're lightbulbs..
     
  4. Offline

    artish1

    Ummm... IF they are just Lightbulbs and its Highlighted in YELLOW, then delete the line, it means the line isnt being used BUT DONT delete it if you are going to use it. but if you'r finished and everythings done, eclipse is telling you that those imports r not being used and is just a waste of memory. so just delete em..and there ya go
     
  5. that's not his problem, he probably forgot one of the most important steps in creating an plugin, adding the bukkit api to the classpath...
     
    ZeusAllMighty11 likes this.
  6. Offline

    ZeusAllMighty11

    Did you add Craftbukkit jar to your build path?
    ALT+E (or file>properties)
    Java Build Path
    Add external jar
    select craftbukkit XXX-X.X.X
    done
     
  7. Offline

    lx3krypticx

    It's funny how you copy and pasted all of that code.
     
  8. Offline

    zecheesy

    No I didn't copy that from anyone else.
    I watched a tutorial on how to make bukkit plugin in like March-May and I needed to update my craftbukkit
    sorry
     
Thread Status:
Not open for further replies.

Share This Page