Code is bad help me

Discussion in 'Spigot Help' started by Newpredator, May 1, 2015.

  1. Code (Text):
    package me.newpredator;

    import java.util.logging.Level;
    import java.util.logging.Logger;
    import org.bukkit.ChatColor;
    import org.bukkit.Sound;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;

    public class UtilCommands
      extends JavaPlugin
    {
      public static final Logger log = Logger.getLogger("Minecraft:");
     
      public void onEnable()
      {
        log.log(Level.INFO, "Plugin Activated");
        if (!Config.configFile.exists()) {
          Config.save();
        }
        Config.load();
      }
     
      public void onDisable() {}
     
      public boolean onCommand1(CommandSender sender, Command cmd, String label, String[] args)
      {
        if ((cmd.getName().equalsIgnoreCase("GETNAME")) && ((sender instanceof Player)))
        {
          Player player = (Player)sender;
          sender.sendMessage("------------");
          sender.sendMessage(Config.MSG);
          sender.sendMessage("");
          sender.sendMessage(ChatColor.GREEN + sender.getName());
          sender.sendMessage("");
          player.playSound(player.getLocation(), Sound.NOTE_PLING, 1.0F, 1.0F);
          {
              return true;
          }
        }
        return false;
      }
          public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
          {
            if ((cmd.getName().equalsIgnoreCase("INFO")) && ((sender instanceof Player)))
            {
              Player player = (Player)sender;
              sender.sendMessage("");
              sender.sendMessage(Config.INFO);
              sender.sendMessage("");
              player.playSound(player.getLocation(), Sound.NOTE_PLING, 1.0F, 1.0F);
         
         
              return true;
        }
        return false;
      }
    }

     
     
  2. joehot200

    Supporter

    You forgot @Override. Also, why are you getting the logger with a colon on it (or for that matter, why have you even got the log at all? :O).

    Why are you referring to a static Config class (which I presume does something?) - Is all of that correct? Is there any errors?
     
  3. why do you have two onCommands?
     
  4. I highly recommend you learn Java before using the Bukkit/Spigot API.