Solved getInt help

Discussion in 'Plugin Development' started by pkt, Dec 8, 2012.

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

    pkt

    Ok, so me and my friend are having trouble getting an int from the config
    The problem is that either the droppedExp is set to 0 or it is set to default.

    PHP:
        @EventHandler
        
    public void onGiantDeath(EntityDeathEvent event) {
            
    Entity entity event.getEntity();
     
            if (
    API.isGiant(entity)) {
                
    event.setDroppedExp(API.getFileHandler().getInt(0Config.CONFIG"Giants Configuration.Giant Stats.Experience"));
            }
        }
    PHP:
        public int getInt(int fallBackConfig fileString path) {
            
    int i;
            try {
                
    = (int) Math.round(getDouble(pathfallBack));
            } catch (
    Exception e) {
                
    fallBack;
            }
            return 
    i;
        }
     
        public 
    double getDouble(String pathdouble fallBack) {
            
    double d;
            try {
                
    Double.parseDouble(path);
            } catch (
    Exception e) {
                
    fallBack;
            }
            return 
    d;
        }
    Does anyone know a better approach to get an int from the config?
     
  2. Offline

    RealDope

  3. Offline

    pkt

    I have already tried that before :/
     
  4. Offline

    gomeow

    If it didn't work, you weren't doing it right...

    What did you try?
    it should be this.getConfig().getInt(path);
     
Thread Status:
Not open for further replies.

Share This Page