Plugin error's

Discussion in 'Plugin Development' started by IISeanII, Jun 24, 2013.

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

    IISeanII

    So i have this error.. i made the errors red and underlined.. can anyone help me?

    here is a pastebin link http://pastebin.com/j7nLvvkp



    package me.IISeanII.spakwarp;

    import java.util.logging.Logger;

    import org.bukkit.ChatColor;
    import org.bukkit.Location;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.java.JavaPlugin;


    public class spakwarp extends JavaPlugin{
    public final Logger logger = Logger.getLogger("Minecraft");
    public static spakwarp plugin;

    PluginDescriptionFile pdfFile = this.getDescription();
    public final Location[] warpLocations = new Location[100];
    public final String[] warpName = new String[100];
    int warpCounter = 0;

    @Override
    public void onDisable() {
    this.logger.info(pdfFile.getName() + " Has Been Disabled!");
    }

    @Override
    public void onEnable() {
    PluginDescriptionFile pdfFile = this.getDescription();
    this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion() + " Has Been Enabled!");
    }

    public boolean onCommand(CommandSender sender, Command cmd,
    String commandLabel, String[] args){
    Player player = (Player) sender;
    if(commandLabel.equalsIgnoreCase("setswarp")){
    if(args.length ==0){
    player.sendMessage(ChatColor.RED + "/setswarp <swarpname>");
    }else{
    Location location = player.getLocation();
    if(!(warpCounter > 100)){
    warpLocations[warpCounter] = location;
    warpName[warpCounter] = args[0];
    warpCounter++;
    player.sendMessage(ChatColor.GREEN + "Swarp Set As: " + args[0]);
    }else{
    player.sendMessage(ChatColor.RED+"Swarp Limit Exceeded! Unable To Create Warp!");

    }
    }
    } else if(commandLabel.equalsIgnoreCase("swarp")){
    for(int i = 0; i < warpName.length; i++){
    String warpname = warpName;
    if(args[0].equalsIgnoreCase(warpName)){
    Location warpLocation = warpLocations;
    player.teleport(warpLocation);
    player.sendMessage(ChatColor.GREEN +"You are now at "
    + warpName);
    break;
    }
    }
    } else if(commandLabel.equalsIgnoreCase("swarp list")){
    String warps = "";
    for(int i = 0; i <warpName.length; i++){
    if(i != warpName.length){
    warps+=warpName + ", ".replace("Null", "");
    }else{
    player.sendMessage(ChatColor.DARK_GRAY + "Swarps List: " + ChatColor.DARK_GRAY );
    }
    }
     
  2. Offline

    Rocoty

    You are missing two closing brackets at the end.

    The error for equalsIgnoreCase is due to the fact that you are trying to compare a String to an array of Strings...I think what you want is
    Code:
    if(args[0].equalsIgnoreCase(warpname)){
    But naming two variables so similarly should be avoided
     
Thread Status:
Not open for further replies.

Share This Page