public void setPotionEffects(ArrayList<PotionEffect> effects) {
    if(effects.isEmpty()) {
      this.compound.remove("ActiveEffects");
      if(this.autosave) savePlayerData();
      return;
    }
    NBTTagList activeEffects = new NBTTagList();
    for(PotionEffect pe : effects) {
      NBTTagCompound eCompound = new NBTTagCompound();
      eCompound.setByte("Amplifier", (byte)(pe.getAmplifier()));
      eCompound.setByte("Id", (byte)(pe.getType().getId()));
      eCompound.setInt("Duration", (int)(pe.getDuration()));
      activeEffects.add(eCompound);
    }
    this.compound.set("ActiveEffects", activeEffects);
    if(this.autosave) savePlayerData();
  }