package com.lothrazar.cyclicmagic.module;
import com.lothrazar.cyclicmagic.util.Const;
import com.lothrazar.cyclicmagic.util.UtilExperience;
import com.lothrazar.cyclicmagic.util.UtilSound;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.event.entity.player.AchievementEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

public class AchievementExpModule extends BaseEventModule {
  private boolean isEnabled;
  @SubscribeEvent
  public void onAchievement(AchievementEvent event) {
    if (isEnabled) {
      EntityPlayer p = event.getEntityPlayer();
      if (event.getAchievement().isAchievement() && p.hasAchievement(event.getAchievement()) == false) {
        int mult = (event.getAchievement().getSpecial()) ? 100 : 1;
        int amt = mult * (p.worldObj.rand.nextInt(30) + 20);// between 20,30
        UtilExperience.setXp(p, (int) UtilExperience.getExpTotal(p) + amt);
        UtilSound.playSound(p, SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP);
      }
    }
  }
  @Override
  public void syncConfig(Configuration config) {
    isEnabled = config.getBoolean("Exp Achievements", Const.ConfigCategory.player, true, "Get experience from achievements (random 20-30 exp, multiplied by 100 if it is flagged as special)");
  }
}

@@ -614,24 +614,299 @@
 nt event) %7B%0A
+    //something changed where now i catch this event even if the player MAYBE DID NOT%0A    //get the ach : https://github.com/PrinceOfAmber/Cyclic/issues/60%0A    //so i have to check 2 %0A    // 1 do i already have it%0A    //and 2 do i not have it but i dont have the parent one %0A
     if (isEn
@@ -962,16 +962,74 @@
 ayer();%0A
+      //am i getting an achievement that i have already? %0A
       if
@@ -1121,24 +1121,297 @@
 == false) %7B%0A
+        if (event.getAchievement().parentAchievement == null%0A            %7C%7C p.hasAchievement(event.getAchievement().parentAchievement) == true) %7B%0A          //either the parent ach is null, so we get in.%0A          //OR parent is not null, but we have it (true) so is fine%0A  
         int 
@@ -1466,16 +1466,18 @@
 00 : 1;%0A
+  
         
@@ -1545,16 +1545,18 @@
 n 20,30%0A
+  
         
@@ -1627,24 +1627,26 @@
 t);%0A        
+  
 UtilSound.pl
@@ -1699,16 +1699,26 @@
 ICKUP);%0A
+        %7D%0A
       %7D%0A
@@ -1784,24 +1784,61 @@
 n config) %7B%0A
+    //new in 1.4.5 defaults to false%0A
     isEnable
@@ -1908,19 +1908,20 @@
 player, 
-tru
+fals
 e, %22Get 

fix exp achieves firing at invalid times: issue #60