getConfig help

Discussion in 'Plugin Development' started by JarFile, Jan 25, 2015.

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

    JarFile

    Code:
        @EventHandler
        public void EXP(BlockBreakEvent e)
        {
            Player p = e.getPlayer();
            Block b = e.getBlock();
           
            if(b.getType() == Material.COBBLESTONE)
            {
                p.giveExp(plugin.getConfig().getString("EXPCobblestone"));
            }
        }
    
    In here it won't let me get the config. Iit gives me a red line under giveExp. I can't think of a way I can do valueOf in an int, but if there is any way I can get a config from there can you please tell me.
     
  2. Offline

    ArticleZero

    Assuming you've already created an instance of the plugin to retrieve the config, you can either use
    Integer.valueOf(string)
    or
    plugin.getConfig().getInt("path")
     
  3. Offline

    Ambamore2000

    Use Integer.parseInt(String) or what @ArticleZero said.

    EDIT: Seeing that you're using EXP, you're probably going to use Short.parseShort(String), which, I am not sure if that exists, or just cast the int to a short.
     
Thread Status:
Not open for further replies.

Share This Page