Plugin Code - Working or Broken? -

Discussion in 'Plugin Development' started by Aeromcdoom, Dec 19, 2011.

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

    Aeromcdoom

    Code:
            public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
                if(cmd.getName().equalsIgnoreCase("place1")){
                    File confFile = new File(plugin.getDataFolder(), "config"+player.name+".yml");
                    FileConfiguration conf = YamlConfiguration.loadConfiguration(configFIle);
                    conf.save(player.Location,"plac1");
                    // etc.
                    conf.save(confFile);
                    return true;
                } //If this has happened the function will break and return true. if this hasn't happened the a value of false will be returned.
                return false;
            }
    Would this work? To save the location of a player to configAeroMcDoom.yml
     
  2. Offline

    Drakonix

    You need an if statement to check if sender is a player.

    Code:JAVA
    1. if(sender instanceof Player) { Player player = sender;}
     
Thread Status:
Not open for further replies.

Share This Page